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

Subversion Repositories zipcpu

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

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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-04-06 17:56:01.475918570 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-04-06 17:56:01.479918541 -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 122 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-04-06 17:56:01.479918541 -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 122 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-04-06 17:47:47.255349663 -0400
700
@@ -0,0 +1,2099 @@
701 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
702
+//
703
+// Filename:   zip.c
704
+//
705
+// Project:    Zip CPU backend for the GNU Compiler Collection
706
+//
707
+// Purpose:
708
+//
709
+// Creator:    Dan Gisselquist, Ph.D.
710
+//             Gisselquist Technology, LLC
711
+//
712
+////////////////////////////////////////////////////////////////////////////////
713
+//
714
+// Copyright (C) 2016, Gisselquist Technology, LLC
715
+//
716
+// This program is free software (firmware): you can redistribute it and/or
717
+// modify it under the terms of  the GNU General Public License as published
718
+// by the Free Software Foundation, either version 3 of the License, or (at
719
+// your option) any later version.
720
+//
721
+// This program is distributed in the hope that it will be useful, but WITHOUT
722
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
723
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
724
+// for more details.
725
+//
726
+// You should have received a copy of the GNU General Public License along
727
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
728
+// target there if the PDF file isn't present.)  If not, see
729
+// <http://www.gnu.org/licenses/> for a copy.
730
+//
731
+// License:    GPL, v3, as defined and found on www.gnu.org,
732
+//             http://www.gnu.org/licenses/gpl.html
733
+//
734
+//
735
+////////////////////////////////////////////////////////////////////////////////
736
+#include "config.h"
737
+#include "system.h"
738
+#include "coretypes.h"
739
+#include "tm.h"
740
+#include "rtl.h"
741
+#include "dominance.h"
742
+#include "cfg.h"
743
+#include "cfgrtl.h"
744
+#include "cfganal.h"
745
+#include "lcm.h"
746
+#include "cfgbuild.h"
747
+#include "cfgcleanup.h"
748
+#include "predict.h"
749
+#include "basic-block.h"
750
+#include "df.h"
751
+#include "hashtab.h"
752
+#include "hash-set.h"
753
+#include "machmode.h"
754
+#include "symtab.h"
755
+#include "rtlhash.h"
756
+#include "tree.h"
757
+#include "regs.h"
758
+#include "hard-reg-set.h"
759
+#include "real.h"
760
+#include "insn-config.h"
761
+#include "conditions.h"
762
+#include "output.h"
763
+#include "insn-attr.h"
764
+#include "flags.h"
765
+#include "expr.h"
766
+#include "function.h"
767
+#include "recog.h"
768
+#include "toplev.h"
769
+#include "ggc.h"
770
+#include "builtins.h"
771
+#include "calls.h"
772
+#include "langhooks.h"
773
+#include "optabs.h"
774
+#include "explow.h"
775
+#include "emit-rtl.h"
776 122 dgisselq
+#include "ifcvt.h"
777 102 dgisselq
+
778
+// #include "tmp_p.h"
779
+#include "target.h"
780
+#include "target-def.h"
781
+// #include "tm-constrs.h"
782 122 dgisselq
+#include "tm-preds.h"
783 102 dgisselq
+
784
+#include "diagnostic.h"
785
+// #include "integrate.h"
786
+
787
+// static int  zip_arg_partial_bytes(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
788
+// static      bool    zip_pass_by_reference(CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
789
+static bool    zip_return_in_memory(const_tree, const_tree);
790
+static bool    zip_frame_pointer_required(void);
791
+
792
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
793
+               const_tree type, bool named);
794
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
795
+
796
+static void    zip_asm_trampoline_template(FILE *);
797
+static void    zip_trampoline_init(rtx, tree, rtx);
798
+static void    zip_init_builtins(void);
799
+static tree zip_builtin_decl(unsigned, bool);
800
+// static void zip_asm_output_anchor(rtx x);
801
+       void    zip_asm_output_def(FILE *s, const char *n, const char *v);
802
+static rtx     zip_expand_builtin(tree exp, rtx target, rtx subtarget,
803
+                       enum machine_mode tmode, int    ignore);
804
+static bool    zip_scalar_mode_supported_p(enum machine_mode mode);
805
+static bool    zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
806
+static int     zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
807
+static bool    zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
808
+static unsigned HOST_WIDE_INT  zip_const_anchor = 0x20000;
809 122 dgisselq
+static          HOST_WIDE_INT  zip_min_opb_imm = -0x20000;
810
+static          HOST_WIDE_INT  zip_max_opb_imm =  0x1ffff;
811 102 dgisselq
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x20000;
812
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1ffff;
813
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
814
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
815
+static int     zip_sched_issue_rate(void) { return 1; }
816
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
817
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
818
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
819
+       void    zip_debug_rtx(const_rtx x);
820
+static void    zip_override_options(void);
821
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
822
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
823 111 dgisselq
+static rtx     zip_legitimize_address(rtx x, rtx oldx, machine_mode mode);
824 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void);
825 122 dgisselq
+#ifdef HAVE_cc0
826
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
827
+#error "We're not supposed to have CC0 anymore"
828
+#else
829
+static bool    zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b);
830
+#endif
831 102 dgisselq
+
832
+
833 103 dgisselq
+#define        ALL_DEBUG_OFF   false
834 102 dgisselq
+#define        ALL_DEBUG_ON    false
835
+
836
+enum ZIP_BUILTIN_ID_CODE {
837
+       ZIP_BUILTIN_RTU,
838
+       ZIP_BUILTIN_HALT,
839
+       ZIP_BUILTIN_IDLE,
840
+       ZIP_BUILTIN_SYSCALL,
841
+       ZIP_BUILTIN_SAVE_CONTEXT,
842
+       ZIP_BUILTIN_RESTORE_CONTEXT,
843
+       ZIP_BUILTIN_BITREV,
844
+       ZIP_BUILTIN_CC,
845 117 dgisselq
+       ZIP_BUILTIN_UCC,
846 102 dgisselq
+       ZIP_BUILTIN_MAX
847
+};
848
+
849
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
850
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
851
+
852
+
853
+#include "gt-zip.h"
854
+
855
+/* The Global 'targetm' Variable. */
856
+struct gcc_target      targetm = TARGET_INITIALIZER;
857
+
858
+
859
+enum   reg_class zip_reg_class(int);
860
+
861
+#define        LOSE_AND_RETURN(msgid, x)               \
862
+       do {                                    \
863
+               zip_operand_lossage(msgid, x);  \
864
+               return;                         \
865
+       } while(0)
866
+
867
+/* Per-function machine data. */
868
+struct GTY(()) machine_function
869
+{
870
+       /* number of pretented arguments for varargs */
871
+       int     pretend_size;
872
+
873
+       /* Number of bytes saved on the stack for local variables. */
874
+       int     local_vars_size;
875
+
876
+       /* Number of bytes saved on stack for register save area */
877
+       int     saved_reg_size;
878
+       int     save_ret;
879
+
880
+       int     sp_fp_offset;
881
+       bool    fp_needed;
882
+       int     size_for_adjusting_sp;
883
+};
884
+
885
+/* Allocate a chunk of memory for per-function machine-dependent data. */
886
+
887
+static struct machine_function *
888
+zip_init_machine_status(void) {
889
+       return ggc_cleared_alloc<machine_function>();
890
+}
891
+
892
+static void
893
+zip_override_options(void)
894
+{
895
+       init_machine_status = zip_init_machine_status;
896
+}
897
+
898
+enum   reg_class
899
+zip_reg_class(int regno)
900
+{
901
+       if (is_ZIP_GENERAL_REG(regno)) {
902
+               return GENERAL_REGS;
903
+       } else if (is_ZIP_REG(regno)) {
904
+               return ALL_REGS;
905
+       } return NO_REGS;
906
+}
907
+
908
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
909
+static bool
910
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
911
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
912
+       return (size == -1)||(size > UNITS_PER_WORD);
913
+}
914
+
915
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
916
+ * insn.  Formatted output isn't easily implemented, since we use output operand
917
+ * lossage to output the actual message and handle the categorization of the
918
+ * error.  */
919
+
920
+static void
921
+zip_operand_lossage(const char *msgid, rtx op) {
922
+       fprintf(stderr, "Operand lossage??\n");
923
+       debug_rtx(op);
924
+       zip_debug_rtx(op);
925
+       output_operand_lossage("%s", msgid);
926
+}
927
+
928
+/* The PRINT_OPERAND_ADDRESS worker.   */
929
+void
930
+zip_print_operand_address(FILE *file, rtx x) {
931
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
932
+
933
+       if (dbg) zip_debug_rtx(x);
934
+       switch(GET_CODE(x)) {
935
+               case REG:
936
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
937
+                       break;
938
+               case SYMBOL_REF:
939
+                       fprintf(file, "%s", XSTR(x,0));
940
+                       break;
941
+               case LABEL_REF:
942
+                       x = LABEL_REF_LABEL(x);
943
+               case CODE_LABEL:
944
+                       { char buf[256];
945
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
946
+#ifdef ASM_OUTPUT_LABEL_REF
947
+                       ASM_OUTPUT_LABEL_REF(file, buf);
948
+#else
949
+                       assemble_name(file, buf);
950
+#endif
951
+                       }
952
+                       break;
953
+               case PLUS:
954 111 dgisselq
+                       if (!REG_P(XEXP(x, 0))) {
955
+                               fprintf(stderr, "Unsupported address construct\n");
956
+                               zip_debug_rtx(x);
957 102 dgisselq
+                               abort();
958 111 dgisselq
+                       } if (CONST_INT_P(XEXP(x, 1))) {
959 102 dgisselq
+                               if (INTVAL(XEXP(x,1))!=0) {
960
+                                       fprintf(file, "%ld(%s)",
961
+                                       INTVAL(XEXP(x, 1)),
962
+                                       reg_names[REGNO(XEXP(x, 0))]);
963
+                               } else {
964
+                                       fprintf(file, "(%s)",
965
+                                       reg_names[REGNO(XEXP(x, 0))]);
966
+                               }
967
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
968
+                               fprintf(file, "%s(%s)", XSTR(x,0),
969
+                                       reg_names[REGNO(XEXP(x, 0))]);
970
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
971
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
972
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
973
+                               fprintf(file, "%s-%s(%s)",
974
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
975
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
976
+                                       reg_names[REGNO(XEXP(x, 0))]);
977
+                       } else
978
+                               fprintf(file, "#INVALID(%s)",
979
+                                       reg_names[REGNO(XEXP(x, 0))]);
980
+                       /*
981
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
982
+                               fprintf(file, "%s(%s)",
983
+                                       GET_CODE(XEXP(addr, 1)),
984
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
985
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
986
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
987
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
988
+                               fprintf(file, "%s-%s(%s)",
989
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
990
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
991
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
992
+                       }
993
+                       */
994
+                       break;
995
+               // We don't support direct memory addressing within our
996
+               // instruction set, even though the instructions themselves
997
+               // would support direct memory addressing of the lower 18 bits
998
+               // of memory space.
999
+               case MEM:
1000
+                       if (dbg) zip_debug_rtx(x);
1001
+                       zip_print_operand_address(file, XEXP(x, 0));
1002
+                       break;
1003 111 dgisselq
+               case CONST_INT:
1004
+                       fprintf(file, "%ld",INTVAL(x));
1005
+                       break;
1006 102 dgisselq
+               default:
1007 111 dgisselq
+                       fprintf(stderr, "Unknown address format\n");
1008
+                       zip_debug_rtx(x);
1009 102 dgisselq
+                       abort(); break;
1010
+                       // output_addr_const(file, x);
1011
+               break;
1012
+       }
1013
+}
1014
+
1015
+/* The PRINT_OPERAND worker. */
1016
+
1017
+void
1018
+zip_print_operand(FILE *file, rtx x, int code)
1019
+{
1020
+       rtx operand = x;
1021
+       int     rgoff = 0;
1022
+
1023
+       // fprintf(file, "Print Operand!\n");
1024
+
1025
+       /* New code entries should just be added to the switch below.  If
1026
+        * handling is finished, just return.  If handling was just a
1027
+        * modification of the operand, the modified operand should be put in
1028
+        * "operand", and then do a break to let default handling
1029
+        * (zero-modifier) output the operand.
1030
+        */
1031
+       switch(code) {
1032
+               case 0:
1033
+                       /* No code, print as usual. */
1034
+                       break;
1035
+               case 'L':
1036
+                       /* Lower of two registers, print one up */
1037
+                       rgoff = 1;
1038
+                       break;
1039
+               case 'R':
1040
+               case 'H':
1041
+                       /* Higher of a register pair, print normal */
1042
+                       break;
1043
+
1044
+               default:
1045
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
1046
+       }
1047
+
1048
+       /* Print an operand as without a modifier letter. */
1049
+       switch (GET_CODE(operand)) {
1050
+       case REG:
1051
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1052
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1053
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1054
+               return;
1055
+       case SCRATCH:
1056
+               LOSE_AND_RETURN("Need a scratch register", x);
1057
+               return;
1058
+
1059
+       case CODE_LABEL:
1060
+       case LABEL_REF:
1061
+       case SYMBOL_REF:
1062
+       case PLUS:
1063
+               PRINT_OPERAND_ADDRESS(file, operand);
1064
+               return;
1065
+       case MEM:
1066
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1067
+               return;
1068
+
1069
+       default:
1070
+               /* No need to handle all strange variants, let
1071
+                * output_addr_const do it for us.
1072
+                */
1073
+               if (CONSTANT_P(operand)) {
1074
+                       output_addr_const(file, operand);
1075
+                       return;
1076
+               }
1077
+
1078
+               LOSE_AND_RETURN("unexpected operand", x);
1079
+       }
1080
+}
1081
+
1082
+static bool
1083
+zip_frame_pointer_required(void)
1084
+{
1085
+       // This should really depend upon whether we have variable sized
1086
+       // arguments in our frame or not.  Once this fails, let's look
1087
+       // at what the problem was and then whether or not we can detect
1088
+       // it.
1089
+       //
1090
+       // Use a GCC global to determine our answer
1091 103 dgisselq
+       if (cfun->calls_alloca)
1092
+               return true;
1093 102 dgisselq
+       return (frame_pointer_needed);
1094
+/*
1095
+*/
1096
+}
1097
+
1098
+/* Determine whether or not a register needs to be saved on the stack or not.
1099
+ */
1100
+static bool
1101
+zip_save_reg(int regno) {
1102
+       if (regno == 0)
1103
+               return ((!crtl->is_leaf)
1104
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
1105
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
1106
+               return  ((df_regs_ever_live_p(regno))
1107
+                               &&(!call_used_regs[regno]));
1108
+       else if (regno == zip_FP)
1109
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
1110
+                               &&(!call_used_regs[regno])));
1111
+       else if (regno < zip_FP)
1112
+               return  ((df_regs_ever_live_p(regno))
1113
+                               &&(!call_used_regs[regno]));
1114
+       return false;
1115
+}
1116
+
1117
+/* Compute the size of the local area and the size to be adjusted by the
1118
+ * prologue and epilogue.
1119
+ *
1120
+ * Here's what we are looking at (top is the current, bottom is the last ...)
1121
+ *
1122
+ *     Stack Pointer ->
1123
+ *                     Local variables (could be variable size)
1124
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
1125
+ *                     Saved return address, if saved
1126
+ *                     Other Saved registers
1127
+ *                     Saved frame pointer (if used)
1128
+ *                     Saved R12, if used
1129
+ *                     (Stack pointer is not saved)
1130
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
1131
+ *                     Called arguments (not passed in registers)
1132
+ *                     Return arguments (not R1, args.pretend_args_size)
1133
+ *             (Prior function's stack frame ... )
1134
+ *
1135
+ */
1136
+static void
1137
+zip_compute_frame(void) {
1138
+       int     regno;
1139
+       int     args_size;
1140
+
1141
+       // gcc_assert(crtl);
1142
+       gcc_assert(cfun);
1143
+       gcc_assert(cfun->machine);
1144
+
1145
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
1146
+
1147
+       if(crtl->args.pretend_args_size > 0) {
1148
+               args_size += crtl->args.pretend_args_size;
1149
+               // printf("%s pretend_args_size : %d\n", current_function_name(),
1150
+                       // crtl->args.pretend_args_size);
1151
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
1152
+       }
1153
+
1154
+       cfun->machine->local_vars_size = get_frame_size();
1155
+
1156
+       // Save callee-saved registers.
1157
+       cfun->machine->saved_reg_size = 0;
1158
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1159
+               if (zip_save_reg(regno))
1160
+                       cfun->machine->saved_reg_size ++;
1161
+       }
1162
+
1163
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
1164
+
1165
+       if ((cfun->machine->fp_needed)&&
1166
+                       (!df_regs_ever_live_p(zip_FP))) {
1167
+               cfun->machine->saved_reg_size ++;
1168
+       }
1169
+
1170
+       cfun->machine->sp_fp_offset = args_size + cfun->machine->local_vars_size;
1171
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
1172
+                       + cfun->machine->saved_reg_size
1173
+                       + args_size;
1174
+
1175
+}
1176
+
1177
+void
1178
+zip_expand_prologue(void) {
1179
+       rtx     insn;
1180
+
1181
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1182
+       zip_compute_frame();
1183
+
1184 103 dgisselq
+       if (dbg)  fprintf(stderr, "Computing Prologue instructions\n");
1185 102 dgisselq
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1186
+               insn = emit_insn(gen_subsi3(stack_pointer_rtx,
1187
+                               stack_pointer_rtx,
1188
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
1189
+                               SImode)));
1190
+                       // cfun->machine->sp_fp_offset
1191
+
1192
+               RTX_FRAME_RELATED_P(insn) = 1;
1193
+       }
1194
+
1195
+       {
1196
+               int offset = 0, regno;
1197
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1198
+                       if (zip_save_reg(regno)) {
1199
+                               insn=emit_insn(gen_movsi_sto(
1200
+                                       gen_rtx_MEM(SImode, plus_constant(
1201
+                                               Pmode, stack_pointer_rtx,
1202
+                                               cfun->machine->sp_fp_offset
1203
+                                               +offset++, true)),
1204
+                                       gen_rtx_REG(SImode, regno)));
1205
+                               RTX_FRAME_RELATED_P(insn) = 1;
1206
+                       }
1207
+               }
1208 103 dgisselq
+               if (dbg)  fprintf(stderr, "%d registers saved%s\n", offset,
1209
+                       (crtl->saves_all_registers)?", should be all of them":", less than all");
1210 102 dgisselq
+       }
1211
+
1212
+       if (cfun->machine->fp_needed) {
1213
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
1214
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
1215
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
1216
+                               stack_pointer_rtx, gen_int_mode(
1217
+                                               cfun->machine->sp_fp_offset,
1218
+                                               SImode)));
1219
+               RTX_FRAME_RELATED_P(insn) = 1;
1220 103 dgisselq
+               if (dbg)  fprintf(stderr, "sp_fp_offset is %d\n", cfun->machine->sp_fp_offset);
1221 102 dgisselq
+       }
1222
+}
1223
+
1224
+bool
1225
+zip_use_return_insn(void)
1226
+{
1227
+       if ((!reload_completed)||(cfun->machine->fp_needed)
1228
+                       ||(get_frame_size()!=0)) {
1229
+               // If R0 ever gets pushed to the stack, then we cannot
1230
+               // use a master return from anywhere.  We need to clean up the
1231
+               // stack first.
1232
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
1233
+                                               &&(!call_used_regs[0]))) {
1234
+                       return false;
1235
+               }
1236
+       }
1237
+       zip_compute_frame();
1238
+       return (cfun->machine->size_for_adjusting_sp == 0);
1239
+}
1240
+
1241
+/* As per the notes in M68k.c, quote the function epilogue should not depend
1242
+ * upon the current stack pointer.  It should use the frame poitner only,
1243
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
1244
+ * take advantage of it to omit stack adjustments before returning ...
1245
+ *
1246
+ * Let's see if we can use their approach here.
1247
+ *
1248
+ * We can't.  Consider our choices:
1249
+ *     LOD (FP),R0
1250
+ *     LOD 1(FP),R4
1251
+ *     LOD 2(FP),R5
1252
+ *     LOD 3(FP),R6
1253
+ *     LOD 4(FP),FP
1254
+ *     ... Then what is the stack pointer?
1255
+ * or
1256
+ *     LOD (FP),R0
1257
+ *     LOD 1(FP),R4
1258
+ *     LOD 2(FP),R5
1259
+ *     LOD 3(FP),R6
1260
+ *     MOV FP,SP
1261
+ *     LOD 4(SP),FP
1262
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
1263
+ *     exploit our pipeline memory function
1264
+ * or
1265
+ *     MOV FP,SP
1266
+ *     LOD (SP),R0
1267
+ *     LOD 1(SP),R4
1268
+ *     LOD 2(SP),R5
1269
+ *     LOD 3(SP),R6
1270
+ *     LOD 4(SP),FP
1271
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
1272
+ *
1273
+ */
1274
+void
1275
+zip_expand_epilogue(void) {
1276
+       int     regno, offset;
1277
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1278
+
1279
+       zip_compute_frame();
1280
+
1281
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1282
+       if (cfun->machine->fp_needed) {
1283
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
1284
+               emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1285
+       }
1286
+
1287
+       if (cfun->machine->saved_reg_size != 0) {
1288
+               offset =  (cfun->machine->size_for_adjusting_sp -
1289
+                               cfun->machine->sp_fp_offset
1290
+                       - cfun->machine->saved_reg_size);
1291
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1292
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1293
+                       if (zip_save_reg(regno)) {
1294
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
1295
+                               emit_insn(gen_movsi_lod(
1296
+                                               gen_rtx_REG(SImode, regno),
1297
+                                       gen_rtx_MEM(SImode, plus_constant( SImode,
1298
+                                               stack_pointer_rtx, offset++, true))));
1299
+                       }
1300
+               }
1301
+       }
1302
+
1303
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1304
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
1305
+                               cfun->machine->size_for_adjusting_sp);
1306
+               emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
1307
+                       gen_int_mode(
1308
+                               cfun->machine->size_for_adjusting_sp
1309
+                               -cfun->machine->sp_fp_offset, SImode)));
1310
+       }
1311
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
1312
+
1313
+       emit_jump_insn(ret_rtx);
1314
+}
1315
+
1316
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1317
+ *
1318
+ * We currently only support calculating the return address for the current
1319
+ * frame.
1320
+ */
1321
+
1322
+/*
1323
+rtx
1324
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
1325
+{
1326
+       if (count)
1327
+               return NULL_RTX;
1328
+
1329
+       zip_compute_frame();
1330
+
1331
+       // saved return address for current function is at fp - 1
1332
+       if (cfun->machine->save_ret)
1333
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
1334
+                               -UNITS_PER_WORD));
1335
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
1336
+}
1337
+*/
1338
+
1339
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
1340
+ * return the OFFSET.
1341
+ */
1342
+int
1343
+zip_initial_elimination_offset(int from, int to) {
1344
+       int     ret = 0;
1345
+       zip_compute_frame();
1346
+
1347
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1348
+               ret = cfun->machine->sp_fp_offset;
1349 117 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
1350
+               ret = cfun->machine->sp_fp_offset;
1351 102 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1352 117 dgisselq
+               // ret = cfun->machine->local_vars_size;
1353
+               ret = 0;
1354 102 dgisselq
+       } else {
1355
+               abort();
1356
+       }
1357
+
1358
+       return ret;
1359
+}
1360
+
1361
+/*
1362
+ * Code taken from m68k ...
1363
+ */
1364
+static bool
1365
+zip_can_eliminate(int from, int to)
1366
+{
1367
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
1368
+       if ((from == zip_FP)&&(to == zip_SP))
1369
+               return !cfun->machine->fp_needed;
1370
+       return true;
1371
+}
1372
+
1373
+/*
1374
+static void
1375
+zip_basic_check(void)
1376
+{
1377
+       gcc_assert(mode_base_align[SImode]==4);
1378
+       if ((BITS_PER_UNIT != 32)
1379
+                       ||(GET_MODE_SIZE(SImode)!=1)
1380
+                       ||(GET_MODE_SIZE(DImode)!=1)
1381
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
1382
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
1383
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
1384
+               gcc_assert(BITS_PER_UNIT==32);
1385
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
1386
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
1387
+       }
1388
+}
1389
+*/
1390
+
1391
+#define        zip_basic_check()
1392
+
1393
+/* Compute the number of word sized regiters needed to hold a function
1394
+ * argument of mode INT_MODE and tree type TYPE.
1395
+ */
1396
+int
1397
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
1398
+       int     size;
1399
+
1400
+       zip_basic_check();
1401
+
1402
+       if (targetm.calls.must_pass_in_stack(mode, type))
1403
+               return 0;
1404
+
1405
+       if ((type)&&(mode == BLKmode))
1406
+               size = int_size_in_bytes(type);
1407
+       else
1408
+               size = GET_MODE_SIZE(mode);
1409
+
1410
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
1411
+}
1412
+
1413
+/* pushed in function prologue */
1414
+/*
1415
+static int
1416
+zip_arg_partial_bytes(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1417
+               tree type, bool name ATTRIBUTE_UNUSED) {
1418
+       int     words;
1419
+       unsigned int    regs = zip_num_arg_regs(mode, type);
1420
+
1421
+       if (*cum >= ZIP_LAST_ARG_REGNO + 1)
1422
+               words = 0;
1423
+       else if ((*cum + regs) > ZIP_LAST_ARG_REGNO + 1)
1424
+               words = (*cum + regs) - ZIP_LAST_ARG_REGNO + 1;
1425
+       else
1426
+               words = 0;
1427
+
1428
+       return words * UNITS_PER_WORD;
1429
+}
1430
+*/
1431
+
1432
+static void
1433
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
1434
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
1435
+       CUMULATIVE_ARGS *cum;
1436
+       int     nreg;
1437
+
1438
+       zip_basic_check();
1439
+
1440
+       cum = get_cumulative_args(ca);
1441
+       nreg = zip_num_arg_regs(mode, type);
1442
+       if (((*cum)+nreg) > NUM_ARG_REGS)
1443
+               (*cum) = NUM_ARG_REGS;
1444
+       else
1445
+               (*cum) += nreg;
1446
+}
1447
+
1448
+static rtx
1449
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
1450
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
1451
+       CUMULATIVE_ARGS *cum;
1452
+
1453
+       zip_basic_check();
1454
+
1455
+
1456
+       if (!named)
1457
+               return NULL_RTX;
1458
+       //if (targetm.calls.must_pass_in_stack(mode, type))
1459
+               //return NULL_RTX;
1460
+       cum = get_cumulative_args(ca);
1461
+
1462
+       if ((*cum) >= NUM_ARG_REGS)
1463
+               return NULL_RTX;
1464
+       return
1465
+               gen_rtx_REG(mode, (*cum)+1);
1466
+}
1467
+
1468 122 dgisselq
+#ifdef HAVE_cc0
1469 102 dgisselq
+/* NOTICE_UPDATE_CC sends us here
1470
+ */
1471
+void
1472
+zip_update_cc_notice(rtx exp, rtx_insn *insn)
1473
+{
1474 122 dgisselq
+#error "The CC0 code was supposed to be removed"
1475 102 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1476
+       enum    attr_ccresult  ccr;
1477
+       enum    attr_conditional  conditionally_executed;
1478
+
1479
+       // The default is that nothing has changed.
1480
+       // cc_status = cc_status_prev;
1481
+       rtx     src, dest;
1482
+
1483
+       if (dbg) fprintf(stderr, "CC-NOTICE ...\n");
1484
+       if (dbg) zip_debug_rtx_pfx("CC :", exp);
1485
+       if (dbg) debug_rtx(exp);
1486
+
1487
+       ccr = get_attr_ccresult(insn);
1488
+       if (ccr == CCRESULT_UNKNOWN) {
1489
+               CC_STATUS_INIT;
1490
+               if (dbg) fprintf(stderr, "\tINIT-CC\n");
1491
+               return;
1492
+       }
1493
+
1494
+       if ((GET_CODE(exp) == PARALLEL)&&(GET_CODE(XVECEXP(exp, 0, 0))==SET)) {
1495
+               // This works up and until we add cc0 parallel instructions
1496
+               // to our instruction set.
1497
+               dest = SET_DEST(XVECEXP(exp, 0, 0));
1498
+               src  = SET_SRC (XVECEXP(exp, 0, 0));
1499
+       } else if (GET_CODE(exp) == SET) {
1500
+               dest = SET_DEST(exp);
1501
+               src  = SET_SRC (exp);
1502
+       } else {
1503
+               // First, do nothing if we haven't touched the condition codes.
1504
+               // Condition codes can only be changed as a result of a set
1505
+               // expression ...?
1506
+               if (dbg) fprintf(stderr, "Non-set expression, doesn\'t touch condition codes\n");
1507
+               return;
1508
+       }
1509
+
1510 111 dgisselq
+
1511
+       if (ccr == CCRESULT_UNCHANGED) {
1512
+               if (dbg) fprintf(stderr, "\tUnchanged CC\n");
1513
+
1514
+               // We can't just run away here ... even though the CC result
1515
+               // hasn't changed, GCC's ability to recognize it as a valid
1516
+               // result has changed.  In other words, if we just 'set' a
1517
+               // value contained within either value1 or value2, then we'll
1518
+               // need to update those values so that they are no longer looked
1519
+               // upon as potentially containing the current CC values.
1520
+
1521
+               if (dest) {
1522
+                       if (dest == cc0_rtx)
1523
+                               CC_STATUS_INIT;
1524
+                       else if ((REG_P(dest))&&(dest != pc_rtx)) {
1525
+                               // An example here might be a load instruction
1526
+                               if (reg_mentioned_p(dest, cc_status.value1))
1527
+                                       cc_status.value1 = NULL_RTX;
1528
+                               if (reg_mentioned_p(dest, cc_status.value2))
1529
+                                       cc_status.value2 = NULL_RTX;
1530
+                       }
1531
+               }
1532
+               return;
1533
+       }
1534
+
1535 102 dgisselq
+       // Gotta wait on this test, until we know whether or not the
1536
+       // conditionally executed instruction was designed to set the
1537
+       // CC0 register.
1538
+       conditionally_executed = get_attr_conditional(insn);
1539
+       if ((conditionally_executed == CONDITIONAL_YES)&&(dest != cc0_rtx)) {
1540
+               // cc_status is unchanged
1541 111 dgisselq
+               // However, GCC's vision of it may have changed
1542
+               //
1543
+               // Initialize CC_STATUS
1544 102 dgisselq
+               if (dbg) fprintf(stderr, "\tCC -- unchanged (conditional exec)\n");
1545 111 dgisselq
+               CC_STATUS_INIT;
1546 102 dgisselq
+               return;
1547 111 dgisselq
+       } else if (GET_CODE(src)==IF_THEN_ELSE) {
1548
+               // Same thing as above
1549
+               CC_STATUS_INIT;
1550
+               return;
1551 102 dgisselq
+       }
1552
+
1553
+       if (ccr == CCRESULT_VALIDZN)
1554
+               cc_status.flags = CC_NO_OVERFLOW;
1555
+       else
1556
+               cc_status.flags = 0;
1557
+       cc_status.value1 = dest;
1558
+       if (dest == cc0_rtx)
1559
+               cc_status.value2 = src;
1560
+       else if((REG_P(dest))&&(!reg_mentioned_p(dest, src)))
1561
+               cc_status.value2 = src;
1562
+       else if((SUBREG_P(dest))&&(!reg_mentioned_p(XEXP(dest,0), src)))
1563
+               cc_status.value2 = src;
1564
+       else
1565
+               cc_status.value2 = 0;
1566
+       if (dbg) fprintf(stderr, "\tCC -- Set flags for\n");
1567
+       if (dbg) zip_debug_rtx_pfx("V1: ", dest);
1568
+       if ((dbg)&&(cc_status.value2)) zip_debug_rtx_pfx("V2: ", src);
1569
+       else if (dbg)   fprintf(stderr, "V2: (No SRC)\n");
1570
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "src refers to dest ?? %s\n",
1571
+               refers_to_regno_p(REGNO(dest),REGNO(dest),src,NULL)?"Yes":"No");
1572
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "Occurrs %d times\n",
1573
+               count_occurrences(dest,src,0));
1574
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s mentioned\n",
1575
+               reg_mentioned_p(dest,src)?"Is":"Is not");
1576
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s referenced\n",
1577
+               reg_referenced_p(dest,src)?"Is":"Is not");
1578
+
1579
+//
1580
+// These results are only used in final.c, where they are used to remove
1581
+// compare instructions if the optimizer is on.  If I produce nothing, no
1582
+// compare instructions will be removed.  If I produce something, a smart
1583
+// decision may be made to remove compare instructions.
1584
+//
1585
+// cc_status will be compared  with subsequent
1586
+//     (set (cc0) (something)) (i.e. compare only) instructions
1587
+//
1588
+//     (set (cc0) (compare (x) (y)))
1589
+//     dst = cc0 -- the destination of the set is ignored, save that it must be
1590
+//             cc0
1591
+//     src1 = (compare (x) (y))
1592
+//     if (src1 == compare)&&(y == (const_int 0))
1593
+//             src2 = (x)
1594
+//     else
1595
+//             src2 = null
1596
+//
1597
+//     Four conditions:
1598
+//     1. if (val1)&&(src1 == val1)
1599
+//             This would be true if I had seen a (set (val1) (src1)) insn
1600
+//             If I have seen a (set (val1) (src1))
1601
+//                     or equivalently a (set (val1) (compare (x) (y)))
1602
+//     or
1603
+//     2. if (val2)&&(src1 == val2)
1604
+//             This would be true if I had seen a (set (val1) (src1)) insn,
1605
+//             and only if val2 was still valid.
1606
+//     or
1607
+//     3. if (src2)&&(value1)&&(src2 == value1)
1608
+//             This would be true if we are comparing against zero, and the
1609
+//             number we are comparing against zero is value 1
1610
+//     or
1611
+//     4. if (src2)&&(value2)&&(src2 == value2)
1612
+//             ... or value2.  This is the common ZipCPU case.
1613
+//
1614
+//             then delete the compare.
1615
+//
1616
+}
1617 122 dgisselq
+#else
1618 102 dgisselq
+
1619 122 dgisselq
+void   zip_canonicalize_comparison(int *code, rtx *op0, rtx *op1,
1620
+               bool preserve_op0)
1621
+{
1622
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1623 102 dgisselq
+
1624 122 dgisselq
+       if (dbg) fprintf(stderr, "CANONICALIZE ...%s\n", (preserve_op0)?"(Preserve Op0)":"");
1625
+       if (dbg) zip_debug_rtx_pfx("CODE", gen_rtx_fmt_ee((rtx_code)*code, VOIDmode, gen_rtx_REG(CCmode,zip_CC), const0_rtx));
1626
+       if (dbg) zip_debug_rtx_pfx("OP0 ", *op0);
1627
+       if (dbg) zip_debug_rtx_pfx("OP1 ", *op1);
1628
+
1629
+       if ((!preserve_op0)&&((*code == LE)||(*code == GTU)||(*code == GEU))) {
1630
+               rtx tem = *op0;
1631
+               *op0 = *op1;
1632
+               *op1 = tem;
1633
+               *code = (int)swap_condition((enum rtx_code)*code);
1634
+       }
1635
+
1636
+       if ((*code == LE)||(*code == LEU)||(*code == GTU)) {
1637
+               int offset = 1; // (*code == GTU) ? 1 : -1;
1638
+               bool    swap = false;
1639
+
1640
+               if (CONST_INT_P(*op1)) {
1641
+                       *op1 = GEN_INT(INTVAL(*op1)+offset);
1642
+                       swap = true;
1643
+               } else if (REG_P(*op1)) {
1644
+                       *op1 = plus_constant(SImode, *op1, offset, true);
1645
+                       swap = true;
1646
+               } else if ((GET_CODE(*op1)==PLUS)&&(CONST_INT_P(XEXP(*op1,1)))){
1647
+                       *op1 = plus_constant(GET_MODE(*op1),XEXP(*op1,0),
1648
+                               INTVAL(XEXP(*op1,1))+offset);
1649
+                       swap = true;
1650
+               } if (swap) {
1651
+                       if (*code == LE)
1652
+                               (*code)= LT;
1653
+                       else if (*code == LEU)
1654
+                               (*code)= LTU;
1655
+                       else // (*code == GTU)
1656
+                               (*code) = GEU;
1657
+               }
1658
+       }
1659
+}
1660
+
1661
+static bool
1662
+zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b) {
1663
+       *a = zip_CC;
1664
+       *b = INVALID_REGNUM;
1665
+       return true;
1666
+}
1667
+
1668
+#endif
1669
+
1670
+
1671 102 dgisselq
+/* totally buggy - we can't return pointers to nested functions */
1672
+static void
1673
+zip_asm_trampoline_template(FILE *f) {
1674
+       // Whereas at one time I thought I wouldn't need it, now I know I
1675
+       // need this trampoline function, although it is for a completely
1676
+       // different purpose than the one I was familiar with.
1677
+       fprintf(f, "\tldihi 0,r1\n");
1678
+       fprintf(f, "\tldilo 0,r1\n");
1679
+       fprintf(f, "\tjmp r1\n");
1680
+}
1681
+
1682
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
1683
+static void
1684
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
1685
+       tree fndecl ATTRIBUTE_UNUSED,
1686
+       rtx chain_value ATTRIBUTE_UNUSED) {
1687
+// #warning "This needs to be filled out"
1688
+       abort();
1689
+}
1690
+
1691
+static tree
1692
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
1693
+       tree type)
1694
+{
1695
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
1696
+       zip_basic_check();
1697
+
1698
+       if(t) {
1699
+               zip_builtins[code] = t;
1700
+               zip_builtins_icode[code] = icode;
1701
+       }
1702
+
1703
+       return t;
1704
+
1705
+}
1706
+
1707
+void   zip_init_builtins(void) {
1708
+       zip_basic_check();
1709
+
1710
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
1711
+#ifdef HAVE_zip_rtu
1712
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
1713
+#endif
1714
+#ifdef HAVE_zip_halt
1715
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
1716
+#endif
1717
+#ifdef HAVE_zip_idle
1718
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
1719
+#endif
1720
+
1721
+#ifdef HAVE_zip_syscall
1722
+// Support int SYSCALL(callID, int a, int b, int c);
1723
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
1724
+                       build_function_type_list(void_type_node, NULL_TREE));
1725
+#endif
1726
+
1727
+#ifdef HAVE_zip_save_context
1728
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
1729
+               build_function_type_list(void_type_node, ptr_type_node, 0));
1730
+#endif
1731
+
1732
+#ifdef HAVE_zip_restore_context
1733
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
1734
+       build_function_type_list(void_type_node, ptr_type_node, 0));
1735
+#endif
1736
+
1737
+#ifdef HAVE_zip_bitrev
1738
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
1739
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
1740
+               NULL_TREE));
1741
+#endif
1742
+
1743
+#ifdef HAVE_zip_cc
1744
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
1745
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1746
+#endif
1747
+
1748 117 dgisselq
+#ifdef HAVE_zip_ucc
1749
+  def_builtin("zip_ucc", CODE_FOR_zip_ucc, ZIP_BUILTIN_UCC,
1750
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1751
+#endif
1752
+
1753 102 dgisselq
+}
1754
+
1755
+static tree
1756
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
1757
+{
1758
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
1759
+    return error_mark_node;
1760
+
1761
+  return zip_builtins[zip_builtin_code];
1762
+}
1763
+
1764
+static rtx
1765
+zip_expand_builtin(tree exp, rtx target,
1766
+               rtx subtarget ATTRIBUTE_UNUSED,
1767
+               machine_mode tmode ATTRIBUTE_UNUSED,
1768
+               int     ignore ATTRIBUTE_UNUSED) {
1769
+
1770
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
1771
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
1772
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
1773
+       enum    insn_code icode = zip_builtins_icode[code];
1774
+       rtx     pat, op[5];
1775
+       call_expr_arg_iterator  iter;
1776
+       tree    arg;
1777
+
1778
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
1779
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
1780
+               arg = first_call_expr_arg(exp, &iter);
1781
+               if (arg == error_mark_node)
1782
+                       return NULL_RTX;
1783
+               op[0] = expand_normal(arg);
1784
+               if (GET_CODE(op[0]) != REG)
1785
+                       op[0] = force_reg(Pmode, op[0]);
1786
+               pat = GEN_FCN(icode)(op[0]);
1787
+       } else if (code == ZIP_BUILTIN_BITREV) {
1788
+               arg = first_call_expr_arg(exp, &iter);
1789
+               if (arg == error_mark_node) {
1790
+                       return NULL_RTX;
1791
+               }
1792
+               op[0] = expand_normal(arg);
1793
+               if (!target)
1794
+                       target = gen_reg_rtx(SImode);
1795
+               pat = GEN_FCN(icode)(target, op[0]);
1796 117 dgisselq
+       } else if ((code == ZIP_BUILTIN_CC)||(code == ZIP_BUILTIN_UCC)) {
1797 102 dgisselq
+               if (!target)
1798
+                       target = gen_reg_rtx(SImode);
1799
+               pat = GEN_FCN(icode)(target);
1800
+       } else // RTU, HALT, IDLE
1801
+               pat = GEN_FCN(icode)();
1802
+       if (!pat)
1803
+               return NULL_RTX;
1804
+       emit_insn(pat);
1805
+       return (nonvoid ? target : const0_rtx);
1806
+}
1807
+
1808
+static bool
1809
+zip_scalar_mode_supported_p(enum machine_mode mode) {
1810
+       zip_basic_check();
1811
+
1812
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
1813
+}
1814
+
1815
+static bool
1816
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
1817
+       return ((mode)==SFmode)||((mode)==DFmode);
1818
+}
1819
+
1820
+static int
1821
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
1822
+       enum machine_mode mode ATTRIBUTE_UNUSED,
1823
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
1824
+       return 1;
1825
+}
1826
+
1827
+static bool
1828
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
1829
+       addr_space_t as ATTRIBUTE_UNUSED) {
1830
+       return false;
1831
+}
1832
+
1833
+/*
1834
+static void
1835
+zip_asm_output_anchor(rtx x) {
1836
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
1837
+}
1838
+*/
1839
+
1840
+static void
1841
+zip_debug_print(const char *pfx, int lvl, const char *str) {
1842
+       int     i;
1843
+       i = lvl;
1844
+       if ((true)||(lvl == 0))
1845
+               fprintf(stderr, "%s", pfx);
1846
+       else
1847
+               i += strlen(pfx);
1848
+       while(i-->0)
1849
+               fprintf(stderr, "  ");
1850
+       fprintf(stderr, "%s\n", str);
1851
+}
1852
+
1853
+static void
1854
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
1855
+       int     i;
1856
+
1857
+       i = lvl;
1858
+       if ((true)||(lvl == 0))
1859
+               fprintf(stderr, "%s", pfx);
1860
+       else
1861
+               i = lvl+strlen(pfx);
1862
+       while(i-->0)
1863
+               fprintf(stderr, "  ");
1864
+       switch(m) {
1865
+               case VOIDmode:
1866
+                       fprintf(stderr, "%s:V\n", str);
1867
+                       break;
1868
+               case BLKmode:
1869
+                       fprintf(stderr, "%s:BLK\n", str);
1870
+                       break;
1871
+               case BImode:
1872
+                       fprintf(stderr, "%s:BI\n", str);
1873
+                       break;
1874
+#ifdef HAVE_QImode
1875
+               case QImode:
1876
+                       fprintf(stderr, "%s:QI\n", str);
1877
+                       break;
1878
+#endif
1879
+#ifdef HAVE_HImode
1880
+               case HImode:
1881
+                       fprintf(stderr, "%s:HI\n", str);
1882
+                       break;
1883
+#endif
1884
+               case SImode:
1885
+                       fprintf(stderr, "%s:SI\n", str);
1886
+                       break;
1887 122 dgisselq
+               case CCmode:
1888
+                       fprintf(stderr, "%s:CC\n", str);
1889
+                       break;
1890 102 dgisselq
+               case DImode:
1891
+                       fprintf(stderr, "%s:DI\n", str);
1892
+                       break;
1893
+               default:
1894
+                       fprintf(stderr, "%s:?\n", str);
1895
+       }
1896
+}
1897
+
1898
+static void
1899
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
1900
+       if (x == NULL_RTX) {
1901
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
1902
+               return;
1903
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
1904
+               char    buf[64];
1905
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
1906
+               zip_debug_print(pfx, lvl, buf);
1907 117 dgisselq
+               gcc_assert(0 && "Bad RTX Code");
1908 102 dgisselq
+               return;
1909
+       } switch(GET_CODE(x)) { // rtl.def
1910 122 dgisselq
+       case PARALLEL:
1911
+               zip_debug_print(pfx, lvl, "(PARALLEL");
1912
+               for(int j=0; j<XVECLEN(x,0);j++)
1913
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1914
+               zip_debug_print(pfx, lvl, ")");
1915
+               debug_rtx(x);
1916
+               break;
1917 102 dgisselq
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
1918 122 dgisselq
+       case SEQUENCE:
1919
+               zip_debug_print(pfx, lvl, "(SEQUENCE");
1920
+               for(int j=0; j<XVECLEN(x,0);j++)
1921
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1922
+               zip_debug_print(pfx, lvl, ")");
1923
+               debug_rtx(x);
1924
+               break;
1925 102 dgisselq
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
1926
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
1927
+       case INSN:
1928
+               zip_debug_print(pfx, lvl, "(INSN");
1929
+               /*
1930
+               { const rtx_insn *tmp_rtx;
1931
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
1932
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
1933
+               }}
1934
+               */
1935
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1936
+               zip_debug_print(pfx, lvl, ")");
1937 117 dgisselq
+               debug_rtx(x);
1938 102 dgisselq
+               break;
1939
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
1940 111 dgisselq
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1941
+               zip_debug_print(pfx, lvl, ")");
1942
+               /*
1943 102 dgisselq
+               if (JUMP_LABEL(x)) {
1944 111 dgisselq
+                       if (GET_CODE(JUMP_LABEL(x)) == LABEL_REF) {
1945
+                               char    buf[64];
1946
+                               sprintf(buf, "(LABEL *.L%d))", CODE_LABEL_NUMBER(LABEL_REF_LABEL(JUMP_LABEL(x))));
1947
+                               zip_debug_print(pfx, lvl+1, buf);
1948
+                       } else if (GET_CODE(JUMP_LABEL(x))==CODE_LABEL) {
1949
+                               char    buf[64];
1950
+                               sprintf(buf, "(CODE_LABEL *.L%d))", CODE_LABEL_NUMBER(JUMP_LABEL(x)));
1951
+                               zip_debug_print(pfx, lvl+1, buf);
1952
+                       } else
1953
+                       zip_debug_print(pfx, lvl+1, "(w/Label))");
1954 102 dgisselq
+               } else
1955 111 dgisselq
+                       zip_debug_print(pfx, lvl+1, "(NO label))");
1956
+               debug_rtx(x);
1957
+               */
1958 102 dgisselq
+               break;
1959
+       case CALL:
1960
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
1961
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
1962
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
1963
+               zip_debug_print(pfx, lvl, ")");
1964
+               break;
1965
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
1966
+               debug_rtx(x);
1967
+               break;
1968
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
1969
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
1970
+       case NOTE:
1971
+               {       char buf[128];
1972
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
1973
+                       zip_debug_print(pfx, lvl, buf);
1974
+               }break;
1975
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
1976
+               debug_rtx(x);
1977
+               break;
1978
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
1979
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
1980
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
1981
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
1982
+       case CODE_LABEL:
1983
+               {
1984
+                       char    buf[64];
1985 111 dgisselq
+                       sprintf(buf, "(CODE_LABEL *.L%d)", CODE_LABEL_NUMBER(x));
1986 102 dgisselq
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
1987
+               } break;
1988
+       case SET:
1989
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
1990 117 dgisselq
+               zip_debug_rtx_1(pfx, SET_DEST(x),lvl+1);
1991
+               zip_debug_rtx_1(pfx, SET_SRC(x),lvl+1);
1992 102 dgisselq
+               zip_debug_print(pfx, lvl, ")");
1993 117 dgisselq
+               debug_rtx(x);
1994 102 dgisselq
+               break;
1995 122 dgisselq
+       case REG: {
1996
+               char buf[25];
1997 102 dgisselq
+               if (REGNO(x) == zip_PC)
1998 122 dgisselq
+                       sprintf(buf, "(PC)");
1999 102 dgisselq
+               else if (REGNO(x) == zip_CC)
2000 122 dgisselq
+                       sprintf(buf, "(CC)");
2001 102 dgisselq
+               else if (REGNO(x) == zip_SP)
2002 122 dgisselq
+                       sprintf(buf, "(SP)");
2003 102 dgisselq
+               else if (REGNO(x) == zip_FP)
2004 122 dgisselq
+                       sprintf(buf, "(REG FP)");
2005 102 dgisselq
+               else if (REGNO(x) == zip_GOT)
2006 122 dgisselq
+                       sprintf(buf, "(REG GBL)");
2007 102 dgisselq
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
2008 122 dgisselq
+                       sprintf(buf, "(REG RTN-VL)");
2009 102 dgisselq
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
2010 122 dgisselq
+                       sprintf(buf, "(REG RTN-AD)");
2011
+               else
2012
+                       sprintf(buf, "(REG %d)", REGNO(x));
2013 102 dgisselq
+               zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2014
+               } break;
2015
+       case IF_THEN_ELSE: // 51
2016
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
2017
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2018
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2019
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
2020
+               zip_debug_print(pfx, lvl, ")");
2021
+               break;
2022
+       case PC:
2023
+               zip_debug_print(pfx, lvl, "(PC)");
2024
+               break;
2025
+       case CC0:
2026
+               zip_debug_print(pfx, lvl, "(CC0)");
2027
+               break;
2028
+       case COMPARE:
2029
+               zip_debug_print(pfx, lvl, "(COMPARE");
2030
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2031
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2032
+               zip_debug_print(pfx, lvl, ")");
2033
+               break;
2034 111 dgisselq
+       case CONST:
2035
+               zip_debug_print_m(pfx, lvl, "(CONST", GET_MODE(x));
2036
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2037
+               zip_debug_print(pfx, lvl, ")");
2038
+               break;
2039 102 dgisselq
+       case CONST_INT:
2040
+               { char buf[25];
2041
+               if (GET_MODE(x)==SImode)
2042 111 dgisselq
+                       sprintf(buf, "(CONST_INT:SI %ld)", INTVAL(x));
2043 102 dgisselq
+               else if (GET_MODE(x)==VOIDmode)
2044 111 dgisselq
+                       sprintf(buf, "(CONST_INT:V %ld)", INTVAL(x));
2045 102 dgisselq
+               else
2046 111 dgisselq
+                       sprintf(buf, "(CONST_INT:? %ld)", INTVAL(x));
2047 102 dgisselq
+               zip_debug_print(pfx, lvl, buf);
2048
+               } break;
2049
+       case LABEL_REF:
2050 122 dgisselq
+               { char buf[256];
2051 111 dgisselq
+               sprintf(buf, "(LABEL *.L%d)", CODE_LABEL_NUMBER(LABEL_REF_LABEL(x)));
2052
+               zip_debug_print(pfx, lvl, buf);
2053
+               }
2054 102 dgisselq
+               break;
2055
+       case SYMBOL_REF:
2056
+               {
2057
+                       char buf[64];
2058
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
2059
+                       // fprintf(file, "%s", XSTR(x,0));
2060
+                       zip_debug_print(pfx, lvl, buf);
2061
+               }
2062
+               break;
2063
+       case MEM:
2064
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
2065
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2066
+               zip_debug_print(pfx, lvl, ")");
2067
+               break;
2068
+       /*
2069
+       case VALUE:
2070
+               {
2071
+                       char buf[64];
2072
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
2073
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
2074
+               }
2075
+               break;
2076
+       */
2077
+       case PLUS:
2078
+               zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
2079
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2080
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2081
+               zip_debug_print(pfx, lvl, ")");
2082
+               break;
2083
+       case MINUS:
2084
+               zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
2085
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2086
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2087
+               zip_debug_print(pfx, lvl, ")");
2088
+               break;
2089
+       case AND:
2090
+               zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
2091
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2092
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2093
+               zip_debug_print(pfx, lvl, ")");
2094
+               break;
2095
+       case IOR:
2096
+               zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
2097
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2098
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2099
+               zip_debug_print(pfx, lvl, ")");
2100
+               break;
2101
+       case XOR:
2102
+               zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
2103
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2104
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2105
+               zip_debug_print(pfx, lvl, ")");
2106
+               break;
2107
+       case MULT:
2108
+               zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
2109
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2110
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2111
+               zip_debug_print(pfx, lvl, ")");
2112
+               break;
2113
+       case EQ:        //
2114
+               zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
2115
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2116
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2117
+               zip_debug_print(pfx, lvl, ")");
2118
+               break;
2119
+       case NE:        //
2120
+               zip_debug_print_m(pfx, lvl, "(NE", GET_MODE(x));
2121
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2122
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2123
+               zip_debug_print(pfx, lvl, ")");
2124
+               break;
2125
+       case GE:        //
2126
+               zip_debug_print_m(pfx, lvl, "(GE", GET_MODE(x));
2127
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2128
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2129
+               zip_debug_print(pfx, lvl, ")");
2130
+               break;
2131
+       case GT:        //
2132
+               zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
2133
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2134
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2135
+               zip_debug_print(pfx, lvl, ")");
2136
+               break;
2137
+       case LE:        //
2138
+               zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
2139
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2140
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2141
+               zip_debug_print(pfx, lvl, ")");
2142
+               break;
2143
+       case LT:        //
2144
+               zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
2145
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2146
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2147
+               zip_debug_print(pfx, lvl, ")");
2148
+               break;
2149
+       case GEU:       //
2150
+               zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
2151
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2152
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2153
+               zip_debug_print(pfx, lvl, ")");
2154
+               break;
2155
+       case GTU:       //
2156
+               zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
2157
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2158
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2159
+               zip_debug_print(pfx, lvl, ")");
2160
+               break;
2161
+       case LEU:       //
2162
+               zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
2163
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2164
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2165
+               zip_debug_print(pfx, lvl, ")");
2166
+               break;
2167
+       case LTU:       //
2168
+               zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
2169
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2170
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2171
+               zip_debug_print(pfx, lvl, ")");
2172
+               break;
2173
+       case SCRATCH:   //
2174
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
2175
+               break;
2176
+       case SUBREG:
2177
+               { char buf[25];
2178 111 dgisselq
+               if (REG_P(XEXP(x,0))) {
2179
+                       sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
2180
+                               SUBREG_BYTE(x));
2181
+                       zip_debug_print(pfx, lvl, buf);
2182
+               } else if (MEM_P(XEXP(x,0))) {
2183
+                       sprintf(buf, "(SUBREG /%d", SUBREG_BYTE(x));
2184
+                       zip_debug_print(pfx, lvl, buf);
2185
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2186
+                       zip_debug_print(pfx, lvl, ")");
2187
+               } else {
2188
+                       sprintf(buf, "(SUBREG UNK /%d", SUBREG_BYTE(x));
2189
+                       zip_debug_print(pfx, lvl, buf);
2190
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2191
+                       zip_debug_print(pfx, lvl, ")");
2192
+               }}
2193
+               break;
2194 102 dgisselq
+       default:
2195 111 dgisselq
+               { char buf[128];
2196 102 dgisselq
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
2197
+               zip_debug_print(pfx, lvl, buf);
2198
+               debug_rtx(x);
2199
+               } break;
2200
+       }
2201
+}
2202
+
2203
+void
2204
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
2205
+       zip_debug_rtx_1(pfx, x, 0);
2206
+}
2207
+
2208
+void
2209
+zip_debug_rtx(const_rtx x) {
2210
+       zip_debug_rtx_pfx("", x);
2211
+}
2212
+
2213
+void
2214
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
2215
+}
2216
+
2217
+void
2218
+zip_debug_bb(basic_block bb) {
2219
+       rtx_insn        *insn;
2220
+
2221
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
2222
+       FOR_BB_INSNS(bb, insn)
2223
+       {
2224
+               zip_debug_rtx(insn);
2225
+       }
2226
+}
2227
+
2228
+
2229
+static bool
2230 122 dgisselq
+zip_legitimate_opb(rtx x, bool strict)
2231 102 dgisselq
+{
2232 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2233 102 dgisselq
+
2234 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB\n");
2235 102 dgisselq
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
2236
+
2237
+       if (NULL_RTX == x)
2238
+               return false;
2239 122 dgisselq
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
2240
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> Mode failure\n");
2241 102 dgisselq
+               return false;
2242 122 dgisselq
+       } else if ((strict)&&(REG_P(x))) {
2243
+               if (REGNO(x)<zip_CC) {
2244
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2245
+                       return true;
2246
+               } else return false;
2247
+       } else if (register_operand(x, GET_MODE(x))) {
2248
+               // This also handles subregs
2249
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2250
+               return true;
2251 111 dgisselq
+       } else if ((CONST_INT_P(x))
2252
+               &&(INTVAL(x) >= zip_min_opb_imm)
2253
+               &&(INTVAL(x) <= zip_max_opb_imm)) {
2254 122 dgisselq
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (Const) %ld <= %ld <= %ld\n", zip_min_opb_imm, INTVAL(x), zip_max_opb_imm);
2255 111 dgisselq
+               return true;
2256 122 dgisselq
+       // } else if ((GET_CODE(x) == LABEL_REF)||(GET_CODE(x)==CODE_LABEL)) {
2257
+               // return true;
2258 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2259
+               // Is it a valid register?
2260 122 dgisselq
+               if ((!strict)&&(!register_operand((rtx)XEXP((rtx)x,0), GET_MODE(x)))) {
2261 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (No reg in +%s)\n",
2262 102 dgisselq
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2263
+                       return false;
2264 122 dgisselq
+               } else if ((strict)&&((!REG_P(XEXP(x,0)))||(REGNO(XEXP(x,0))>=zip_CC))) {
2265 102 dgisselq
+                       return false;
2266
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2267
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
2268
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
2269 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (reg+int)\n");
2270 103 dgisselq
+                       // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
2271
+                               // gcc_unreachable();
2272 102 dgisselq
+                       return true;
2273
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
2274 122 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == CODE_LABEL)
2275 102 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
2276
+                       // While we can technically support this, the problem
2277
+                       // is that the symbol address could be anywhere, and we
2278
+                       // have no way of recovering if it's outside of our
2279
+                       // 14 allowable bits.
2280 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No. (reg+lbl)\n");
2281 102 dgisselq
+                       return false;
2282
+               }
2283
+       }
2284
+
2285 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No\n");
2286 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2287
+       return false;
2288
+}
2289
+
2290
+static bool
2291
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
2292
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2293
+
2294
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
2295
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
2296
+
2297 122 dgisselq
+       if (!zip_legitimate_opb(x, strict))
2298 102 dgisselq
+               return false;
2299 122 dgisselq
+       else if ((GET_CODE(x)==PLUS)&&(CONST_INT_P(XEXP(x,1)))) {
2300
+               if ((INTVAL(XEXP(x, 1)) > zip_max_mov_offset)
2301
+                       ||(INTVAL(XEXP(x, 1)) < zip_min_mov_offset)) {
2302
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> NO! (reg+int), int out of bounds: %d\n", INTVAL(XEXP(x,1)));
2303 102 dgisselq
+                       return false;
2304
+               }
2305
+       }
2306
+
2307 122 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> Yes\n");
2308 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2309 122 dgisselq
+       return true;
2310 102 dgisselq
+}
2311
+
2312
+int
2313
+zip_pd_mov_operand(rtx op)
2314
+{
2315
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2316
+
2317
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
2318
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
2319
+}
2320
+
2321
+int
2322 111 dgisselq
+zip_pd_mvimm_operand(rtx op)
2323
+{
2324
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2325
+
2326
+       if (dbg) fprintf(stderr, "ZIP-VALID-MVIMM(predicate) for OPERAND\n");
2327
+       if (!CONST_INT_P(op))
2328
+               return false;
2329
+       if (INTVAL(op) > zip_max_mov_offset)
2330
+               return false;
2331
+       if (INTVAL(op) < zip_min_mov_offset)
2332
+               return false;
2333
+       return true;
2334
+}
2335
+
2336
+int
2337
+zip_pd_imm_operand(rtx op)
2338
+{
2339
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2340
+
2341
+       if (dbg) fprintf(stderr, "ZIP-VALID-IMM(predicate) for OPERAND\n");
2342
+       if (!CONST_INT_P(op))
2343
+               return false;
2344
+       if (INTVAL(op) > zip_max_anchor_offset)
2345
+               return false;
2346
+       if (INTVAL(op) < zip_min_anchor_offset)
2347
+               return false;
2348
+       return true;
2349
+}
2350
+
2351
+int
2352 102 dgisselq
+zip_address_operand(rtx op)
2353
+{
2354
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2355
+
2356
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
2357 111 dgisselq
+       if ((REG_P(op))&&(REGNO(op)==zip_CC))
2358
+               return false;
2359
+       else if ((GET_CODE(op) == PLUS)&&(REG_P(XEXP(op,0)))
2360
+                       &&(REGNO(XEXP(op,0))==zip_CC))
2361
+               return false;
2362
+       else
2363
+               return zip_legitimate_opb(op, !can_create_pseudo_p());
2364 102 dgisselq
+}
2365
+
2366
+int
2367 111 dgisselq
+zip_pd_opb_operand(rtx op)
2368 102 dgisselq
+{
2369
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2370
+
2371 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-OPB(predicate) for OPERAND\n");
2372 122 dgisselq
+       return zip_legitimate_opb(op, false); //, !can_create_pseudo_p());
2373 102 dgisselq
+}
2374
+
2375
+int
2376
+zip_ct_address_operand(rtx op)
2377
+{
2378
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2379
+
2380
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
2381 111 dgisselq
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2382 102 dgisselq
+}
2383
+
2384
+int
2385
+zip_const_address_operand(rtx x) {
2386
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2387
+
2388
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
2389
+       if (dbg) zip_debug_rtx(x);
2390
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode))
2391
+               return false;
2392
+       if ((GET_CODE(x) == LABEL_REF)
2393
+                       ||(GET_CODE(x) == CODE_LABEL)
2394
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
2395
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2396
+               return true;
2397
+       } else if (CONST_INT_P(x)) {
2398
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES!\n");
2399
+               return true;
2400
+       } else if (GET_CODE(x) == PLUS) {
2401
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
2402
+               return ((zip_const_address_operand(XEXP(x,0)))
2403
+                       &&(CONST_INT_P(XEXP(x,1))));
2404
+       } else if (GET_CODE(x) == MINUS) {
2405
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
2406
+               return ((zip_const_address_operand(XEXP(x,0)))
2407
+                       &&(zip_const_address_operand(XEXP(x,1))));
2408
+       }
2409
+
2410
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
2411
+       if (dbg) zip_debug_rtx(x);
2412
+       return false;
2413
+}
2414
+
2415
+int
2416
+zip_ct_const_address_operand(rtx x) {
2417
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2418
+
2419
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
2420
+       return zip_const_address_operand(x);
2421
+}
2422
+
2423
+int
2424
+zip_pd_const_address_operand(rtx x) {
2425
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2426
+
2427
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
2428
+       return zip_const_address_operand(x);
2429
+}
2430
+
2431
+
2432
+static bool
2433
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
2434
+{
2435
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2436
+
2437
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
2438
+       if (dbg) zip_debug_rtx(x);
2439
+
2440
+       // Only insist the register be a valid register if strict is true
2441 111 dgisselq
+       if (zip_legitimate_opb(x, strict))
2442 102 dgisselq
+               return true;
2443 111 dgisselq
+       // else if (zip_const_address_operand(x))
2444
+               // return true;
2445 102 dgisselq
+
2446
+       return false;
2447
+}
2448
+
2449 111 dgisselq
+static rtx
2450
+zip_legitimize_address(rtx x, rtx oldx ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED) {
2451
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2452
+
2453
+       if (dbg) zip_debug_rtx_pfx("LEGITIMIZE: ", x);
2454
+       if (zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2455
+               return x;
2456
+
2457
+       if (GET_CODE(x)==PLUS) {
2458
+               if (!REG_P(XEXP(x,0)))
2459
+                       XEXP(x,0) = force_reg(GET_MODE(x),XEXP(x,0));
2460
+               if ((!zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2461
+                       &&(!CONST_INT_P(XEXP(x,1))))
2462
+                       x = force_reg(GET_MODE(x),x);
2463
+       } else if (MEM_P(x))
2464
+               x = force_reg(GET_MODE(x),x);
2465
+
2466
+       if (dbg) zip_debug_rtx_pfx("LEGITIMATE: ", x);
2467
+       return x;
2468
+}
2469
+
2470 102 dgisselq
+void
2471
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
2472
+{
2473
+       assemble_name(stream, name);
2474
+       fprintf(stream, "\t.equ ");
2475
+       assemble_name(stream, value);
2476
+       fputc('\n', stream);
2477
+}
2478
+
2479 111 dgisselq
+#define        USE_SUBREG
2480
+#ifdef USE_SUBREG
2481
+#define        SREG_P(RTX) ((SUBREG_P(RTX))&&(REG_P(XEXP(RTX,0))))
2482
+#define        SMEM_P(RTX) ((SUBREG_P(RTX))&&(MEM_P(XEXP(RTX,0))))
2483
+#else
2484
+#define        SREG_P(RTX)     false
2485
+#define        SMEM_P(RTX)     false
2486
+#endif
2487 102 dgisselq
+
2488
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
2489 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2490 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
2491
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2492
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
2493
+       switch(GET_CODE(condition)) {
2494
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
2495
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
2496
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
2497
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
2498
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
2499
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
2500
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
2501
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
2502
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
2503
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
2504
+       default:
2505
+               zip_debug_rtx(condition);
2506
+               internal_error("CSTORE Unsupported condition");
2507
+               return NULL;
2508
+       }
2509
+}
2510
+
2511
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
2512
+       static char     result[64] = "";
2513
+       switch(condition) {
2514
+               //
2515
+               // Result already exists in the iffalse register
2516
+               // Can't change it.  Therefore, on the
2517
+               // condition ... move true register to the
2518
+               // destination
2519
+               //
2520
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
2521
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
2522
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
2523
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
2524
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
2525
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2526
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
2527
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
2528
+               //
2529
+               // .GTU doesn't exist on the Zip CPU either. We also note that
2530
+               // .C will never be set on an equal condition.  Therefore, we
2531
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
2532
+               // as long as .Z wasn't true.  We then undo this when we're
2533
+               // done.  This is possible since none of these instructions
2534
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
2535
+               // the condition codes.
2536
+               //
2537
+               // This is obviously not very optimal.  Avoid this by all means
2538
+               // if you can
2539
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
2540
+               // .LEU doesn't exist on Zip CPU either--turn this into another
2541
+               // two instructions
2542
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2543
+               //
2544
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
2545
+               // painful.  We can change the condition codes to make it so,
2546
+               // but the instruction requires the condition codes not be
2547
+               // changed.  Hence, we must change them back if we do so.
2548
+               //
2549
+               // .C will be set on less than but not equal.  Hence !.C will
2550
+               // be true on greater than or equal.
2551
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
2552
+               default:
2553
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
2554
+                       return NULL;
2555
+       } return result;
2556
+}
2557
+
2558
+const char *zip_tertiary_movsicc(rtx condition, const char *optrue, const char *opfalse) {
2559
+       static  char    result[64] = "";
2560
+       switch(GET_CODE(condition)) {
2561
+               case EQ:        sprintf(result,"%s\t%%3,%%0\n\t%s.Z\t%%2,%%0", opfalse, optrue); break;
2562
+               case NE:        sprintf(result,"%s\t%%3,%%0\n\t%s.NZ\t%%2,%%0", opfalse, optrue); break;
2563
+               case LT:        sprintf(result,"%s\t%%3,%%0\n\t%s.LT\t%%2,%%0", opfalse, optrue); break;
2564
+               case GT:        sprintf(result,"%s\t%%3,%%0\n\t%s.GT\t%%2,%%0", opfalse, optrue); break;
2565
+               // LE doesn't exist on a Zip CPU.  Accomplish this by
2566
+               // reversing the condition: i.e., load the false value into
2567
+               // the register, and the on condition load the true value.
2568
+               case LE:        sprintf(result,"%s\t%%2,%%0\n\t%s.GT\t%%3,%%0", optrue, opfalse); break;
2569
+               case GE:        sprintf(result,"%s\t%%3,%%0\n\t%s.GE\t%%2,%%0", opfalse, optrue); break;
2570
+               case LTU:       sprintf(result,"%s\t%%3,%%0\n\t%s.C\t%%2,%%0", opfalse, optrue); break;
2571
+               //
2572
+               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;
2573
+               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;
2574
+               case GEU:       sprintf(result,"%s\t%%2,%%0\n\t%s.C\t%%3,%%0\n", optrue, opfalse); break;
2575
+               default:
2576
+                       internal_error("MOVSICC Unsupported condition");
2577
+                       return NULL;
2578
+       } return result;
2579
+}
2580
+
2581
+const char *zip_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
2582 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2583 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
2584
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
2585
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2586
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
2587
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
2588
+       if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2589
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(X) -> R\n");
2590
+               if (zip_legitimate_move_operand_p(SImode, iffalse, true))
2591
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "MOV", 3);
2592
+               else if (zip_const_address_operand(iffalse))
2593
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2594
+               else if (zip_const_address_operand(iffalse))
2595
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LDI", 3);
2596 111 dgisselq
+               else if ((MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true)))
2597 102 dgisselq
+                       return zip_binary_movsicc(reverse_condition(GET_CODE(condition)), "LOD", 3);
2598
+               else {
2599
+                       internal_error("MOVSICC Unsupported mode");
2600
+                       return NULL;
2601
+               }
2602
+       } if ((REG_P(iftrue))&&(REGNO(dst)==REGNO(iftrue))) {
2603
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- CASE if(!X) -> R\n");
2604
+               if (zip_legitimate_move_operand_p(SImode, iftrue, true))
2605
+                       return zip_binary_movsicc(GET_CODE(condition), "MOV",2);
2606
+               else if (zip_const_address_operand(iffalse))
2607
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2608
+               else if (zip_const_address_operand(iffalse))
2609
+                       return zip_binary_movsicc(GET_CODE(condition), "LDI",2);
2610 111 dgisselq
+               else if ((MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true)))
2611 102 dgisselq
+                       return zip_binary_movsicc(GET_CODE(condition), "LOD",2);
2612
+               else {
2613
+                       internal_error("MOVSICC Unsupported mode");
2614
+                       return NULL;
2615
+               }
2616
+       } if ((zip_const_address_operand(iftrue))&&(zip_const_address_operand(iffalse))) {
2617
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE #2\n");
2618
+               return zip_tertiary_movsicc(condition, "LDI", "LDI");
2619
+       } if ((zip_const_address_operand(iftrue))&&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2620
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #1 ELSE A+B\n");
2621
+               return zip_tertiary_movsicc(condition, "LDI", "MOV");
2622
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))&&(zip_const_address_operand(iffalse))) {
2623
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE #x\n");
2624
+               return zip_tertiary_movsicc(condition, "MOV", "LDI");
2625
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2626
+                       &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2627
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C+D\n");
2628
+               return zip_tertiary_movsicc(condition, "MOV", "MOV");
2629
+       }
2630
+       if ((MEM_P(iftrue))
2631 111 dgisselq
+               &&(zip_legitimate_opb(XEXP(iftrue,0), true))
2632 102 dgisselq
+               &&(zip_legitimate_move_operand_p(SImode, iffalse, true))) {
2633
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C+D\n");
2634
+               return zip_tertiary_movsicc(condition, "LOD", "MOV");
2635
+       } if ((zip_legitimate_move_operand_p(SImode, iftrue, true))
2636 111 dgisselq
+               &&(MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true))) {
2637 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A+B ELSE C[D]\n");
2638
+               return zip_tertiary_movsicc(condition, "MOV", "LOD");
2639 111 dgisselq
+       } if ((MEM_P(iftrue))&&(zip_legitimate_opb(XEXP(iftrue,0), true))
2640
+               &&(MEM_P(iffalse))&&(zip_legitimate_opb(XEXP(iffalse,0), true))) {
2641 102 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE C[D]\n");
2642
+               return zip_tertiary_movsicc(condition, "LOD", "LOD");
2643 111 dgisselq
+       } if ((MEM_P(iftrue))
2644
+               &&(zip_legitimate_opb(XEXP(iftrue,0),true))
2645
+               &&(zip_const_address_operand(iffalse))) {
2646
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) A[B] ELSE #x\n");
2647
+               return zip_tertiary_movsicc(condition, "LOD", "LDI");
2648
+       } if ((MEM_P(iffalse))
2649
+               &&(zip_legitimate_opb(XEXP(iffalse,0),true))
2650
+               &&(zip_const_address_operand(iftrue))) {
2651
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- IF(X) #x ELSE A[B]\n");
2652
+               return zip_tertiary_movsicc(condition, "LDI", "LOD");
2653 102 dgisselq
+       }
2654
+
2655
+       internal_error("MOVSICC Operands not supported");
2656
+}
2657
+
2658
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
2659
+       // We know upon entry that REG_P(dst) must be true
2660
+       if (!REG_P(dst))
2661
+               internal_error("%s","ADDSICC into something other than register");
2662
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
2663
+               switch (GET_CODE(condition)) {
2664
+               case EQ: return "ADD.Z\t%3,%0";
2665
+               case NE: return "ADD.NZ\t%3,%0";
2666
+               case LT: return "ADD.LT\t%3,%0";
2667
+               case GT: return "ADD.GT\t%3,%0";
2668
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
2669
+               case GE: return "ADD.GE\t%3,%0";
2670
+               case LTU: return "ADD.C\t%3,%0";
2671
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
2672
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
2673
+               // Can do a GEU comparison, and then undo on the Zero condition
2674
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
2675
+               default:
2676
+                       internal_error("%s", "Zip/No usable addsi expansion");
2677
+                       break;
2678
+               }
2679
+       } else {
2680
+               // MOV A+REG,REG
2681
+               switch (GET_CODE(condition)) {
2682
+               case EQ: return "MOV.Z\t%3+%2,%0";
2683
+               case NE: return "MOV.NZ\t%3+%2,%0";
2684
+               case LT: return "MOV.LT\t%3+%2,%0";
2685
+               case GT: return "MOV.GT\t%3+%2,%0";
2686
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2687
+               case GE: return "MOV.GE\t%3+%2,%0";
2688
+               case LTU: return "MOV.C\t%3+%2,%0";
2689
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2690
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
2691
+               // Can do a GEU comparison, and then undo on the Zero condition
2692
+               // EXCEPT: with a move instruction, what's there to undo?  We
2693
+               // just clobbered our register!
2694
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
2695
+               default:
2696
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
2697
+                       break;
2698
+               }
2699
+       }
2700
+
2701
+       return "BREAK";
2702
+}
2703
+
2704 103 dgisselq
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
2705 102 dgisselq
+       int     rv = 14;
2706
+       if ((mode == DImode)||(mode == DFmode))
2707
+               rv += 2;
2708
+       return rv;
2709
+}
2710
+
2711 103 dgisselq
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
2712 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void) {
2713
+       // Let's try their suggested approach, keeping us from modifying jumps
2714
+       // after reload.  This should also allow our peephole2 optimizations
2715
+       // to adjust things back to what they need to be if necessary.
2716
+       return (reload_completed || reload_in_progress);
2717
+}
2718 122 dgisselq
+
2719
+rtx_insn       *zip_ifcvt_info;
2720
+
2721
+void
2722
+zip_ifcvt_modify_tests(ce_if_block *ce_info ATTRIBUTE_UNUSED, rtx *true_expr, rtx *false_expr) {
2723
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2724
+       if (dbg) fprintf(stderr, "IFCVT-MODIFY-TESTS\n");
2725
+       if (*true_expr) switch(GET_CODE(*true_expr)) {
2726
+               case LE:
2727
+               case GTU:
2728
+               case GEU:
2729
+               case LEU:
2730
+                       if (dbg) fprintf(stderr, "TRUE, missing expr\n");
2731
+                       if (dbg) zip_debug_rtx(*true_expr);
2732
+                       *true_expr = NULL_RTX;
2733
+                       break;
2734
+               default: // LT, GT, GTE, LTU, NE, EQ
2735
+                       break;
2736
+       }
2737
+
2738
+       if (*false_expr) switch(GET_CODE(*false_expr)) {
2739
+               case LE:
2740
+               case GTU:
2741
+               case GEU:
2742
+               case LEU:
2743
+                       if (dbg) fprintf(stderr, "FALSE, missing expr\n");
2744
+                       if (dbg) zip_debug_rtx(*false_expr);
2745
+                       *false_expr = NULL_RTX;
2746
+               default:
2747
+                       break;
2748
+       }
2749
+       if ((dbg)&&((!*true_expr)||(!*false_expr)))
2750
+               fprintf(stderr, "IFCVT-MODIFY-TESTS -- FAIL\n");
2751
+}
2752
+
2753
+void
2754
+zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2755
+/*
2756
+       fprintf(stderr, "IFCVT -- CANCEL\n");
2757
+       zip_ifcvt_info = NULL;
2758
+*/
2759
+}
2760
+
2761
+void
2762
+zip_ifcvt_modify_final(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2763
+/*
2764
+rtx_insn *insn;
2765
+FOR_BB_INSNS(ceinfo->test_bb, insn)
2766
+       fprintf(stderr, "IFCVT -- FINAL\n");
2767
+       zip_debug_rtx_pfx("FINAL-TEST-BB", insn);
2768
+       zip_ifcvt_info = NULL;
2769
+*/
2770
+}
2771
+
2772
+void
2773
+zip_ifcvt_machdep_init(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2774
+/*
2775
+       zip_ifcvt_info = NULL;
2776
+       rtx_insn *insn, *ifinsn = NULL;
2777
+       FOR_BB_INSNS(ceinfo->test_bb, insn) {
2778
+               rtx     p;
2779
+               p = single_set(insn);
2780
+               if (!p) continue;
2781
+               if (SET_DEST(p)==pc_rtx) {
2782
+                       ifinsn = insn;
2783
+               }
2784
+               if (!REG_P(SET_DEST(p)))
2785
+                       continue;
2786
+               if (GET_MODE(SET_DEST(p))!=CCmode)
2787
+                       continue;
2788
+               if (REGNO(SET_DEST(p))!=zip_CC)
2789
+                       continue;
2790
+               zip_ifcvt_info = insn;
2791
+       }
2792
+
2793
+       if (zip_ifcvt_info)
2794
+               zip_debug_rtx_pfx("PUTATIVE-CMP",zip_ifcvt_info);
2795
+       if (ifinsn)
2796
+               zip_debug_rtx_pfx("PRIOR-JMP",ifinsn);
2797
+*/
2798
+}
2799
+
2800 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
2801
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
2802 122 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-04-04 18:41:58.074920257 -0400
2803
@@ -0,0 +1,3983 @@
2804 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
2805
+//
2806
+// Filename:   gcc/config/zip/zip.h
2807
+//
2808
+// Project:    Zip CPU backend for the GNU Compiler Collection
2809
+//
2810
+// Purpose:
2811
+//
2812
+// Creator:    Dan Gisselquist, Ph.D.
2813
+//             Gisselquist Technology, LLC
2814
+//
2815
+////////////////////////////////////////////////////////////////////////////////
2816
+//
2817
+// Copyright (C) 2016, Gisselquist Technology, LLC
2818
+//
2819
+// This program is free software (firmware): you can redistribute it and/or
2820
+// modify it under the terms of  the GNU General Public License as published
2821
+// by the Free Software Foundation, either version 3 of the License, or (at
2822
+// your option) any later version.
2823
+//
2824
+// This program is distributed in the hope that it will be useful, but WITHOUT
2825
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
2826
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2827
+// for more details.
2828
+//
2829
+// You should have received a copy of the GNU General Public License along
2830
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
2831
+// target there if the PDF file isn't present.)  If not, see
2832
+// <http://www.gnu.org/licenses/> for a copy.
2833
+//
2834
+// License:    GPL, v3, as defined and found on www.gnu.org,
2835
+//             http://www.gnu.org/licenses/gpl.html
2836
+//
2837
+//
2838
+////////////////////////////////////////////////////////////////////////////////
2839
+#ifndef        GCC_ZIP_H
2840
+#define        GCC_ZIP_H
2841
+
2842
+
2843
+//
2844
+//
2845
+// Zip CPU configuration registers
2846
+//
2847
+//
2848
+#define        ZIP_USER        0        // Assume we are in supervisor mode
2849
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
2850
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
2851
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
2852
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
2853
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
2854
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
2855
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
2856
+#define        ZIP_HAS_DI      1
2857
+
2858
+// Zip has 16 registers in each user mode.
2859
+//     Register 15 is the program counter (PC)
2860
+//     Register 14 is the condition codes (CC)
2861
+//     Register 13 is the stack pointer   (SP)
2862
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
2863
+//     Register  0 (may be) the return address pointer
2864
+// Registers 16-31 may only be used in supervisor mode.
2865
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
2866
+#define        is_ZIP_REG(REGNO)               ((REGNO)<16)
2867
+
2868 103 dgisselq
+// #define     zip_FP_PSEUDO   16
2869
+#define        zip_PC          15
2870
+#define        zip_CC          14
2871
+#define        zip_SP          13
2872
+#define        zip_FP          12
2873
+#define        zip_GOT         11
2874
+#define        zip_AP          10
2875
+#define        zip_R1          1
2876
+#define        zip_R0          0
2877 102 dgisselq
+
2878
+#define        ZIP_FIRST_ARG_REGNO     1
2879
+#define        ZIP_LAST_ARG_REGNO      5
2880 111 dgisselq
+#define        NUM_ARG_REGS            (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
2881
+#define        MAX_PARM_REGS           (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
2882 102 dgisselq
+
2883
+/* The overall framework of an assembler file */
2884
+
2885
+#define        ASM_COMMENT_START       ";"
2886
+#define        ASM_APP_ON              ""
2887
+#define        ASM_APP_OFF             ""
2888
+
2889
+#define        FILE_ASM_OP             "\t.file\n"
2890
+
2891
+/* Output and Generation of Labels */
2892
+#define        GLOBAL_ASM_OP           "\t.global\t"
2893
+
2894
+#undef BITS_PER_UNIT
2895
+#define        BITS_PER_UNIT   (32)
2896
+
2897
+/* Assembler Commands for Alignment */
2898
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
2899
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
2900
+
2901
+
2902
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
2903
+ * for an instruction operand X. */
2904
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
2905
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
2906
+
2907
+/* Passing arguments in registers */
2908
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
2909
+
2910
+/* Define how to find the value returned by a function.  VALTYPE is the data
2911
+ * type of the value (as a tree).  If the precise function being called is known
2912
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
2913
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
2914
+
2915
+/* Define how to find the value returned by a library function assuming the
2916
+ * value has mode MODE.
2917
+ */
2918
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
2919
+
2920
+
2921
+/* STACK AND CALLING */
2922
+
2923
+
2924
+/* Define this macro as a C expression that is nonzero for registers that are
2925
+ * used by the epilogue or the return pattern.  The stack and frame pointer
2926
+ * registers are already assumed to be used as needed.
2927
+ */
2928
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
2929
+
2930
+
2931
+/* Normal alignment required for function parameters on the stack, in bits.  All
2932
+ * stack parameters receive at leaswt this much alignment regardless of data
2933
+ * type. */
2934
+#define        PARM_BOUNDARY   32
2935
+
2936
+/* Alignment of field after 'int : 0' in a structure. */
2937
+#define        EMPTY_FIELD_BOUNDARY    32
2938
+
2939
+/* No data type wants to be aligned rounder than this. */
2940
+#define        BIGGEST_ALIGNMENT       32
2941
+
2942
+/* The best alignment to use in cases where we have a choice. */
2943
+#define        FASTEST_ALIGNMENT       32
2944
+
2945
+/* Every structures size must be a multiple of 32-bits. */
2946
+#define        STRUCTURE_SIZE_BOUNDARY 32
2947
+
2948
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
2949
+ * other C compilers handle alignment of bit-fields and the structures that
2950
+ * contain them.
2951
+ *
2952
+ * The behavior is that the type written for a named bit-field (int, short, or
2953
+ * other integer type) imposes an alignment for the entire structure, as if the
2954
+ * structure really did contain an ordinary field of that type.  In addition,
2955
+ * the bit-field is placed within the structure so that it would fit within
2956
+ * such a field, not crossing a boundary for it.
2957
+ *
2958
+ * Thus, no most machines, a named bit-field whose type is written as int would
2959
+ * not cross a four-byte boundary, and would force four-byte alignment for the
2960
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
2961
+ * by other alignment parameters.)
2962
+ *
2963
+ * An unnamed bit-field will not affect the alignment of the containing
2964
+ * structure.
2965
+ *
2966
+ * If thhe macro is defined, its definition should be a C expression, a non
2967
+ * zero value for the expression enables this behavior.
2968
+ * Look at the fundamental type that is used for a bit-field and use that to
2969
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
2970
+ * have the same alignment as 'int', not 'char'.
2971
+ */
2972
+#undef PCC_BITFIELD_TYPE_MATTERS
2973
+#define        PCC_BITFIELD_TYPE_MATTERS       0
2974
+
2975
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
2976
+ * largest integer machine mode that should actually be used.  All integer
2977
+ * machine modes of this size and smaller can be used for structures and unions
2978
+ * with the appropriate sizes.  If this macro is undefined,
2979
+ * GET_MODE_BITSIZE(DImode) is assumed.
2980
+ *
2981
+ * ZipCPU -- The default looks good enough for us.
2982
+ */
2983
+
2984
+/* Make strings word-aligned so strcpy from constants will be faster. */
2985
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  (((TREE_CODE(EXP)==STRING_CST)  \
2986
+       && ((ALIGN) < FASTEST_ALIGNMENT)) ? FASTEST_ALIGNMENT : (ALIGN))
2987
+
2988
+/* Make arrays of chars word-aligned for the same reasons. */
2989
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     ((TREE_CODE(TYPE) == ARRAY_TYPE) \
2990
+       && (TYPE_MODE(TREE_TYPE(TYPE)) == QImode)               \
2991
+       && ((ALIGN < FASTEST_ALIGNMENT) ? FASTEST_ALIGNMENT : (ALIGN)))
2992
+
2993
+/* Generate Code for Profiling
2994
+ */
2995
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
2996
+
2997
+
2998
+/* A C expression which is nonzero if register number NUM is suitable for use
2999
+ * as an index register in operand addresses.
3000
+ */
3001
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3002
+
3003
+
3004
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3005
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3006
+ * operand of mode MODE.
3007
+ */
3008 111 dgisselq
+/* 17.03 Controlling the Compilation Driver, 'gcc' */
3009
+// DRIVER_SELF_SPECS
3010
+// OPTION_DEFAULT_SPECS
3011
+// CPP_SPEC
3012
+// CPLUSPLUS_CPP_SPEC
3013
+// CC1_SPEC
3014
+// CC1PLUS_SPEC
3015
+/* ASM_SPEC ... A C string constant that tells the GCC driver program options
3016
+ * to pass to the assembler.  It can also specify how to translate options you
3017
+ * give to GCC into options for GCC to pass to the assembler.  See the file
3018
+ * 'sun3.h' for an example of this.
3019
+ *
3020
+ * Do not define thismacro if it does not need to do anything.
3021
+ */
3022
+// #undef      ASM_SPEC
3023
+// ASM_FINAL_SPEC
3024
+// ASM_NEEDS_DASH_FOR_PIPED_INPUT
3025
+
3026
+/* LINK_SPEC ... A C string constant that tells the GCC driver program options
3027
+ * to pass to the linker.  It can also specify how to translate options you give
3028
+ * to GCC into options for GCC to pass to the linker.
3029
+ *
3030
+ * Do not define this macro if it does not need to do anything.
3031
+ */
3032
+
3033
+/* LIB_SPEC ... Another C string constant very much like LINK_SPEC.  The
3034
+ * difference between the two is that LIB_SPEC is used at the end of the
3035
+ * command given to the linker.
3036
+ *
3037
+ * If this macro is not defined, a default is provided that loads the standard
3038
+ * C library from the usual place.  See 'gcc.c'.
3039
+ */
3040
+#undef LIB_SPEC
3041
+// #define     LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
3042
+#define        LIB_SPEC        ""
3043
+
3044
+/* LIBGCC_SPEC ... Another C string constant that tells the GCC driver program
3045
+ * hoow and when to place a reference to 'libgcc.a' into the linker command
3046
+ * line.  This constant is placed both before and after the value of LIB_SPEC.
3047
+ *
3048
+ * If this macro is not defined, the GCC driver provides a default that passes
3049
+ * the string '-lgcc' to the linker.
3050
+ */
3051
+#undef LIBGCC_SPEC
3052
+#define        LIBGCC_SPEC     ""
3053
+
3054
+/* REAL_LIBGCC_SPEC ... By default, if ENABLE_SHARED_LIBGCC is defined, the
3055
+ * LIBGCC_SPEC is not directly used by the driver program but is instead
3056
+ * modified to refer to different versions of 'libgcc.a' depending on the
3057
+ * values of the command line flags '-static', '-shared', '-static-libgcc',
3058
+ * and '-shared-libgcc'.  On targets where these modifications are
3059
+ * inappropriate, define REAL_LIBGCC_SPEC instead.  REAL_LIBGCC_SPEC tells the
3060
+ * driver how to place a reference to 'libgcc' on the link command line, but
3061
+ * unlike LIBGCC_SPEC, it is used unmodified.
3062
+ */
3063
+#define        REAL_LIBGCC_SPEC        ""
3064
+
3065
+// USE_LD_AS_NEEDED
3066
+// LINK_EH_SPEC
3067
+
3068
+/* STARTFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3069
+ * difference between the two is that STARTFILE_SPEC is used at the very
3070
+ * beginning of the command given to the linker.
3071
+ *
3072
+ * If this macro is not defined, a default is provided that loads the standard
3073
+ * C startup file from the usual place.  See 'gcc.c'
3074
+ */
3075
+#undef STARTFILE_SPEC
3076
+#define        STARTFILE_SPEC  ""
3077
+
3078
+/* ENDFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3079
+ * difference between the two is that ENDFILE_SPEC is used at the very end
3080
+ * of the command given to the linker.
3081
+ *
3082
+ * Do not define this macro if it does not do anything.
3083
+ */
3084
+// #undef      ENDFILE_SPEC
3085
+// #define     ENDFILE_SPEC    ""
3086
+
3087
+// THREAD_MODEL_SPEC
3088
+// SYSROOT_SUFFIX_SPEC
3089
+// SYSROOT_HEADERS_SUFFIX_SPEC
3090
+// EXTRA_SPECS
3091
+// LINK_LIBGCC_SPECIAL_1
3092
+// LINK_GCC_C_SEQUENCE_SPEC
3093
+// LINK_COMMAND_SPEC
3094
+// TARGET_ALWAYS_STRIP_DOTDOT
3095
+// MULTILIB_DEFAULTS
3096
+// RELATIVE_PREFIX_NOT_LINKDIR
3097
+// MD_EXEC_PREFIX
3098
+// STANDARD_STARTFILE_PREFIX
3099
+// STANDARD_STARTFILE_PREFIX_1
3100
+// STANDARD_STARTFILE_PREFIX_2
3101
+// MD_STARTFILE_PREFIX
3102
+// MD_STARTFILE_PREFIX_1
3103
+// INIT_ENVIRONMENT
3104
+// LOCAL_INCLUDE_DIR
3105
+#undef LOCAL_INCLUDE_DIR
3106
+
3107
+// NATIVE_SYSTEM_HEADER_COMPONENT
3108
+// INCLUDE_DEFAULTS
3109
+
3110 102 dgisselq
+/* 17.03 Run-time Target Specification */
3111
+
3112
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3113
+ * code that defines built-in preprocessor macros and assertions for the target
3114
+ * CPU, using the functions builtin_define, builtin_define_std, and
3115
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3116
+ * semicolon, and since it has finished command line option proccessing your
3117
+ * code can use those results freely.
3118
+ *
3119
+ * ZipCPU --- We should probably capture in this macro what capabilities the
3120
+ * command line parameters we've been given indicate that our CPU has.  That
3121
+ * way, code can be adjusted depending upon the CPU's capabilities.
3122
+ */
3123
+#define        TARGET_CPU_CPP_BUILTINS()                       \
3124
+       { builtin_define("__ZIPCPU__");                 \
3125
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
3126
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
3127
+       }
3128
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
3129
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
3130
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
3131
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
3132
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
3133
+       // If (we support int64s) builtin_define("___int64_t_defined");
3134
+
3135
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
3136
+ * macro is optional and is used for the target operating system instead.
3137
+ */
3138
+
3139
+/* Option macros: (we need to define these eventually ... )
3140
+ *
3141
+ *     TARGET_HANDLE_OPTION
3142
+ *     TARGET_HANDLE_C_OPTION
3143
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
3144
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
3145
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
3146
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
3147
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
3148
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
3149
+ *     C_COMMON_OVERRIDE_OTPTIONS
3150
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
3151
+ *     TARGET_OPTION_INIT_STRUCT
3152
+ *     TARGET_OPTION_DEFAULT_PARAMS
3153
+ */
3154
+
3155
+/* SWITCHABLE_TARGET
3156
+ *
3157
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
3158
+ * here.
3159
+ */
3160
+
3161
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
3162
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
3163
+ * otherwise.  This is intended to relate to the float and double types, but not
3164
+ * necessarily "long double".  By default, returns true if the adddf3
3165
+ * instruction pattern is available and false otherwise, on the assumption that
3166
+ * hardware floating point supports exceptions and rounding modes but software
3167
+ * floating point does not.
3168
+ *
3169
+ * ZipCPU floating point is barely going to be functional, I doubt it will
3170
+ * support all of these bells and whistles when full functionality is even
3171
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
3172
+ * set this to zero, so let's come back to this.
3173
+ */
3174
+// #warning "Wrong answer encoded to date"
3175 103 dgisselq
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
3176 102 dgisselq
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
3177
+
3178
+/* 17.04 Defining data structures for per-function information */
3179
+
3180
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
3181
+ * information.  This macro is called once per function, before generation of
3182
+ * any RTL has begun.  The intention is to allow the initialization of the
3183
+ * function pointer init_machine_status.
3184
+ */
3185
+// #warning "I may need to define this to handle function return addresses ..."
3186
+
3187
+/* 17.05 Storage Layout */
3188
+
3189
+/* Storage Layout */
3190
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
3191
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
3192
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
3193
+#define        FLOAT_WORDS_BIG_ENDIAN  1
3194
+#define        BITS_PER_WORD           32
3195
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
3196
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
3197
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
3198
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
3199
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
3200
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
3201
+ * default is BITS_PER_WORD.
3202
+ *
3203
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
3204
+ */
3205
+#define        POINTER_SIZE            32      // Ptr width in bits
3206
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
3207
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
3208
+ * than zero if pointers should be zero-extended, zero if they should be sign
3209
+ * extended, and negative if some other conversion is needed.  In the last case,
3210
+ * the extension is done by the target's ptr_extend instruction.
3211
+ *
3212
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
3213
+ * the same width.
3214
+ *
3215
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
3216
+ * number of bits as SImode.  Therefore, one might wish to convert between the
3217
+ * two.  Hence, we specify how we would do that here.
3218
+ */
3219
+#define        POINTERS_EXTEND_UNSIGNED        0
3220
+
3221
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
3222
+ * object whose type is type and which has he specified mode and signedness is
3223
+ * to be stored in a register.  This macro is only called when type is a scalar
3224
+ * type.
3225
+ *
3226
+ * On most RISC machines, which only have operations that operate on a full
3227
+ * register, define this macro to set m to word_mode if m is an integer mode
3228
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
3229
+ * widened because wider precision floating-point operations are usually more
3230
+ * expensive than their narrower counterparts.
3231
+ *
3232
+ * For most machines, the macro definition does not change unsigndep.  However,
3233
+ * some machines, have instructions that preferentially handle either signed or
3234
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
3235
+ * loads from memory and 32-bit add instructions sign-extend the result to
3236
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
3237
+ * is more efficient.
3238
+ *
3239
+ * Do not define this macro if it would never modify m.
3240
+ *
3241
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
3242
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
3243
+ */
3244
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
3245
+
3246
+// TARGET_PROMOTE_FUNCTION_MODE
3247
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
3248
+ * stack, in bits.  All stack parameters receive at least this much alignment
3249
+ * regardless of data type.  On most machines, this is the same as the size of
3250
+ * an integer.
3251
+ */
3252
+#define        PARM_BOUNDARY   32
3253
+
3254
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
3255
+ * hardware for the stack pointer on this machine.  The definition is a C
3256
+ * expression for the desired alignment (measured in bits).  This value is used
3257
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
3258
+ * this should be the same as PARM_BOUNDARY.
3259
+ */
3260
+#define        STACK_BOUNDARY  PARM_BOUNDARY
3261
+
3262
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
3263
+
3264
+/* INCOMING_STACK_BOUNDARY
3265
+ */
3266
+
3267
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
3268
+ */
3269
+#define        FUNCTION_BOUNDARY       32
3270
+
3271
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
3272
+ * this machine, in bits.  Note that this is not the biggest alignment that is
3273
+ * supported, just the biggest alignment that, when violated, may cause a fault.
3274
+ */
3275
+#define BIGGEST_ALIGNMENT      32
3276
+
3277
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
3278
+ * given to an object that can be referenced in one operation, without
3279
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
3280
+ * larger on machines that don't have byte or halfword store operations.
3281
+ */
3282
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
3283
+
3284
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
3285
+ * fail to work when given unaligned data.  If instructions will merely go
3286
+ * slower in that case, define this macro as 0.
3287
+ */
3288
+#define        STRICT_ALIGNMENT        1
3289
+
3290
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
3291
+ * largest integer machine mode that should actually be used.  All integer
3292
+ * machine modes of this size or smaller can be used for structures and unions
3293
+ * with the appropriate sizes.  If this macro is undefined,
3294
+ * GET_MODE_BITSIZE(DImode) is assumed.
3295
+ *
3296
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
3297
+ * size on bits of the largest integer machine mode.  However, that's the case
3298
+ * with most DI implementations: A long is two words, spliced together.  We'd
3299
+ * like to support that eventually, but we need to get there.  Hence, let's use
3300
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
3301
+ */
3302
+#if (ZIP_HAS_DI != 0)
3303
+#define        MAX_FIXED_MODE_SIZE     64
3304
+#else
3305
+#define        MAX_FIXED_MODE_SIZE     32
3306
+#endif
3307
+
3308
+
3309
+/* 17.06 Layout of Source Language Data Types */
3310
+
3311
+#undef CHAR_TYPE_SIZE
3312
+#undef SHORT_TYPE_SIZE
3313
+#undef INT_TYPE_SIZE
3314
+#undef LONG_TYPE_SIZE
3315
+#undef LONG_LONG_TYPE_SIZE
3316
+//
3317
+#define        CHAR_TYPE_SIZE  32
3318
+#define        SHORT_TYPE_SIZE 32
3319
+#define        INT_TYPE_SIZE   32
3320
+#define        LONG_TYPE_SIZE  32
3321
+#define        LONG_LONG_TYPE_SIZE     64
3322
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
3323
+#undef FLOAT_TYPE_SIZE
3324
+#undef DOUBLE_TYPE_SIZE
3325
+#undef LONG_DOUBLE_TYPE_SIZE
3326
+#define        FLOAT_TYPE_SIZE         32
3327
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
3328
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
3329
+// SHORT_FRAC_TYPE_SIZE
3330
+// LONG_FFRACT_TYPE_SIZE
3331
+// LONG_LONG_FRACT_TIME_SIZE
3332
+#undef SHORT_ACCUM_TYPE_SIZE
3333
+#undef ACCUM_TYPE_SIZE
3334
+#undef LONG_ACCUM_TYPE_SIZE
3335
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
3336
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
3337
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
3338
+
3339
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
3340
+ * hook and should be defined if that hook is overriden to be true.  It causes
3341
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
3342
+ * rather than the default __.  A port which uses this macro should also arrange
3343
+ * to use t-gnu-prefix in the libgcc config.host.
3344
+ *
3345
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
3346
+ */
3347
+
3348
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
3349
+ * in float.h,, assuming, if applicable, that the floating-point control word
3350
+ * is in its default state.  If you do not define this macro the value of
3351
+ * FLT_EVAL_METHOD will be zero.
3352
+ *
3353
+ * ZipCPU --- ???
3354
+ */
3355
+
3356
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
3357
+ * floating-point format supported by the hardware.  If you define this macro,
3358
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
3359
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
3360
+ * default.
3361
+ *
3362
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
3363
+ * really needs to be determined, then, based upon a compile time parameter
3364
+ * where the one compiling the code states whether or not the H/W even has
3365
+ * floating point support.
3366
+ *
3367
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
3368
+ * need to change this.
3369
+ */
3370
+#undef WIDEST_HARDWARE_FP_SIZE
3371
+// #warning "Definition needs to change if no FPU present"
3372
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
3373
+
3374
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
3375
+ * whether the type char should be signed or unsigned by default.  The user
3376
+ * can always override this default with the options -fsigned-char and
3377
+ * -funsigned-char.
3378
+ *
3379
+ * ZipCPU--let's go with the default behavior.
3380
+ */
3381
+#define        DEFAULT_SIGNED_CHAR     1
3382
+
3383
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
3384 103 dgisselq
+ * the compiler should give an enum type only as many bytes as it takes to
3385 102 dgisselq
+ * represent the range of possible values of that type.  It should return
3386
+ * false if all enum types should be allocated like int.
3387
+ *
3388
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
3389
+ * override it.
3390
+ */
3391
+
3392
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
3393
+ * type to use for size values.  The typedef name size_t is defined using the
3394
+ * contents of the string.
3395
+ *
3396
+ * If you don't define this macro, the default is "long unsigned int".  Since
3397
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
3398
+ * the default seems perfect for us.
3399
+ */
3400
+#define        SIZE_TYPE       "unsigned int"
3401
+
3402
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
3403
+ * This macro is a C expression for a string describing the name of the data
3404
+ * type from which the precision of sizetype is extracted.  The string has the
3405
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
3406
+ * default is SIZE_TYPE --- which seems good enough for us.
3407
+ */
3408
+
3409
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
3410
+ * type to use fo rthe result of subtracting two pointers.  The typedef name
3411
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
3412
+ * more information.
3413
+ *
3414
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
3415
+ * for us.
3416
+ */
3417
+#define        PTRDIFF_TYPE    "int"
3418
+
3419
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
3420
+ * type to use for wide characters.  The typedef name wchar_t is defined using
3421
+ * the contents of  the string.  If you don't define this macro, the default is
3422
+ * 'int'--good enough for ZipCPU.
3423
+ */
3424
+
3425
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
3426
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
3427
+ */
3428
+#undef WCHAR_TYPE_SIZE
3429
+#define        WCHAR_TYPE_SIZE 32
3430
+
3431
+/* WINT_TYPE ... A C expression for a string describing the name of the data
3432
+ * type to use for wide characters passed to printf and returned from getwc.
3433
+ * The typedef name wint_t is defined using the contents of the string.  See
3434
+ *
3435 103 dgisselq
+ * ZipCPU -- If you don't define this macro, the default is "unsigned int"--also
3436
+ * best for us again.
3437 102 dgisselq
+ */
3438
+
3439
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
3440
+ * data type that can represent any value of any standard or extended signed
3441
+ * integer type.  The typedef name intmax_t is defined using the contents of
3442
+ * the string.
3443
+ *
3444
+ * If you don't define this macro, the default is the first of "int", "long int"
3445
+ * or "long long int" that has as much precision as "long long int".
3446
+ */
3447
+
3448
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
3449
+ */
3450
+
3451
+#undef SIG_ATOMIC_TYPE
3452
+#if (ZIP_ATOMIC != 0)
3453
+#define        SIG_ATOMIC_TYPE "int"
3454
+#else
3455
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
3456
+#endif
3457
+#undef INT8_TYPE
3458
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
3459
+#undef INT16_TYPE
3460
+#define        INT16_TYPE              NULL
3461
+#undef INT32_TYPE
3462
+#define        INT32_TYPE              "int"
3463
+#undef UINT8_TYPE
3464
+#define        UINT8_TYPE              NULL
3465
+#undef UINT16_TYPE
3466
+#define        UINT16_TYPE             NULL
3467
+#undef UINT32_TYPE
3468
+#define        UINT32_TYPE             "unsigned int"
3469
+#undef INT_LEAST8_TYPE
3470
+#define        INT_LEAST8_TYPE         "int"
3471
+#undef INT_LEAST16_TYPE
3472
+#define        INT_LEAST16_TYPE        "int"
3473
+#undef INT_LEAST32_TYPE
3474
+#define        INT_LEAST32_TYPE        "int"
3475
+#undef UINT_LEAST8_TYPE
3476
+#define        UINT_LEAST8_TYPE        "unsigned int"
3477
+#undef UINT_LEAST16_TYPE
3478
+#define        UINT_LEAST16_TYPE       "unsigned int"
3479
+#undef UINT_LEAST32_TYPE
3480
+#define        UINT_LEAST32_TYPE       "unsigned int"
3481
+#undef INT_FAST8_TYPE
3482
+#define        INT_FAST8_TYPE          "int"
3483
+#undef INT_FAST16_TYPE
3484
+#define        INT_FAST16_TYPE         "int"
3485
+#undef INT_FAST32_TYPE
3486
+#define        INT_FAST32_TYPE         "int"
3487
+#undef UINT_FAST8_TYPE
3488
+#define        UINT_FAST8_TYPE         "unsigned int"
3489
+#undef UINT_FAST16_TYPE
3490
+#define        UINT_FAST16_TYPE        "unsigned int"
3491
+#undef UINT_FAST32_TYPE
3492
+#define        UINT_FAST32_TYPE        "unsigned int"
3493
+#undef INTPTR_TYPE
3494
+#define        INTPTR_TYPE             "unsigned int"
3495
+#undef UINTPTR_TYPE
3496
+#define        UINTPTR_TYPE            "unsigned int"
3497
+
3498
+#undef INT64_TYPE
3499
+#undef UINT64_TYPE
3500
+#undef INT_LEAST64_TYPE
3501
+#undef UINT_LEAST64_TYPE
3502
+#undef INT_FAST64_TYPE
3503
+#undef UINT_FAST64_TYPE
3504
+
3505
+#if (ZIP_HAS_DI != 0)
3506
+#define        INT64_TYPE              "long int"
3507
+#define        UINT64_TYPE             "long unsigned int"
3508
+#define        INT_LEAST64_TYPE        "long int"
3509
+#define        UINT_LEAST64_TYPE       "long unsigned int"
3510
+#define        INT_FAST64_TYPE         "long int"
3511
+#define        UINT_FAST64_TYPE        "long unsigned int"
3512
+#else
3513
+#define        INT64_TYPE              NULL
3514
+#define        UINT64_TYPE             NULL
3515
+#define        INT_LEAST64_TYPE        NULL
3516
+#define        UINT_LEAST64_TYPE       NULL
3517
+#define        INT_FAST64_TYPE         NULL
3518
+#define        UINT_FAST64_TYPE        NULL
3519
+#endif
3520
+
3521
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
3522
+
3523
+
3524
+/* 17.07 Register Usage / Register definitions */
3525
+
3526
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
3527
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
3528
+ * pseudo register's numbrer really is assigned the number
3529
+ * FIRST_PSEUDO_REGISTER.
3530
+ *
3531
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
3532
+ * and PC register being numbered 14 and 15 respectively.  Therefore, the
3533
+ * compiler can take register number 16 and above and do whatever it wants
3534
+ * with it.
3535
+ */
3536
+#ifdef DEFINE_USER_REGS
3537 103 dgisselq
+#  define      FIRST_PSEUDO_REGISTER   32
3538 102 dgisselq
+#else
3539 103 dgisselq
+#  ifdef       zip_FP_PSEUDO
3540
+#    define    FIRST_PSEUDO_REGISTER   (zip_FP_PSEUDO+1)
3541
+#  else
3542
+#    define    FIRST_PSEUDO_REGISTER   16
3543
+#  endif
3544 102 dgisselq
+#endif
3545
+
3546
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
3547
+ * fixed purposes all throughout the compiled code and are therefore not
3548
+ * available for general allocation.  These would include the stack pointer, the
3549
+ * frame pointer (except on machines where that can be used as a general
3550
+ * register when no frame pointer is needed), the program counter on machines
3551
+ * where that is considered one of the addressable registers, and any other
3552
+ * numbered register with a standard use.
3553
+ *
3554
+ * This information is expressed as a sequence of numbers, separated by commas,
3555
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
3556
+ * otherwise.
3557
+ *
3558
+ * For the Zip CPU, we have three fixed registers that are not available for
3559
+ * general allocation:
3560
+ *
3561
+ *     SP      The stack pointer
3562
+ *     CC      The condition codes and CPU state register
3563
+ *     PC      The program counter
3564
+ *
3565
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
3566
+ * table pointer) are registers that we hope will not be so fixed.
3567
+ */
3568 103 dgisselq
+#ifdef zip_FP_PSEUDO
3569
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1 }
3570
+#else
3571
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 }
3572
+#endif
3573 102 dgisselq
+
3574
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
3575
+ * that is clobbered (in general) by function calls as well as for fixed
3576
+ * registers.  This macro therefore identifies the registers that are not
3577
+ * available for general allocation of values that must live across function
3578
+ * calls.
3579
+ *
3580
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
3581
+ * it on function entry and restores it on function exit, if the register is
3582
+ * used within the function.
3583
+ *
3584
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
3585
+ * register above R5.
3586
+ */
3587 103 dgisselq
+#ifdef zip_FP_PSEUDO
3588
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1 }
3589
+#else
3590
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1 }
3591
+#endif
3592 102 dgisselq
+
3593
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
3594
+ * to the value of CALL_USED_REGISTERS.
3595
+ */
3596
+
3597
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
3598
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
3599
+ * across a call without some part of it being clobbbered.  For most machines,
3600
+ * this macro need not be defined.  It is only required for machines that do
3601 103 dgisselq
+ * not preserve the entire contents of a register across a call.
3602 102 dgisselq
+ *
3603
+ * In the Zip CPU, we clobber R0 with our return address during a call, so let's
3604
+ * make sure this gets included here.
3605
+ */
3606
+#define        HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
3607
+
3608
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
3609
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
3610
+ * reg_class_contents, to take into account any dependence of these register
3611
+ * sets on target flags.  The first three of these are of type char[]
3612
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
3613
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
3614
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
3615
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
3616
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
3617
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
3618
+ * applied.
3619
+ *
3620
+ * ZipCPU -- I may need to return and define this depending upon how FP and
3621
+ * GBL register allocation go.  But for now, we'll leave this at its default
3622
+ * value.
3623
+ */
3624
+// #warning "Revisit me after FP and GBL allocation"
3625
+
3626
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
3627
+ * windows. ...
3628
+ *
3629
+ * Zip CPU has no register windows.
3630
+ */
3631
+
3632
+/* OUTGOING_REGNO ... same thing.
3633
+ */
3634
+
3635
+/* LOCAL_REGNO ... same thing.
3636
+ */
3637
+
3638
+/* PC_REGNUM ... If the program counter has a register number, define this as
3639
+ * that register number.  Otherwise do not define it.
3640
+ */
3641
+#define        PC_REGNUM       zip_PC
3642
+
3643
+
3644
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
3645
+ * containing the number of hard registers in the order in which GCC should
3646
+ * prefer to use them (from most preferred to least.
3647
+ *
3648 103 dgisselq
+ * If this macro is not defined, registers are used lowest numbered first (all
3649 102 dgisselq
+ * else being equal).
3650
+ *
3651
+ * Since the default is the ZipCPU desired case, we won't define this here.
3652
+ */
3653
+
3654
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3655
+ * this macro, so we won't either.
3656
+ */
3657
+
3658
+/* HONOR_REG_ALLOC_ORDER ...
3659
+ */
3660
+
3661
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3662
+ * this macro, so we won't either.
3663
+ */
3664
+
3665
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
3666
+ * consecutive hard registers, starting at register number REGNO, required to
3667
+ * hold a value of mode MODE.
3668
+ *
3669
+ * On a machine where all registers are exactly one word, a suitable definition
3670
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
3671
+ *
3672
+ * On ZipCPU, we might do
3673
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
3674
+ * but I think the default (above) code should work as well.  Hence, let's stick
3675
+ * with the default, lest someone try to create larger modes (TImode, OImode,
3676
+ * XImode) and expect us to follow them properly some how.
3677
+ *
3678
+ * Okay, now in hind sight, we know that the default doesn't work for our
3679
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
3680
+ * this expression to work in bits rather than in bytes and we'll know more
3681
+ * of what we are doing.
3682
+ */
3683
+#undef HARD_REGNO_NREGS
3684
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
3685
+               / (UNITS_PER_WORD))
3686
+
3687
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
3688
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
3689
+ * to take up more space than in registers starting at register number REGNO
3690
+ * (as determined by multiplying GCC's notion of the size of the register when
3691
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
3692
+ * By default this is zero.
3693
+ *
3694
+ * Zip CPU --- The default looks good enough to me.
3695
+ */
3696
+
3697
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
3698
+ *
3699
+ * ZipCPU ---
3700
+ */
3701
+
3702
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
3703
+ * registers that hold values of mode mode is not the word size.  It is a C
3704
+ * expression that should give the natural size in bytes for the specified mode.
3705
+ * It is used by the register allocator to try to optimize its results.
3706
+ *
3707
+ * ZipCPU ---
3708
+ */
3709
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
3710
+
3711
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
3712 103 dgisselq
+ * to store a value of mode MODE in a hard register number REGNO (or in several
3713 102 dgisselq
+ * registers starting with that one).  For a machine where all registers are
3714
+ * equivalent, a suitable definition is '1'.  You need not include code to check
3715
+ * for the numbers of fixed registers, because the allocation mechanism
3716
+ * considered them to be always occupied.
3717
+ *
3718
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
3719
+ * suitable default definition mentioned above should be sufficient.
3720
+ */
3721
+#undef HARD_REGNO_MODE_OK
3722 103 dgisselq
+#define        HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
3723 102 dgisselq
+
3724
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
3725
+ * okay to rename a hard register FROM to another hard register TO.  One common
3726
+ * use of this macro is to prevernt renaming of a register to another register
3727
+ * that is not saved by a prologue in an interrupt handler.  The default is
3728
+ * always nonzero.
3729
+ *
3730
+ * ZipCPU --- The default looks good enough to us.
3731
+ */
3732
+#undef HARD_REGNO_RENAME_OK
3733
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
3734
+
3735
+
3736
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
3737
+ * M1 is accessible in mode M2 without copying.
3738
+ *
3739
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
3740
+ * so lets' set to one.
3741
+ */
3742
+#define        MODES_TIEABLE_P(M1,M2)  1
3743
+
3744
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
3745
+ * This target hook should return true if it is OK to use a hard register
3746
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
3747
+ * to prevent using of a register that is not saved by a prologue in an
3748
+ * interrupt handler.  The default version of this hook always returns true.
3749
+ *
3750
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
3751
+ * context, you have an entirely new set of registers (the supervisor set), so
3752
+ * this is a non-issue.
3753
+ */
3754
+
3755
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
3756
+ * copies to/from CCmode register(s).  You should only define this macro if
3757
+ * support for copying to/from CCmode is incomplete.
3758
+ *
3759
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
3760
+ * default definition.
3761
+ */
3762
+
3763
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
3764
+ *
3765
+ * Zip CPU has no stack-like registers, as their definition is different from
3766
+ * the ZipCPU stack pointer register.
3767
+ */
3768
+
3769
+#define        ZIP_REG_BYTE_SIZE       1
3770
+
3771
+/* 17.08 Register Classes */
3772
+
3773
+/* enum reg_class ... An enumerate type that must be defined with all the
3774
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
3775
+ * must be the last register class, followed by one more enumerated value,
3776
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
3777
+ * classes there are.
3778
+ *
3779
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
3780
+ * all_regs, and go from there.
3781
+ */
3782
+enum   reg_class {
3783
+       NO_REGS, GENERAL_REGS,
3784
+#ifdef DEFINE_USER_REGS
3785
+       USER_REGS,
3786
+#endif
3787
+       ALL_REGS, LIM_REG_CLASSES
3788
+};
3789
+
3790
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
3791
+ */
3792
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
3793
+
3794
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
3795
+ * classes as C string constants.  These names are used in writing some of the
3796
+ * debugging dumps.
3797
+ */
3798
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
3799
+
3800
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
3801
+ * classes, as integerss which are bit masks.  The nth integer specifies the
3802
+ * contents of class n.  That way the integer mask is interpreted as that
3803
+ * register r is in the class if (mask&(1<<r)) is 1.
3804
+ *
3805
+ * When the machine has more than 32 registers ... that's not us.
3806
+ *
3807
+ * ZipCPU --- This is straight forward, three register classes, etc.
3808
+ */
3809 103 dgisselq
+#ifdef zip_FP_PSEUDO
3810
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x13fff}, {0x1ffff} }
3811
+#else
3812 102 dgisselq
+#define        REG_CLASS_CONTENTS { { 0x00000}, {0x03fff}, {0x0ffff} }
3813 103 dgisselq
+#endif
3814 102 dgisselq
+
3815
+#ifdef DEFINE_USER_REGS
3816
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
3817
+#define        REG_CLASS_CONTENTS { { 0x00000},{0x03fff},{0x0ffff0000},{0x0ffffffff} }
3818
+#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 }
3819
+#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 }
3820
+#endif
3821
+
3822
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
3823
+ * containing hard register REGNO.  In general there is more than one such
3824
+ * class;  Choose a class which is minimal, meaning that no smaller class also
3825
+ * contains the register.
3826
+ */
3827
+#undef REGNO_REG_CLASS
3828 103 dgisselq
+#ifdef zip_FP_PSEUDO
3829
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((((R)<=13)||((R)==zip_FP_PSEUDO))?GENERAL_REGS:ALL_REGS):NO_REGS)
3830
+#else
3831 102 dgisselq
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((R<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
3832 103 dgisselq
+#endif
3833 102 dgisselq
+
3834
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
3835
+ * a valid base register must belong.  A base register is one used in an address
3836
+ * which is the register value plus a displacement.
3837
+ */
3838
+#undef BASE_REG_CLASS
3839
+#define        BASE_REG_CLASS  GENERAL_REGS
3840
+
3841
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
3842
+ * which allows the selection of a bse register in a mode dependent manner.  If
3843
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
3844
+ */
3845
+#undef MODE_BASE_CLASS
3846
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
3847
+
3848
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
3849
+ * class to which a valid base register must belong in order to be used in a
3850
+ * base plus index register address.  You should define this macro if base plus
3851
+ * index addresses have different requirements than other base register uses.
3852
+ *
3853
+ * Zip CPU does not support the base plus index addressing mode, thus ...
3854
+ */
3855 111 dgisselq
+// #undef      MODE_BASE_REG_REG_CLASS
3856
+// #define     MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
3857 102 dgisselq
+
3858
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
3859
+ * which a valid index register must belong.  An index register is one used in
3860
+ * an address where its value is either multiplied by a scale factor or added
3861
+ * to another register (as well as added to a displacement).
3862
+ *
3863
+ * ZipCPU -- Has no index registers.
3864
+ */
3865
+#undef INDEX_REG_CLASS
3866
+#define        INDEX_REG_CLASS NO_REGS
3867
+
3868
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
3869
+ * number num is suitable for use as a base register in operand addresses.
3870
+ */
3871
+#undef REGNO_OK_FOR_BASE_P
3872
+#ifdef DEFINE_USER_REGS
3873
+# define REGNO_OK_FOR_BASE_P(NUM)      ((NUM != zip_CC)&&(NUM < 16))
3874
+#else
3875
+# define REGNO_OK_FOR_BASE_P(NUM)      (NUM != zip_CC)
3876
+#endif
3877
+
3878
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
3879
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
3880 111 dgisselq
+ * memory reference in MODE.  You should define this macro if the mode of the
3881 102 dgisselq
+ * memory reference affects whether a register may be used as a base register.
3882
+ *
3883
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
3884
+ */
3885
+
3886
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
3887
+ * addresses, accessing memory in mode mode.
3888
+ *
3889
+ * Use of this macro is deprecated.
3890
+ */
3891
+
3892 111 dgisselq
+/* REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) ... A C expression which is
3893 102 dgisselq
+ * nonzero if a register number N is suitable for use as a base register in
3894
+ * operand addresses, accessing memory in mode M in address space AS.  This is
3895
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
3896
+ * the context in which the register appears in the memory reference.
3897
+ *
3898
+ * ZipCPU---We aren't specific in how we use our registers.
3899
+ */
3900
+#define        REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
3901
+
3902
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
3903
+ * num is suitable for use as an index register in opernad addressess.  It may
3904
+ * be either a suitable hard register or a pseudo register that has been
3905 111 dgisselq
+ * allocated such as a hard register.
3906 102 dgisselq
+ *
3907
+ * ZipCPU has no index registers, therefore we declare this to be zero.
3908
+ */
3909
+#undef REGNO_OK_FOR_INDEX_P
3910
+#define        REGNO_OK_FOR_INDEX_P(REGNO)     0
3911
+
3912
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
3913
+ * additional preference on the register class to use when it is necessary to
3914
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
3915
+ * preferred register class is found or hook preferred_rename_class is not
3916
+ * implemented.  SOmething returning a more restrictive class makes better code.
3917
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
3918
+ * instructions using GENERIC_REGS.  By returning LO_REGS from
3919
+ * preferred_rename_class, code size can be reduced.
3920
+ */
3921
+// #undef TARGET_PREFERRED_RENAME_CLASS
3922
+// #define     TARGET_PREFERRED_RENAME_CLASS(RCLASS)   RCLASS
3923
+
3924
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
3925
+ * restri tions on the register class to use when it is necessary to copy value
3926
+ * X into a register in class RC.  The value is a register class; rehaps RC, or
3927
+ * perhaps a smaller class.
3928
+ *
3929
+ * The default fversion of this hook always returns value of RC argument, which
3930
+ * sounds quite appropriate for the ZipCPU.
3931
+ */
3932
+
3933
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
3934
+ * restrictions on the register class to use when it is necessary to copy
3935
+ * value X into a register in class CLASS.  On many machines, the following
3936
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
3937
+ * Sometimes returning a more restrictive class makes better code.  For example,
3938
+ * on the 68k, when x is an integer constant that is in range for a moveq
3939
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
3940 111 dgisselq
+ * includes the data registers.  Requiring a data register guarantees that a
3941 102 dgisselq
+ * 'moveq' will be used.
3942
+ *
3943
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS.  For
3944
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
3945
+ * Hence, we only allow loads into the GENERAL_REG class.
3946
+ */
3947
+#define        PREFERRED_RELOAD_CLASS(X, CLASS)        GENERAL_REGS
3948
+
3949
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
3950
+ * RELOAD_CLASS, but for output instead of input reloads.
3951
+ *
3952
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
3953
+ */
3954
+
3955
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
3956
+ *
3957
+ * Don't define this macro unless the target machine has limitations which
3958
+ * require the macro to do something nontrivial.  ZipCPU doesn't, so we won't.
3959
+ */
3960
+
3961
+/* TARGET_SECONDARY_RELOAD
3962
+ * SECONDARY_ ...
3963
+ * Don't think we need these ...
3964
+ */
3965
+
3966
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
3967
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
3968
+ *
3969
+ * This is closely related to the macro HARD_REGNO_NREGS.  In fact, the value
3970
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
3971
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
3972
+ *
3973
+ * This macro helps control the handling of multiple word values in the reload
3974
+ * pass.
3975
+ *
3976
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
3977
+ * us.  We'll also choose register R0, since ... well, since it simply doesn't
3978
+ * matter.  (HARD_REGNO_NREGS ignores this anyway)
3979
+ */
3980
+#define        CLASS_MAX_NREGS(CLASS, MODE)    HARD_REGNO_NREGS(0,MODE)
3981
+
3982
+/* CANNOT_CHANGE_MODE_CLASS
3983
+ * ???
3984
+ */
3985
+
3986
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
3987
+ */
3988
+
3989
+/* TARRGET_LRA_P
3990
+ * Default looks good.
3991
+ */
3992
+
3993
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
3994 111 dgisselq
+ * priority number to which the register HARD_REGNO belongs to.  The bigger the
3995 102 dgisselq
+ * number
3996
+ *
3997
+ * The default version of this target hook returns always zero---good enough for
3998
+ * the ZipCPU.
3999
+ */
4000
+
4001
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
4002
+ * if we need register usage leveling.  That means if a few hard registers are
4003
+ * equally good for the assignment, we choose the least used hard register.  The
4004
+ * register usage leveling may be profitable for some targets.  Don't use usage
4005
+ * leveling for targets with conditional execution or targets with big register
4006
+ * files as it hurts if-conversion and cross-jumping optimizations.  The default
4007
+ * version of this target hook returns always false.
4008
+ *
4009
+ * ZipCPU --- Default is the right answer.
4010
+ */
4011
+
4012
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
4013
+ * Default looks good.
4014
+ */
4015
+
4016
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
4017
+ * Default looks good.
4018
+ */
4019
+
4020
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
4021
+ */
4022
+
4023
+/* TARGET_SPILL_CLASS
4024
+ *
4025
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
4026
+ * user set of registers.  However, we're not building for that mode (now),
4027
+ * so we'll leave this at the default of NO_REGS.
4028
+ */
4029
+
4030
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
4031
+ * boolean result of conditional store patterns.  The OCIDE argument is the
4032
+ * instruction code for the cstore being performed.  Not defining this hook is
4033
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
4034
+ * patterns.
4035
+ *
4036
+ * ??? ZipCPU --- I don't follow this documentation.  We'll leave this at the
4037
+ * default therefore.
4038
+ */
4039
+
4040
+/* 17.09 Stack Layout and Calling Conventions */
4041
+
4042
+
4043
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
4044
+ * moves the stack pointer to a smaller address, and false otherwise.
4045
+ *
4046
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
4047
+ * magically.  We have to move the stack pointer ourselves.  However, since this
4048
+ * is our convention, we'll define it as such.
4049
+ */
4050
+#undef STACK_GROWS_DOWNWARD
4051
+#define        STACK_GROWS_DOWNWARD    1
4052
+
4053
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
4054
+ * pushed on the stack.  In RTL, a push operation will be
4055
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
4056
+ * PRE_INC, and POST_INC.  Which of these is correct depends on the stack
4057
+ * direction and on whether the stack pointer points to the last item on the
4058
+ * stack or whether it points to the space for the next item on the stack.
4059
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
4060
+ * always right, and PRE_INC otherwise, which is often wrong.
4061
+ *
4062
+ * ZipCPU --- None of these is right, so let's leave this at the default and
4063
+ * see how badly we get mangled.  In particular, ZipCPU doesn't have any of the
4064
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
4065
+ */
4066
+
4067
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
4068
+ * local variable slots are at negative offsets from the frame pointer.
4069
+ *
4070
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
4071 103 dgisselq
+ * start of function execution, and that stack pointer grows downward, then
4072 102 dgisselq
+ * this should be the case as well.
4073
+ */
4074
+#undef FRAME_GROWS_DOWNWARD
4075
+#define        FRAME_GROWS_DOWNWARD    1
4076
+// #define     FRAME_GROWS_DOWNWARD    0        // This was ECO32's value
4077
+
4078
+
4079
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
4080
+ * function occupy decreasing addresses on the stack.
4081
+ *
4082
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
4083
+ * it is of no consequence to the hardware.
4084
+ */
4085
+
4086
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
4087
+ * variable slot to be allocated.  If FRAME_GROWS_DOWNWARD, find the next slot's
4088
+ * offset by subtracting the firstt slot's length from STARTING_FRAME_OFFSET.
4089
+ * Otherwise it is found by adding the length of the first slot to the value
4090
+ * START_FRAME_OFFSET.
4091
+ *
4092
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
4093
+ * the code is getting generated.  However, the ECO32 code I am copying from
4094
+ * suggests that 0 is the right value, so we'll use that here.
4095
+ */
4096
+// #warning "Re-evaluate me"
4097
+#define        STARTING_FRAME_OFFSET   0
4098
+
4099
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
4100
+ * stack during reload.  The nonzero default for this macro is suitable for most
4101
+ * ports.
4102
+ *
4103
+ * ZipCPU --- we'll leave this at the default, although if any alignment code
4104
+ * shows up on the stack we may need to adjust it.
4105
+ */
4106
+
4107
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
4108
+ * which outgoing arguments are placed.  If not specified, the default value
4109
+ * of zero is used.  This is the proper value for most machines.
4110
+ */
4111
+#define        STACK_POINTER_OFFSET    0
4112
+
4113
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
4114
+ * argument's address.  On some machines it may depend on the data type of the
4115
+ * function.
4116
+ */
4117
+#define        FIRST_PARM_OFFSET(F)    0
4118
+
4119
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
4120
+ * dynamically allocated on the stack, e.g., by alloca.  The default value for
4121
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
4122
+ * The default is correct for most machines, ...
4123
+ *
4124
+ * ZipCPU --- so we'll use it for the ZipCPU.
4125
+ */
4126
+
4127
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
4128
+ * the address of the initial stack frame.  This address is passed to
4129
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS.  If you don't define this macro,
4130
+ * a reasonable default value will be used.  Define this macro in order to make
4131
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
4132
+ * and __builtin_return_address(C) for (C) not equal to zero.
4133
+ *
4134
+ * ZipCPU --- Let's try the reasonable default and see what happens.
4135
+ */
4136
+
4137
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
4138
+ * code to setup the stack so that arbitrary frames can be accessed.  For
4139
+ * example, on the SPARC, we must flush all of the register windows to the stack
4140
+ * before we can access arbitrary stack frames.  You will seldom need to define
4141
+ * this macro.  The default is to do nothing.
4142
+ *
4143
+ * ZipCPU --- which is what we shall do here.
4144
+ */
4145
+
4146
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
4147
+ * an RTX that is used to store the address of the current frame into the
4148
+ * builtin setjmp buffer.  The default value, virtual_stack_vars_rtx, is correct
4149
+ * for most machines.  One reason you may need to define this target hook is if
4150
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
4151
+ *
4152
+ * ZipCPU --- leave this undefined, since the default value should be correct
4153
+ * for "most" machines.
4154
+ */
4155
+
4156
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
4157
+ */
4158
+
4159
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
4160
+ * representing the value of the return address for the frame COUNT steps up
4161
+ * from the current frame, after the prologue.  FRAMEADDR is the frame pointer
4162
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
4163
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero.  The value of the expression must
4164
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
4165
+ * there is no way to determine the return address of other frames.
4166
+ *
4167
+ * ZipCPU --- I have no idea how we'd do this, so let's just return NULL_RTX.
4168
+ */
4169
+#undef RETURN_ADDR_RTX
4170
+#define        RETURN_ADDR_RTX(COUNT,FRAMEADDR)        NULL_RTX
4171
+
4172
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
4173
+ * return address of a particular stack frame is accessed from the frame pointer
4174
+ * of the previous stack frame.  The zero default for this macro is suitable
4175
+ * for most ports.
4176
+ *
4177
+ * ZipCPU---Default works here as well.
4178
+ */
4179
+
4180
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
4181
+ * the location of the incoming return address at the beginning of any function,
4182
+ * before the prologue.  This RTL is either a REG, indicating that the return
4183
+ * value is saved in 'REG', or a MEM representing the location in the stack.
4184
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
4185
+ * DWARF_FRAME_REGNUM(REGNO).
4186
+ *
4187
+ * ZipCPU --- While our incoming return address could theoretically be in any
4188
+ * register, our machine description file is going to place it into register
4189
+ * R0, so that's what we return here.
4190
+ */
4191
+#undef INCOMING_RETURN_ADDR_RTX
4192
+#define        INCOMING_RETURN_ADDR_RTX        gen_rtx_REG(SImode, zip_R0)
4193
+
4194
+
4195
+/* DWARF_ALT_FRAME_RETURN_COLUMN
4196
+ */
4197
+
4198
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
4199
+ * register number that is considered to always have the value zero.  This
4200
+ * should only be defined if the target has an architected zero register (ZipCPU
4201
+ * does not), and someone decided it was a good idea to use that register number
4202
+ * to terminate the stack backtrace.  New ports should avoid this (so the
4203
+ * ZipCPU port will avoid it as well).
4204
+ *
4205
+ */
4206
+
4207
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
4208
+ */
4209
+
4210
+/* INCOMING_FRAME_SP_OFFSET
4211
+ */
4212
+#define        INCOMING_FRAME_SP_OFFSET        0
4213
+
4214
+/* ARG_POINTER_CFA_OFFSET
4215
+ */
4216
+
4217
+/* FRAME_POINTER_CFA_OFFSET
4218
+ */
4219
+
4220
+/* CFA_FRAME_BASE_OFFSET
4221
+ */
4222
+
4223
+/* 17.09.02 Exception handling support */
4224
+
4225
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
4226
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
4227
+ * N registers are usable.  The exception handling library routines communicate
4228
+ * with the exception handlers via a set of agreed upon registers.  Ideally
4229
+ * these registers should be call clobbered; it is possible to use call-saved
4230
+ * registers, but may negatively impact code size.  The target must support at
4231
+ * least 2 data registers, but should define 4 if their are enough free
4232
+ * registers.
4233
+ *
4234
+ * You must define this macro if you want to support call frame exception
4235
+ * handling like that provided by DWARF 2.
4236
+ */
4237
+#define        EH_RETURN_DATA_REGNO(N) (((N<ZIP_FIRST_ARG_REGNO)||(N>ZIP_LAST_ARG_REGNO))?(N-1):INVALID_REGNUM)
4238
+
4239
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
4240
+ * a location in which to store a stack adjustment to be applied before function
4241
+ * return.  This is used to unwind the stack to an exception handler's call
4242
+ * frame.  It will be assigned zero on code paths that return normally.
4243
+ *
4244
+ * Do not define this macro if the stack pointer is saved and restored by the
4245
+ * regular prolog and epilog code in the call frame itself (which it is for the
4246
+ * ZipCPU); in this case, the exception handling library routines will update
4247
+ * the stack location to be restored in place.  Otherwise, you must define this
4248
+ * macro if you want to support call frame exception handling like that provided
4249
+ * by DWARF 2.
4250
+ *
4251
+ */
4252
+
4253
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
4254
+ * location in which to store the address of an exception handler to which we
4255
+ * should return.  It will not be assigned on code paths that return normally.
4256
+ *
4257
+ * Typcally this is the location in the call frame at which the normal return
4258
+ * address is stored.  For targets that return by popping an address of the
4259
+ * stack, this might be a memory address just below the target callf rame
4260
+ * rather than inside the current call frame.  If defined,
4261
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
4262
+ * to calculate the location of the target call frame.
4263
+ *
4264
+ * If you want to support call frame exception handling, you must define either
4265
+ * this macro or the eh_return instruction pattern.
4266
+ */
4267
+// #warning "I don't know what to do here."
4268
+
4269
+/*
4270
+ *
4271
+ *
4272
+ *
4273
+ *   REST OF SECTION SKIPPED ...
4274
+ *
4275
+ *
4276
+ *
4277
+ */
4278
+
4279
+/* 17.09.03 Specifying how stack checking is done */
4280
+
4281
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
4282
+ * configuration files in a machine-dependent manner.  You should define this
4283
+ * macro if stack checking is required by the ABI of your machine or if you
4284
+ * would like to do stack checking in some more efficient way than the generic
4285
+ * appraoch.  The default value of this macro is zero.
4286
+ *
4287
+ * ZipCPU --- The default makes sense for us.
4288
+ */
4289
+// #define STACK_CHECK_BUILTIN 0
4290
+
4291
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
4292
+ * done by the configuration files in a machine-dependent manner.  You should
4293
+ * define this macro if you would like to do static stack checking in some more
4294
+ * efficient way than the generic approach.  The default value of this macro
4295
+ * is zero.
4296
+ *
4297
+ * ZipCPU --- The default makes sense for us.
4298
+ */
4299
+
4300
+/* STACK_CHECK_PROBE_INTERVAL_EXP ...  An integer specifying the interval at
4301
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
4302
+ * interval.  You will normally define this macro so that the interval is no
4303
+ * larger than the size of the "guard pages" at the end of a stack area.  The
4304
+ * default value of 12 (4096-byte interval) is suitable for most systems.
4305
+ *
4306
+ * ZipCPU --- Default.
4307
+ */
4308
+
4309
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
4310
+ * the stack pointer page by page when doing probes.  This can be necessary
4311
+ * on systems where the stack pointer contains the bottom address of the memory
4312
+ * area accessible to the executing thread at any point in time.  In this
4313
+ * situation, an alternate signal stack is required in order to be able to
4314
+ * recover from a stack overflow.  The default value of this macro is zero.
4315
+ *
4316
+ * ZipCPU -- Default.
4317
+ */
4318
+
4319
+/* STACK_CHECK_PROTECT
4320
+ */
4321
+/* STACK_CHECK_MAX_FRAME_SIZE
4322
+ * ... you should normally not change the default value of this macro.
4323
+ */
4324
+/* STACK_CHECK_FIXED_FRAME_SIZE
4325
+ * ... you ... will normally use the default of four words.
4326
+ */
4327
+
4328
+/* STACK_CHECK_MAX_VAR_SIZE
4329
+ * ... you will normally not need to override that default.
4330
+ */
4331
+
4332
+/* 17.09.04 Registers that Address the Stack Frame*/
4333
+
4334
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
4335
+ * which must also be a fixed register according to FIXED_REGISTERS.  On most
4336
+ * machines, the hardware determines which register this is.
4337
+ */
4338
+#undef STACK_POINTER_REGNUM
4339
+#define        STACK_POINTER_REGNUM    zip_SP
4340
+
4341
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
4342
+ * which is used to access certain automatic variables in the stack frame.  On
4343
+ * some machines, the hardware determines which register this is.  On other
4344
+ * machines you can choose any register you wish for this purpose.
4345
+ *
4346
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
4347
+ * a need for it, alloca() requires it.  Therefore let's assine a register to
4348
+ * this purpose and watch what the compiler does with it.
4349
+ */
4350 103 dgisselq
+#ifdef zip_FP_PSEUDO
4351
+#define        FRAME_POINTER_REGNUM    zip_FP_PSEUDO
4352
+#else
4353 102 dgisselq
+#define        FRAME_POINTER_REGNUM    zip_FP
4354 103 dgisselq
+#endif
4355 102 dgisselq
+
4356
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
4357
+ * pointer and starting offset of the automatic variables is not known until
4358
+ * after register allocation has been done (for example, because the saved
4359
+ * registers are between these two locations).  On those machines, define
4360
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
4361
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
4362
+ * to be the actual hard register number used for the frame pointer.
4363
+ *
4364
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
4365
+ *
4366
+ * ZipCPU --- we do not define this macro.
4367
+ */
4368 103 dgisselq
+#if (zip_FP == FRAME_POINTER_REGNUM)
4369
+#define HARD_FRAME_POINTER_REGNUM      zip_FP
4370
+#endif
4371 102 dgisselq
+
4372
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
4373
+ * is used to access the function's argument list.  On some machines, this is
4374
+ * the same as the frame pointer register.  On some machines, the hardware
4375
+ * determines which register this is.  On other machines, you can choose any
4376
+ * register you wish for this purpose.  If this is not the same register as the
4377
+ * frame pointer register, then you must mark it as a fixed register according
4378
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
4379
+ *
4380
+ * ZipCPU --- We really don't want to lose another register to something
4381
+ * pointless, so let's set this to be the frame pointer register.  Especially
4382
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
4383
+ * should work for a rather large stack frame.
4384
+ */
4385 103 dgisselq
+#define ARG_POINTER_REGNUM     FRAME_POINTER_REGNUM
4386 102 dgisselq
+
4387
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
4388
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
4389
+ * should be the same.  The default definition is sufficient for us.
4390
+ */
4391
+
4392
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
4393
+ * ZipCPU doesn't need this macro
4394
+ */
4395
+
4396
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
4397
+ * pointer register, which is used to access the current function's return
4398
+ * address from the stack.  On some machines, the return address is not at a
4399
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
4400
+ * This register can be defined to point to the return address on the stack, and
4401
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
4402
+ * stack pointer.
4403
+ *
4404
+ * Do not define this macro unless there is no other way to get the return
4405
+ * address from the stack.
4406
+ *
4407
+ * ZipCPU---we need this.
4408
+ */
4409
+#define        RETURN_ADDRESS_REGNUM   zip_R0
4410
+
4411
+
4412
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
4413
+ * static chain pointer.  If register windows are used, the register number as
4414
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
4415
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM.  If
4416
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
4417
+ * defined.
4418
+ *
4419
+ * ZipCPU doesn't have register windows, so we don't need to define this.
4420
+ */
4421
+// #warning "I have no reason to believe this will even work"
4422
+#define        STATIC_CHAIN_REGNUM     zip_GOT
4423
+
4424
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
4425
+ * al for targets that may use different static chain locations for different
4426
+ * nested functions.  This may be required if the target has function attributes
4427
+ * that affect the calling conventions of the function and those calling
4428
+ * conventions use different static chain locations.
4429
+ *
4430
+ * ZipCPU --- don't need this.
4431
+ */
4432
+// #define     STATIC_CHAIN_REGNUM     zip_R11
4433
+
4434
+
4435
+/* DWARF_FRAME_REGISTERS ... This macro specifies  the maximum number of hard
4436
+ * registers that can be saved in a call frame.  This is used to size data
4437
+ * structures used in DWARF2 exception handling.
4438
+ *
4439
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
4440
+ * exception handling ABI in the face of adding new hard registers for ISA
4441
+ * extensions.  In GCC 3.0 and later, the EH ABI is insulated from changes in
4442
+ * the number of hard registers.  Nevertheless, this macro can still be used to
4443
+ * reduce the runtime memory requirements of the exception handling routines,
4444
+ * which can be substantial if the ISA contains a lot of registers that are not
4445
+ * call-saved.
4446
+ *
4447
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
4448
+ *
4449
+ * ZipCPU --- The default is not sufficient.  The CC and PC registers need to
4450
+ * be saved and examined as well in any debug/exception context.  Hence, we
4451
+ * define this to be all of our registers.
4452
+ */
4453
+#undef DWARF_FRAME_REGISTERS
4454
+#define        DWARF_FRAME_REGISTERS   16
4455
+
4456
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
4457
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
4458
+ *
4459
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
4460
+ * the ZipCPU.
4461
+ */
4462
+
4463
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
4464
+ * representation for dwarf registers is different than the internal
4465
+ * representation for unwind column.  Given a dwarf register, this macro should
4466
+ * return the unwind column number to use instead.
4467
+ *
4468
+ * ... ???
4469
+ */
4470
+
4471
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
4472
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
4473
+ * different from that used in other debug info sections.  Given a GCC hard
4474
+ * register number, this macro should return the .eh_frame register number.
4475
+ * The default is DBX_REGISTER_NUMBER(REGNO).
4476
+ *
4477
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
4478
+ * should still work for us.
4479
+ */
4480
+
4481
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
4482
+ * numbers held in the call frame info that GCC has collected using
4483
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
4484
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
4485
+ *
4486
+ * ZipCPU --- Default is good enough.
4487
+ */
4488
+
4489
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
4490
+ * register values as _Unwind_Word type in unwind context.  It should be defined
4491
+ * if target register size is larger than the size of void *.  The default
4492
+ * is to store register values as void *type.
4493
+ *
4494
+ * ZipCPU --- Default is what we need.
4495
+ */
4496
+
4497
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
4498
+ * always uses extended unwind context with version, args_size, and by_value
4499
+ * fields.  If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
4500
+ *
4501
+ */
4502
+
4503
+
4504
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
4505
+
4506
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
4507
+ * if a function must have and use a frame pointer.  This target hook is
4508
+ * called in the reload pass.  If its return value is true, the function will
4509
+ * have a frame pointer.
4510
+ *
4511
+ * This target hook can in principle examine the current function and decide
4512
+ * according to the facts, but on most machines the constant false or the
4513
+ * constant true suffices.  Use false when the machine allows code to be
4514
+ * generated with no frame pointer, and doing so saves some time or space.
4515
+ * Use true when there is no possible advantage to avoiding a frame pointer.
4516
+ *
4517
+ * ZipCPU---if we add in a frame pointer, we become register starved.  Hence,
4518
+ * we'll treat this as a constant false--which is also the default value.
4519
+ */
4520
+#define        target_frame_pointer_required   zip_frame_pointer_required
4521
+
4522
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
4523
+ * depth-var the difference between the frame pointer and the stack pointer
4524
+ * values immediately after the function prologue.  The value would be computed
4525
+ * from information such as the result of get_frame_size() and the tables of
4526
+ * registers regs_ever_live and call_used_regs.
4527
+ *
4528
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
4529
+ * defined.  Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
4530
+ * always returns true; in that case you may set depth-var to anything.
4531
+ *
4532
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
4533
+ */
4534
+// #define     INITIAL_FRAME_POINTER_OFFSET(DEPTH)     (DEPTH) = 0
4535
+
4536
+
4537
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
4538
+ * pairs used to eliminate unneeded registers that point into the stack frame.
4539
+ * If it is not defined, the only elimination attempted by the compiler is to
4540
+ * replace references to the frame pointer with references to the stack pointer.
4541
+ *
4542
+ * On some machines, the position of the argument pointer is not known until
4543
+ * the compilation is completed.  In such a case, a separate hard register
4544
+ * must be used for the argument pointer.  This register can be eliminated by
4545
+ * replacing it with either the frame pointer or the argument pointer,
4546
+ * depending on whether or not the frame pointer has been eliminated.
4547
+ *
4548
+ * ZipCPU we'll take their suggestion and define this as:
4549
+ */
4550
+#undef ELIMINABLE_REGS
4551 103 dgisselq
+#ifdef zip_FP_PSEUDO
4552 102 dgisselq
+#define        ELIMINABLE_REGS \
4553 103 dgisselq
+        {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},          \
4554
+         { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},     \
4555
+         { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
4556
+         { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
4557
+#else
4558
+# if (ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)
4559
+#  define      ELIMINABLE_REGS \
4560
+        {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4561
+# else
4562
+#  define      ELIMINABLE_REGS \
4563 102 dgisselq
+       {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },  \
4564
+        { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },  \
4565
+        { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4566 103 dgisselq
+# endif
4567
+#endif
4568 102 dgisselq
+
4569
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
4570
+ * true if the compiler is allowed to try to replace register number FROM with
4571
+ * register number TO.  This target hook need only be defined if ELIMINABLE_REGS
4572
+ * is defined, and will usually return true since most of the cases preventing
4573
+ * register elimination are things that the compiler  already knows about.
4574
+ *
4575
+ * ZipCPU ... does the compiler  know about my decision as to whether or not
4576 117 dgisselq
+ * the frame pointer was needed?  Yes it does, but it's kept separately.  We'll
4577
+ * just say everything can be eliminated.
4578 102 dgisselq
+ */
4579
+#define TARGET_CAN_ELIMINATE   zip_can_eliminate
4580
+
4581
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
4582
+ * INITIAL_FRAME_POINTER_OFFSET.  It specifies the initial difference between
4583
+ * the specified pair of registers.  This macro must be defined if
4584
+ * ELIMINABLE_REGS is defined.
4585
+ *
4586 117 dgisselq
+ * ZipCPU---We had at one time set this to a default offset of 0.  This didn't
4587
+ * work.  It turns out that this is not only the *initial* elimination offset,
4588
+ * but also the offset along the way.  Hence, when a variable needs to be
4589
+ * spilled to the stack, this offset must change.  Reload goes and checks for
4590
+ * this, and adjusts registers if the offset has changed.  Hence, without this,
4591
+ * we get negative (i.e. illegal) stack offsets.
4592 102 dgisselq
+ */
4593
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
4594
+       do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
4595
+       while(0)                                        \
4596
+
4597
+/* 17.09.06 Passing function arguments on the stack */
4598
+
4599
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
4600
+ * prototype as an integral type smaller than int should actually be
4601
+ * passed as an int.  In addition to avoiding errors in certain cases of
4602
+ * mismatch, it also makes for better code on certain machines.  The default is
4603
+ * to not promote prototypes.
4604
+ *
4605
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
4606
+ * (which should still be an int) up to an int anyway.
4607
+ */
4608
+#undef TARGET_PROMOTE_PROTOTYPES
4609
+#define        TARGET_PROMOTE_PROTOTYPES       hook_bool_const_tree_true
4610
+
4611
+/* PUSH_ARGS ... A C expression.  If nonzero, push instructions will be used to
4612
+ * pass outgoing arguments.  If the target machine does not have a push
4613
+ * instruction, set it to zero.  That directs GCC to use an alternate strategy:
4614
+ * to allocate the entire argument block and then store the arguments into it.
4615
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
4616
+ *
4617
+ * ZipCPU does not have a push instruction, so we set this to zero.
4618
+ */
4619
+#undef PUSH_ARGS
4620
+#define        PUSH_ARGS       0
4621
+
4622
+/* PUSH_ARGS_REVERSED ... A C expression.  If nonzero, function arguments will
4623
+ * be evaluated last to first, rather than first to last.  If this macro is
4624
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
4625
+ * grow in opposite directions, and zero otherwise.
4626
+ *
4627
+ * ZipCPU---Let's evaluate our arguments first to last.
4628
+ */
4629
+#define        PUSH_ARGS_REVERSED      1
4630
+
4631
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
4632
+ * actually pushed onto the stack when an instruction attempts to push
4633
+ * (NPUSHED) bytes.
4634
+ *
4635
+ * ZipCPU---We cannot push bytes.  Let's leave this undefined and see what
4636
+ * happens.
4637
+ */
4638
+// #warning "No appropriate definition seemed right."
4639
+
4640
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression.  If non-zero, the maximum amount
4641
+ * of space required for outgoing arguments will be computed and placed into
4642
+ * 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
4643
+ * amount.
4644
+ *
4645
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
4646
+ * each time we try to call a function/routine.  Yes, we want and *need* this
4647
+ * for good performance.  I mean, think of it, free performance increase?  Who
4648
+ * could argue with that?
4649
+ */
4650
+#undef ACCUMULATE_OUTGOING_ARGS
4651
+#define        ACCUMULATE_OUTGOING_ARGS        1
4652
+
4653
+
4654
+/* REG_PARM_STACK_SPACCE(FN) ... Define this macro if functions should assume
4655
+ * that stack space has been allocated for arguments even when their values
4656
+ * are passed in registers.  The value of this macro is the size, in bytes, of
4657
+ * the area reserved for arguments passed in registers for the function
4658
+ * represented by FN, which can be zero if GCC is calling a library function.
4659
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
4660
+ *
4661
+ * This space can be allocated by the caller, or be part of the machine
4662
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
4663
+ *
4664
+ * ZipCPU --- Why allocate space you won't use?  Let's leave this undefined
4665
+ * therefore.
4666
+ */
4667
+// #undef      REG_PARM_STACK_SPACE
4668
+
4669
+
4670
+
4671
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
4672
+ * incoming register arguments.  Define this macro if space guaranteed when
4673
+ * compiling a function body is different to space required when making a call,
4674
+ * a situation that can arise with K&R style function definitions.
4675
+ *
4676
+ */
4677
+
4678
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
4679
+ * is the responsibility of the caller to allocate the area reserved for
4680
+ * arguments passed in registers when calling a function of FN.  FN may be NULL
4681
+ * if the function called is a library function.
4682
+ *
4683
+ * ZipCPU---Why allocate space you don't need?
4684
+ */
4685
+#define        OUTGOING_REG_PARM_STACK_SPACE(FNTYPE)   0
4686
+
4687
+
4688
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
4689
+ * is defined, buyt the stack parameters don't skip the area specified by it.
4690
+ *
4691
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
4692
+ */
4693
+
4694
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
4695
+ * number of bytes of its own arguments that a function pops on returning, or 0
4696
+ * if the function pops no arguments and the caller must therefore pop them all
4697
+ * after the function returns.
4698
+ *
4699
+ * ZipCPU --- If we define this, we'll lose our gain from
4700
+ * ACCUMULATE_OUTOING_ARGS.  Thus, we leave this undefined.
4701
+ */
4702
+
4703
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
4704
+ * bytes a call sequence pops off of the stack.  It is added to the value of
4705
+ * RETURN_POPS_ARGS when compiling a function call.  CUM is the variable in
4706
+ * which all arguments to the function have been accumulated.
4707
+ *
4708
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack.  Therefore
4709
+ * this is zero.
4710
+ */
4711
+#undef CALL_POPS_ARGS
4712
+#define        CALL_POPS_ARGS(CUM)     0
4713
+
4714
+
4715
+/* 17.09.07 Passing arguments in registers */
4716
+
4717
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
4718
+ * is passed in a register, and if so, which register.
4719
+ */
4720
+/*
4721
+ * This has been poisoned ... so let's not define it anymore and look for
4722
+ * a better way to do this ...
4723
+ *
4724
+ * #define     FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
4725
+ *     : targetm.calls.must_pass_in_stack(MODE, TYPE)  ? NULL_RTX
4726
+ *     : (CUM) > ZIP_LAST_ARG_REGNO                    ? NULL_RTX
4727
+ *     : gen_rtx_REG(MODE, CUM))
4728
+ */
4729
+#define        TARGET_FUNCTION_ARG     zip_function_arg
4730
+
4731
+
4732
+/* TARGET_MUST_PASS_IN_STACK ...
4733
+ */
4734
+// #undef      TARGET_MUST_PASS_IN_STACK
4735
+// #define     TARGET_MUST_PASS_IN_STACK       zip_must_pass_in_stack
4736
+
4737
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
4738
+ * has register windows, ... which ZipCPU does not have.
4739
+ */
4740
+
4741
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
4742
+ * pseudo register should be created for pic_offset_table_rtx during function
4743
+ * expand.
4744
+ *
4745
+ * This should be defined by global parameters, isn't it?
4746
+ */
4747
+
4748
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
4749
+ * pic_offset_table_rtx.  This hook is called at the start of register
4750
+ * allocation.
4751
+ *
4752
+ * ZipCPU---Let's revisit this.
4753
+ */
4754
+// #warning "Come back and relook at relocations"
4755
+
4756
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
4757
+ * at the beginning of an argument that must be put in registers.  The value
4758
+ * must be zero for arguments that are passed entirely in registers or that
4759
+ * are entirely pushed on the stack.
4760
+ */
4761
+// #undef      TARGET_ARG_PARTIAL_BYTES
4762
+// #define     TARGET_ARG_PARTIAL_BYTES        zip_arg_partial_bytes
4763
+
4764
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
4765
+ * return true if an argument at the position indicated by CUM should be passed
4766
+ * by reference.  This predicate is queried after target independent reasons
4767
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
4768
+ *
4769
+ */
4770
+// #undef      TARGET_PASS_BY_REFERENCE
4771
+// #define     TARGET_PASS_BY_REFERENCE        zip_pass_by_reference
4772
+
4773
+/* CUMULATIVE ARGS ...  A C type for declaring a variable that is used as the
4774
+ * first argument of 'FUNCTION_ARG' and other related values.
4775
+ *
4776
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
4777
+ */
4778
+#define        CUMULATIVE_ARGS int
4779
+
4780
+/*
4781
+ * OVERRIDE_ABI_FORMAT
4782
+ */
4783
+
4784
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
4785
+ * variable CUM for the state at the beginning of the argument list.
4786
+ *
4787
+ *
4788
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
4789
+ * R1 (unless it has been redefined above ...)
4790
+ */
4791
+#define        INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
4792
+
4793
+/* INIT_CUMULATIVE_LIBCALL_ARGS
4794
+ * INIT_CUMULATIVE_INCOMING_ARGS
4795
+ *
4796
+ * These default to the last INIT_CUM_ARGS value above.
4797
+ */
4798
+
4799
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
4800
+ * the summarizer variable pointed to by CUM to advance past an argument in
4801
+ * the argument list.  The values MODE, TYPE, and NAMED describe that
4802
+ * argument.  Once this is done, the variable CUM is suitable for analyzing the
4803
+ * following argument with TARGET_FUNCTION_ARG, etc.  This hook need not do
4804
+ * anything if the argument in question was passed on the stack.  The compiler
4805
+ * knows how to track the amount of stack space used for arguments without
4806
+ * any special help.
4807
+ *
4808
+ * ZipCPU---Here we simply copy from ECO32.
4809
+ */
4810
+#define        TARGET_FUNCTION_ARG_ADVANCE     zip_function_arg_advance
4811
+
4812
+/*
4813
+ * TARGET_ARG_OFFSET --- not necessary
4814
+ * FUNCTION_ARG_PADDING        --- not necessary, since we shouldn't be padding
4815
+ * PAD_VARARGS_DOWN    --- not necessary, since we shouldn't be padding
4816
+ * BLOCK_REG_PADDING
4817
+ * TARGET_FUNCTION_ARG_BOUNDARY
4818
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
4819
+ */
4820
+
4821
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
4822
+ * the number of a hard register in which function arguments are sometimes
4823
+ * passed.  This does not include implicit arguments such as the static chain
4824
+ * and the structure-value address.  On many machines, no registers can be used
4825
+ * for this purpose since all function arguments are pushed on the stack.
4826
+ */
4827
+#define        FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
4828
+
4829
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
4830
+ * of type TYPE are passed as two scalar parameters.  By default, GCC will
4831
+ * attempt to pack complex arguments into the target's word size.  Some ABI's
4832
+ * require complex arguments to be split and treated as their individual
4833
+ * components.
4834
+ *
4835
+ * The default value of this hook is NULL, which is treated as always false,
4836
+ * and which should be good enough for ZipCPU--which can go either way.
4837
+ */
4838
+
4839
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
4840
+ * for the target.  The default version of the hook returns void*.
4841
+ *
4842
+ */
4843
+
4844
+/* TARGET_ENUM_VA_LIST_P
4845
+ */
4846
+
4847
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
4848
+ * convention specified by FN.  The default version of this returns va_list_type_node.
4849
+ */
4850
+
4851
+/* TARGET_FN_ABI_VA_LIST
4852
+ */
4853
+
4854
+/* TARGET_CANONICAL_VA_LIST_TYPE
4855
+ */
4856
+
4857
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
4858
+ */
4859
+
4860
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
4861
+ * port can handle pointers with machine mode MODE.  The default version of this
4862
+ * hook returns true for both ptr_mode and Pmode.
4863
+ *
4864
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
4865
+ * default behavior is quite appropriate.
4866
+ */
4867
+
4868
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
4869
+ * memory reference REF may alias with the system C library errno location.
4870
+ * The default version of this hook assumes the system C library errno location
4871
+ * is either a declaration of type int or accessed by dereferencing a pointer
4872
+ * to int.
4873
+ *
4874
+ * ZipCPU --- Default sounds good to me.
4875
+ */
4876
+
4877
+
4878
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
4879
+ * the port is prepared to handl instructions involving scalar mode MODE.  For
4880
+ * a scalar mode to be considered supported, all the basic arithmetic and
4881
+ * comparisons must work.
4882
+ *
4883
+ * The default version of this hook returns true for any mode required to
4884
+ * handle the basic C types (as defined by the port).  Included here are the
4885
+ * double-word arithmetic supported by the code in optabs.c.
4886
+ */
4887
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
4888
+#define        TARGET_SCALAR_MODE_SUPPORTED_P  zip_scalar_mode_supported_p
4889
+
4890
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
4891
+ * port is prepared to handle instructions involving vector mode MODE.  At the
4892
+ * very least, it must have move patterns for this mode.
4893
+ *
4894
+ * ZipCPU---does not support any vector modes.
4895
+ */
4896
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
4897
+#define        TARGET_VECTOR_MODE_SUPPORTED_P  hook_bool_mode_false
4898
+
4899
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
4900
+ * try to use a scalar mode to store an array of NELEMS elements, given that
4901
+ * each element has mode MODE.  Returning true here overrides the usual MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
4902
+ *
4903
+ * ZipCPU---Sounds good.
4904
+ */
4905
+// #undef      TARGET_ARRAY_MODE_SUPPORTED_P
4906
+// #define     TARGET_ARRAY_MODE_SUPPORTED_P   zip_array_mode_supported_p
4907
+
4908
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
4909
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
4910
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P.  The default version of this
4911
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
4912
+ * modes exist.
4913
+ *
4914
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
4915
+ * (if we can).  Let's allow both of those and see how far we get.
4916
+ */
4917
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
4918
+#define        TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
4919
+
4920
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
4921
+ * nonzero for machine modes for which the port has small register classes.  If
4922
+ * target hook returns nonzero for a given MODE, the compiler will try to
4923
+ * minimize the lifetime of registers in MODE.  The hook may be called with
4924
+ * VOIDmode as an argument.  In this case, the hook is expected to return
4925
+ * nonzero if it returns nonzero for any mode.
4926
+ *
4927
+ * The default version of this hook returns false for any mode.
4928
+ *
4929
+ * ZipCPU---Default sounds good.
4930
+ */
4931
+
4932
+/* 17.09.08 How scalar function values are returned */
4933
+
4934
+/* TARGET_FUNCTION_VALUE
4935
+ */
4936
+
4937
+/* LIBCALL_VALUE
4938
+ */
4939
+
4940
+
4941
+/* 17.09.09 How large values are returned */
4942
+
4943
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
4944
+ * nonzero value to say to return the function value in memory, just as large
4945
+ * structures are always returned.  Here type will be the data type of the value
4946
+ * and FNTYP will be the type of the function doing the returning, or NULL
4947
+ * for libcalls.
4948
+ *
4949
+ */
4950
+#undef TARGET_RETURN_IN_MEMORY
4951
+#define        TARGET_RETURN_IN_MEMORY zip_return_in_memory
4952
+
4953
+/* DEFAULT_PCC_STRUCT_RETURN
4954
+ * TARGET_STRUCT_VALUE_RTX
4955
+ * PCC_STATIC_STRUCT_RETURN
4956
+ * TARGET_GET_RAW_RESULT_MODE
4957
+ * TARGET_GET_RAW_ARG_MODE
4958
+ */
4959
+
4960
+
4961
+/* 17.09.10 Caller-Saves Register Allocation */
4962
+/* 17.09.11 Function Entry and Exit */
4963 111 dgisselq
+// TARGET_ASM_FUNCTION_PROLOGUE
4964
+// TARGET_ASM_FUNCTION_END_PROLOGUE
4965
+// TARGET_ASM_FUNCCTION_BEGIN_EPILOGUE
4966
+// TARGET_ASM_FUNCTION_EPILOGUE
4967
+/* EXIT_IGNORE_STACK ... Define this macro as a C expression that is nonzero
4968
+ * if the return instruction or the function epilogue ignores the value of the
4969
+ * stack pointer; in other words, if it is safe to delete an instruction to
4970
+ * adjust the stack pointer before a return from the function.
4971
+ *
4972
+ * The default is 0.
4973
+ *
4974
+ * Note that this macro's value is relevant only for functions for which frame
4975
+ * pointers are maintained.  It is never safe to delete a final stack adjustment
4976
+ * in a function that has no frame pointer, and the compiler knows this
4977
+ * regardless of EXIT_IGNORE_STACK.
4978
+ *
4979
+ * ZipCPU -- Thanks to the example of the m68k, and a careful selection of what
4980
+ * our options otherwise could have been, our epilogue code does not use the
4981
+ * stack register at all, but rather starts by moving the frame register into
4982
+ * the stack register.
4983
+ */
4984
+#define EXIT_IGNORE_STACK      1
4985
+// EPILOGUE_USES(regno)
4986
+// EH_USES(regno)
4987
+// TARGET_ASM_OUTPUT_MI_THUNK
4988
+// TARGET_ASM_CAN_OUTPUT_MI_THUNK
4989
+
4990 102 dgisselq
+/* 17.09.12 Generating code for profiling */
4991 111 dgisselq
+// FUNCTION_PROFILER
4992
+// PROFILE_HOOK
4993
+// NO_PROFILE_COUNTERS
4994
+// PROFILE_BEFORE_PROLOGUE
4995
+// TARGET_KEEP_LEAF_WHEN_PROFILED
4996
+
4997 102 dgisselq
+/* 17.09.13 Permitting tail calls*/
4998 111 dgisselq
+
4999
+/* TARGET_FUNCTION_OK_FOR_SIBCALL(DECL,EXP) ... True if it is OK to do sibling
5000
+ * call optimizations for the specified call expression EXP.  DECL will be the
5001
+ * called function, or NULL if this is an indirect call.
5002
+ *
5003
+ * It is not uncommon for limitations of calling conventions to prevent tail
5004
+ * calls to functions outside the current unit of translation, or during PIC
5005
+ * compilation.  The hook is used to enforce these restrictions, as the sibcall
5006
+ * md pattern can not fail, or fall over to a 'normal' call.  The criteria for
5007
+ * successful sibling call optimization may vary greatly between different
5008
+ * architectures.
5009
+ *
5010
+ * ?? What's a sibling call?
5011
+ */
5012
+
5013
+// TARGET_EXTRA_LIVE_ON_ENTRY
5014
+// TARGET_SET_UP_BY_PROLOGUE
5015
+// TARGET_WARN_FUNC_RETURN
5016
+
5017 102 dgisselq
+/* 17.09.14 Stack smashing protection */
5018 111 dgisselq
+// TARGET_STACK_PROTECT_GUARD
5019
+// TARGET_STACK_PROTECT_FAIL
5020
+// TARGET_SUPPORTS_SPLIT_STACK
5021
+
5022 102 dgisselq
+/* 17.09.15 Miscellaneous register hooks */
5023
+
5024 111 dgisselq
+// TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5025
+
5026 102 dgisselq
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5027
+ * ZipCPU --- default is good enough for us.
5028
+ */
5029
+
5030
+/* 17.10 Implementing VARARGS MACROS */
5031
+
5032
+/* ...
5033
+ */
5034
+
5035
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
5036
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
5037
+ * _BUILTIN_SAVEREGS.  Use it to store the anonymous register arguments into the
5038
+ * stack so that all the arguments appear to have been passed consecutively
5039
+ * on the stack.  Once this is done, you can use the standard implementation
5040
+ * of varargs that works for machines that pass all their arguments on the
5041
+ * stack.
5042
+ */
5043
+// #undef      TARGET_SETUP_INCOMING_VARARGS
5044
+// #define     TARGET_SETUP_INCOMING_VARARGS   zip_setup_incoming_varargs
5045
+
5046
+/* ...
5047
+ */
5048
+
5049
+/* 17.11 Trampolines for Nested Functions */
5050
+
5051
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
5052
+ * assemble_trampoline_template to output, on the stream f, assembler code for
5053
+ * a block of data that contains the constant parts of a trampoline.  This code
5054
+ * should not include a label--the label is taken care of automatically.
5055
+ *
5056
+ * ZipCPU -- looks like we need to do this.
5057
+ */
5058
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
5059
+#define        TARGET_ASM_TRAMPOLINE_TEMPLATE  zip_asm_trampoline_template
5060
+
5061
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
5062
+ * is to be placed.  The default value is readonly_data_section.
5063
+ *
5064
+ * ZipCPU--default should be good enough.
5065
+ */
5066
+
5067
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
5068
+ * as an integer.
5069
+ *
5070
+ * ZipCPU--it's three instructions, or 96 bits.  However, 32-bits is our minimal
5071
+ * addressible unit, so what size do we offer here?  We'll stick with the number
5072
+ * of bytes, but we may need to change this later.
5073
+ *
5074
+ */
5075
+// #warning "May need to redefine trampoline_size in words, not bytes"
5076
+#undef TRAMPOLINE_SIZE
5077
+#define        TRAMPOLINE_SIZE 3
5078
+
5079
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
5080
+ *
5081
+ * Well that's well known in ZipCPU --- 32-bits.
5082
+ */
5083
+#undef TRAMPOLINE_ALIGNMENT
5084
+#define        TRAMPOLINE_ALIGNMENT    32
5085
+
5086
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
5087
+ * initialize a trampoline.  m_tramp is an RTX for the memory block for the
5088
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion;  CH is an
5089
+ * rtx for the static chain value that should be passed to the function when
5090
+ * it is called.
5091
+ *
5092
+ * ZipCPU ... Can we get by without this?
5093
+ */
5094
+#undef TARGET_TRAMPOLINE_INIT
5095
+#define        TARGET_TRAMPOLINE_INIT  zip_trampoline_init
5096
+
5097
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
5098
+ * machine-specific adjustment in the address of the trampoline.  Its argument
5099
+ * contains the address of the memory block that was passed to
5100
+ * TARGET_TRAMPOLINE_INIT.  In case the address to be used for a function call
5101
+ * should be different from the address at which the template was stored, the
5102
+ * different address should be returned; otherwise addr should be returned
5103
+ * unchanged.  If the hook is not defined, RTX (addr) will be used for function
5104
+ * calls.
5105
+ *
5106
+ * ZipCPU--works for us!
5107
+ */
5108
+
5109
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
5110
+ * the instruction cache in the specified interval.  The definition of this
5111
+ * macro would typically be a series of asm statements.   Both BEG and END are
5112
+ * pointer expressions.
5113
+ *
5114
+ * ZipCPU --- Ouch!  We have no way to do this (yet)!
5115
+ */
5116
+
5117
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
5118 111 dgisselq
+ * subroutine to do their work.  The macro should expand to a series of asm
5119 102 dgisselq
+ * statements which will be compiled with GCC.  They go in a library function
5120
+ * named __transfer_from_trampoline.
5121
+ *
5122
+ * We may need to rethink trampolines on ZipCPU.
5123
+ */
5124
+
5125
+
5126
+/* 17.12 Implicit Calls to Library Routines */
5127
+
5128
+/* DECLARE_LIBRARY_RENAMES
5129
+ *
5130
+ * ZipCPU: Don't need it.
5131
+ */
5132
+
5133
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
5134
+ * routines or rename existing ones, using the functions set_optab_libfunc and
5135
+ * init_one_libfunc defined in optabs.c.  init_optabs calls this macro after
5136
+ * initializing all the normal library routines.
5137
+ *
5138
+ * Most ports don't need to define this hook, so we won't either.
5139
+ */
5140
+
5141
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
5142
+ * routines start with two underscores.  If set to true, these routines start
5143
+ * with __gnu_ instead.
5144
+ *
5145
+ * ZipCPU: No change necessary.
5146
+ */
5147
+
5148
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
5149
+ * true if the library routine that implements the floating point comparison
5150
+ * operator comparison in mode mode will return a boolean and false if it will
5151
+ * return a tristate.
5152
+ *
5153
+ * Most ports don't need to define this macro, so Zip CPU won't either.
5154
+ */
5155
+
5156
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
5157
+ * hardware divide instructions.  If this macro is defined, GCC will use an
5158
+ * algorithm which makes use of simple logical and arithmetic operations for
5159
+ * 64-bit division.  If the macro is not defined, GCC will use an algorithm
5160
+ * which makes use of a 64-bit by 32-bit divide primitive.
5161
+ *
5162
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
5163
+ * we have no HW DIVIDE (for now).
5164
+ */
5165
+#define        TARGET_HAS_NO_HW_DIVIDE
5166
+
5167
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
5168
+ * expression.  If you don't define this macro, GCC does not attempt to deposit
5169
+ * the value of EDOM into errno directly.  Look in /usr/include/errno.h to find
5170
+ * the value of EDOM on your system.
5171
+ *
5172
+ * EDOM is the error created when a math argument is out of the domain of the
5173
+ * function.
5174
+ *
5175
+ * ZipCPU: Don't need it---I don't think.
5176
+ */
5177
+
5178
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
5179
+ * expression that refers to the global "variable" errno.  (On certain
5180
+ * systems, errno may not actually be a variable.)  If you don't define this
5181
+ * macro, a reasonable default is used.
5182
+ *
5183
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
5184
+ * I doubt we'll be using errno for a while.
5185
+ */
5186
+
5187
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
5188
+ * message sending conventions by default.  This calling convention involves
5189
+ * passing the object, the selector and the method arguments all at once to the
5190
+ * method-lookup library function.  This is the usual setting when targetting
5191
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
5192
+ *
5193
+ * If the macro is set to 0, ...
5194
+ *
5195
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
5196
+ * an O/S yet.
5197
+ */
5198
+
5199
+
5200
+
5201
+/* 17.13 Addressing Modes */
5202
+
5203
+/* C expressions that are nonzero if the machine supports pre-increment,
5204
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
5205
+ */
5206
+#define        HAVE_PRE_INCREMENT      (0)
5207
+#define        HAVE_PRE_DECREMENT      (0)
5208
+#define        HAVE_POST_INCREMENT     (0)
5209
+#define        HAVE_POST_DECREMENT     (0)
5210
+
5211
+/* C expression that is nonzero if the machine supports pre- or post- address
5212
+ * side-effect generation involving constants other than the size of the memory
5213
+ * operand.
5214
+ */
5215
+#define        HAVE_PRE_MODIFY_DISP    (0)
5216
+#define        HAVE_POST_MODIFY_DISP   (0)
5217
+
5218
+/* C expression that is non-zero if the machine supports pre- or post-address
5219
+ * side-effect generation involving a register displacement.
5220
+ */
5221
+#define        HAVE_PRE_MODIFY_REG     (0)
5222
+#define        HAVE_POST_MODIFY_REG    (0)
5223
+
5224
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
5225
+ * which is a valid address.  On most machines the default definition ... is
5226
+ * acceptable, but a few machines are more restrictive as to which constant
5227
+ * addresses are supported.
5228
+ *
5229
+ * Zip CPU is designed for offset addresses, not constant addresses.  Although
5230
+ * the CPU will support 18-bit signed constant addresses, the assembler and
5231
+ * general programming model do not.  Further, without knowing where the final
5232
+ * address will be located, this is an unusable model.  Therefore we will
5233
+ * define this as not supported.
5234
+ *
5235
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
5236
+ * they are also constant addresses.  Hence, we leave this at its default.
5237
+ */
5238
+// #undef      CONSTANT_ADDRESS_P
5239
+// #define     CONSTANT_ADDRESS_P(X)   (0)
5240
+
5241 111 dgisselq
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code,
5242
+ * accepts integer values expressions whose values are not explicitly known,
5243
+ * such as symbol_ref, label_ref, and high expressions and const arithmetic
5244
+ * expressions, in addition to const_int and const_double expressions.
5245 102 dgisselq
+ *
5246
+ * Huh???
5247
+ */
5248
+// #define CONSTANT_P(X) ???
5249
+
5250 111 dgisselq
+/* MAX_REGS_PER_ADDRESS ... A number, the maximum number of registers that can
5251
+ * appear in a valid memory address.  Note that it is up to you to specify a
5252
+ * value equal to the maximum number that TARGET_LEGITIMATE_ADDRESS_P would
5253
+ * ever accept.
5254 102 dgisselq
+ */
5255
+#define        MAX_REGS_PER_ADDRESS    1
5256
+
5257
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
5258
+ * whether RTX is a legitimate memory address on the target machine for a
5259
+ * memory operation of mode MODE.
5260
+ */
5261
+#undef TARGET_LEGITIMATE_ADDRESS_P
5262
+#define TARGET_LEGITIMATE_ADDRESS_P    zip_legitimate_address_p
5263
+
5264
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
5265
+ * default 'm' character for general memory addresses.  This defines the
5266
+ * constraint letter which matches the memory addresses accepted by
5267
+ * TARGET_LEGITIMATE_ADDRESS_P.  Define this macro if you want to support new
5268
+ * address format in your back end without changing the semantics of the 'm'
5269
+ * constraint.  This is necessary in order to preserve functionality of inline
5270
+ * assembly constructs using the 'm' constraint.
5271
+ *
5272
+ * ZipCPU--doesn't look like we need to define this at all.
5273
+ */
5274
+
5275
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
5276
+ * X or to provide a simplified version of X from which alias.c can easily find
5277
+ * the base term.  This macro is used in only two places: find_base_value and
5278
+ * find_base_term in alias.c.
5279
+ *
5280
+ * It is always safe for this macro  to not be defined.  It exists so that
5281
+ * alias analysis can understand machine-dependent addresses.
5282
+ *
5283
+ * ZipCPU: We'll skip this then.
5284
+ */
5285
+
5286
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
5287
+ * memory address RTX for an operand of mode MODE and should try to return a
5288
+ * valid memory address.  RTX will always be the result of a call to
5289
+ * break_out_memory_refs, and OLD will be the operand that was given to that
5290
+ * function to produce RTX.
5291
+ *
5292 111 dgisselq
+ * ZipCPU --
5293 102 dgisselq
+ */
5294 111 dgisselq
+#undef TARGET_LEGITIMIZE_ADDRESS
5295
+#define        TARGET_LEGITIMIZE_ADDRESS       zip_legitimize_address
5296 102 dgisselq
+
5297
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
5298
+ * that attempts to replace X, which is an address that needs reloading, with
5299
+ * a valid memory address for an operand of mode MODE.  WIN will be a C
5300
+ * statement label elsewhere in the code.  It is not necessary to define this
5301
+ * macro, but it might be useful for performance reasons.
5302
+ *
5303
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
5304
+ * may also be a difficult macro to use.  Look at other implementations before
5305
+ * we dive into this.
5306
+ */
5307
+// #undef LEGITIMIZE_RELOAD_ADDRESS
5308
+// #define LEGITIMIZE_RELOAD_ADDRESS
5309
+
5310
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
5311
+ * if memory address addr in address space addrspace can have different meanings
5312
+ * depending on the machine mode of the memory reference it is used for or if
5313
+ * the address is valid for some modes but not others.
5314
+ */
5315
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
5316
+#define        TARGET_MODE_DEPENDENT_ADDRESS_P         zip_mode_dependent_address_p
5317
+
5318 111 dgisselq
+/* TARGET_LEGITIMATE_CONSTANT_P(MODE,RTX) ... This hook returns true if x is a
5319
+ * legitimate constant for a MODE-mode immediate operand on the target machine.
5320
+ * You can assume the RTX satisfies CONSTANT_P, so you need not check this.
5321
+ *
5322
+ * The default definition returns true.
5323 102 dgisselq
+ */
5324
+
5325
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
5326
+ */
5327
+
5328
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
5329
+ * should not be emitted into debug sections.
5330
+ */
5331
+
5332
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
5333
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
5334
+ * MODE is the mode of X.  The default version returns false.
5335
+ */
5336 111 dgisselq
+// #define     TARGET_CANNOT_FORCE_CONST_MEM   hook_bool_mode_rtx_false
5337 102 dgisselq
+
5338
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
5339
+ * if pool entries for constant RTX can be placed in an object_block structure.
5340
+ * MODE is the mode of X.  The default version returns false for all constants.
5341
+ *
5342
+ *????
5343
+ */
5344
+// #warning "Huh?"
5345
+
5346
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
5347
+ * entries for DECL should be placed in an object_block structure.  The default
5348
+ * version returns true for all DECL's.
5349
+ *
5350
+ * Sounds good.
5351
+ */
5352
+
5353
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
5354
+ * function that implements the reciprocal of the machine specific builtin
5355
+ * function fndecl, or NULL_TREE if such a function is not available.
5356
+ */
5357
+
5358
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
5359
+ * DECL of a function f that given an address addr as an argument returns a mask
5360
+ * m that can be used to extrract from two vectors the relevant data that
5361
+ * resides in addr in case addr is not properly aligned.
5362
+ *
5363
+ * Zip CPU does not support vectorization.
5364
+ */
5365
+
5366
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
5367
+ * such data accesses and manipulation.
5368
+ */
5369
+
5370
+/* 17.14 Anchored Addresses */
5371
+
5372
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
5373
+ * a section anchor.  On most targets, it should be the smallest offset that
5374
+ * can be applied to a base register while still giving a legitimate address for
5375
+ * every mode.  The default value is 0.
5376
+ *
5377
+ * On the Zip CPU, this is the minimum operand B offset to a LOD or STO
5378
+ * operation, which would be a signed 14 bit number.
5379
+ */
5380
+#undef TARGET_MIN_ANCHOR_OFFSET
5381
+#define TARGET_MIN_ANCHOR_OFFSET       zip_min_anchor_offset
5382
+
5383
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
5384
+ * (inclusive) offset that should be applied to section anchors.  The default
5385
+ * value is 0.
5386
+ */
5387
+#undef TARGET_MAX_ANCHOR_OFFSET
5388
+#define TARGET_MAX_ANCHOR_OFFSET       zip_max_anchor_offset
5389
+
5390
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
5391
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
5392
+ * true.  The hook is called with the assembly output position set to the
5393
+ * beginning of SYMBOL_REF_BLOCK(X).
5394
+ *
5395
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
5396
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'.  If ASM_OUTPUT_DEF
5397
+ * is not available, the hook's default definition is NULL, which disables the
5398
+ * use of section anchors altogether.
5399
+ *
5400
+ * Section anchors will be very valuable in Zip CPU assembly, therefore we
5401
+ * must define this hook.
5402
+ */
5403
+// #undef      TARGET_ASM_OUTPUT_ANCHOR
5404
+// #define     TARGET_ASM_OUTPUT_ANCHOR        zip_asm_output_anchor
5405
+
5406
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
5407
+ * to use anchors to access SYMBOL_REF X.  You can assume SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
5408
+ *
5409
+ * 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.
5410
+ *
5411
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
5412
+ */
5413
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
5414
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P     zip_use_anchors_for_symbol_p
5415
+
5416
+/* 17.15 Condition Code Status */
5417
+
5418
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
5419
+
5420
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
5421
+ * the mdep component of cc_status.  It defaults to int.
5422
+ *
5423
+ * ZipCPU---Int is good for us.
5424
+ */
5425
+
5426
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
5427
+ * "empty".  The default definition does nothing, since most machines don't
5428
+ * use the field anyway.  If you want to use the field, you should probably
5429
+ * define  this macro to initialize it.
5430
+ */
5431
+
5432
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
5433
+ * of cc_status appropriately for an insn insn whose body is exp.  It is this
5434
+ * macro's responsibility to recognize insns that set the condition code as
5435
+ * a byproduct of other activity as well as those that explicitly set (cc0).
5436
+ *
5437
+ * ZipCPU --- We need this, as not all expressions set (cc0).
5438
+ *
5439
+ */
5440 122 dgisselq
+#ifdef HAVE_cc0
5441 102 dgisselq
+#define        NOTICE_UPDATE_CC(EXP, INSN)     zip_update_cc_notice(EXP, INSN)
5442 122 dgisselq
+#endif
5443 102 dgisselq
+
5444
+
5445
+/* 17.15.2 Representation of condition codes using registers */
5446
+/* ... which the ZipCPU doesn't have.  The ZipCPU has a CC0 register, and hence
5447
+ * this section isn't supposed to apply.
5448
+ */
5449
+
5450 122 dgisselq
+/* SELECT_CC_MODE(op, x, y) ... On many machines, the condition code may be
5451
+ * produced by other instructions than compares, for example the branch can use
5452
+ * directyl the condition code set by a subtract instruction.  However, on some
5453
+ * machines when the condition code is set this way some bits (such as the
5454
+ * overflow bit) are not set in the same way as a test instruction, so that a
5455
+ * different branch instruction must be used for some conditional branches.
5456
+ * When this happens, use the machinemode of the condition code register to
5457
+ * record different formats of the condition code register.  Modes can also be
5458
+ * used to reccord which compare instruction (e.g. a signed or an unsigned
5459
+ * comparison) produced the condition codes.
5460
+ *
5461
+ * If other modes than CCmode are required, add them to 'machine-modes.def' and
5462
+ * define SELECT_CC_MODE to choose a mode given an operand of a compare.  This
5463
+ * is needed because the modes have to be chosen not only during RTL generation
5464
+ * but also, for example, by instruction combination.  The result of
5465
+ * SELECT_CC_MODE should be consistent with the mode used in the patterns; ...
5466
+ *
5467
+ * ZipCPU ... We have only one CC Mode, so we'll use the CCmode defined in
5468
+ * machine-modes.def and should be fine with it.  Hence, this doesn't need
5469
+ * to be defined.
5470 102 dgisselq
+ */
5471
+
5472
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
5473
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
5474
+ * convert an invalid comparison into a valid one.  For example, the Alpha
5475
+ * does not have a GT comparison, but you can use an LT comparison instead and
5476
+ * swap the order of the operands.
5477
+ *
5478
+ * On such machines, implement this hook to do any required conversions:  code
5479
+ * is the initial comparison code and op0 and op1 are the left and right
5480
+ * operands of the comparison, respectively.  If op0_preserve_value is true the
5481
+ * implementation is not allowed to change the value of op0 since the value
5482
+ * might be used in RTXs which aren't comparisons.  E.g. the implementation is
5483
+ * not allowed to swap operands in that case.
5484
+ *
5485
+ * GCC will not assume that the comparison resulting from this macro is valid
5486
+ * but will see if the resulting insn matches a pattern in the 'md' file.
5487
+ *
5488
+ * You need not implement this hook if it would never change the comparison
5489
+ * code or operands.
5490
+ *
5491
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
5492
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
5493
+ * painful.  Therefore, we *need* this capability to make certain we can use
5494
+ * our comparisons successfully.
5495
+ *
5496
+ * The only problem is ... this hook appears to only be called on non-CC0
5497
+ * machines.  Hence, defining it hasn't done anything for us.
5498
+ */
5499 122 dgisselq
+#define        TARGET_CANONICALIZE_COMPARISON  zip_canonicalize_comparison
5500 102 dgisselq
+
5501 122 dgisselq
+/* REVERSIBLE_CC_MODE(MODE) ... A C expression whose value is one if it is
5502
+ * always safe to reverse a comparison whose mode is MODE.  If SELECT_CC_MODE
5503
+ * can ever return MODE for a floating-point inequality comparison, than
5504
+ * REVERSIBLE_CC_MODE(MODE) must be zero.
5505
+ *
5506
+ * You need not define this macro if it would always return zero or if the
5507
+ * floating-point format is anything other than IEEE_FLOAT_FORMAT.  For example,
5508
+ * here ...
5509
+ *
5510
+ * ZipCPU -- We'll always return zero, so this need not be defined.
5511
+ */
5512
+
5513
+/* REVERSE_CONDITION(CODE,MODE) ... A C expression whose value is reversed
5514
+ * condition code of thecode for comparison done in CC_MODE MODE.  This macro
5515
+ * is used only in case REVERSIBLE_CC_MODE(MODE) is nonzero. ...
5516
+ *
5517
+ * ZipCPU ... Since REVERSIBLE_CC_MODE(MODE) will always be zero, we'll leave
5518
+ * this undefined.
5519
+ */
5520
+
5521
+/* bool TARGET_FIXED_CONDITION_CODE_REGS(int *, int *) ... On targets which do
5522
+ * not use (cc0), and which use a hard register rather than a pseudo-register
5523
+ * to hold condition codes, the regular CSE passes are often not able to
5524
+ * identify cases in which the hard register is set to a common value.  Use this
5525
+ * hook to enable a small pass which optimizes such cases.  This hook should
5526
+ * return true to enable this pass, and it should set the integers to which its
5527
+ * arguments point to the hard register numbers used for condition codes.  When
5528
+ * there is only one such register, as is true on most systems, the integer
5529
+ * pointed to by p2 should  be set to INVALID_REGNUM.
5530
+ *
5531
+ * The default version of this hook returns false.
5532
+ *
5533
+ * ZipCPU --- I like the idea of enabling optimizations.  Let's return
5534
+ * something other than false.
5535
+ */
5536
+#define        TARGET_FIXED_CONDITION_CODE_REGS        zip_fixed_condition_code_regs
5537
+
5538
+/* machine_mode TARGET_CC_MODES_COMPATIBLE(M1,M2) .. On targets which use
5539
+ * multiple condition code modes in class MODE_CC, it is sometimes the case
5540
+ * that a comparison can be validly done in more than one mode.  On such a
5541
+ * system, define this target hook to take two mode arguments and to return a
5542
+ * mode in which both comparisons may be validly done.  If there is no such
5543
+ * mode, return VOIDmode.
5544
+ *
5545
+ * The default version of this hook checks whether the modes are the same.  If
5546
+ * they are, it returns that mode.  If they are different, it returns VOIDmode.
5547
+ *
5548
+ * ZipCPU--Given that we only have the one CCmode, the default definition works
5549
+ * well enough for us.
5550
+ */
5551
+
5552
+/* unsigned int TARGET_FLAGS_REGNUM ... If the target has a dedicated flags
5553
+ * register, and it needs to use the post-reload comparison elimination pass,
5554
+ * then this value should be set appropriately.
5555
+ *
5556
+ * ZipCPU---Looks like we can set this easily enough without any problems.
5557
+ */
5558
+#undef TARGET_FLAGS_REGNUM
5559
+#define        TARGET_FLAGS_REGNUM     zip_CC
5560
+
5561 102 dgisselq
+/* 17.16 Relative costs of operations */
5562
+
5563
+
5564
+// #define     REGISTER_MOVE_COST(MODE,FROM,TO)        ((MODE==DImode)||(MODE==DFmode))?4:2
5565
+// #define     TARGET_REGISTER_MOVE_COST
5566
+// #define     MEMORY_MOVE_COST(MODE, CLASS, IN)       ((MODE==DImode)||(MODE==DFmode))?8:7
5567
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
5568
+ * cost of moving data of mode M from a register in class FRM to one in class
5569
+ * TO.  The classes are expressed using the enumeration values such as
5570
+ * GENERAL_REGS.  A value of 2 is the default; other values are interpreted
5571
+ * relative to that.
5572
+ *
5573
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
5574
+ * on some machines it is expensive to move between registers if they are not
5575
+ * general registers.
5576
+ *
5577
+ * If reload sees ...
5578
+ *
5579
+ * ZipCPU ... We can leave this at its default value of 2.
5580
+ */
5581
+
5582
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
5583
+ * cost of moving data of mode MOD between a register of class CL and memory.
5584
+ * IN is false if the value is to be written to memory, true if it is to be
5585
+ * read in.  This cost is relative to those in TARGET_REGISTER_MOVE_COST.
5586
+ * If moving between registers and memory is more expensive that between two
5587
+ * registers, you should add this target hook to express the relative cost.
5588
+ *
5589
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
5590
+ * cost of copying via a secondary reload register, if one is needed.  If your
5591
+ * machine requires a secondary reload register to copy between memory and a
5592
+ * register of CL but the reload mechanism is more complex than copying via
5593
+ * an intermediate, use this target hook to reflect the actual cost of the
5594
+ * move.
5595
+ *
5596
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
5597
+ * moves, so let's make certain this is defined.
5598
+ */
5599
+#define        TARGET_MEMORY_MOVE_COST zip_memory_move_cost
5600
+
5601
+// #warning "This needs to be double checked, and annotated"
5602 111 dgisselq
+#define        BRANCH_COST(SPEED,PREDICTABLE)          ((PREDICTABLE)?2:5)
5603 102 dgisselq
+
5604
+/* Define this macro as a C expression which is nonzero if accessing less than
5605
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
5606
+ * a word of memory.
5607
+ */
5608
+#define        SLOW_BYTE_ACCESS        1
5609
+
5610
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
5611
+ * instructions, below which a sequence of instructions should be generated
5612
+ * instead of a string move instruction or a library call.  Increasing the
5613
+ * value will always make code faster, but eventually incurs high cost in
5614
+ * increased code size.
5615
+ */
5616
+#define        MOVE_RATIO(SPD) 5
5617
+
5618
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
5619
+ */
5620
+// #undef      TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
5621
+// #define     TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
5622
+
5623
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
5624
+ * which a sequence of instructions should be generated to clear memory instead
5625
+ * of a string clear instruction or a library call.  Increasing the value will
5626
+ * always make the code faster, but eventually incurs high cost in increased
5627
+ * code size.
5628
+ */
5629
+#define        CLEAR_RATIO(SPD)        MOVE_RATIO(SPD)
5630
+
5631
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
5632
+ * to call a constant function address than to call an address kept in a
5633
+ * register.
5634
+ *
5635
+ * On the Zip CPU, constant function addresses--especially relative ones,
5636
+ * can be optimized into a single cycle delay.  Register jumps will always
5637
+ * stall the whole (5-stage) pipeline.
5638
+ */
5639
+#define        NO_FUNCTION_CSE
5640
+
5641 111 dgisselq
+/* TARGET_RTX_COSTS(X,CODE,OUTER,OPNO,TOTAL,SPD) ... This target hook describes
5642
+ * the relative costs of RTL expressions.
5643
+ *
5644
+ * The cost may depend on the precise form of the expression, which is avaialble
5645
+ * for examination in X, and the fact that X appears as operand OPNO of an
5646
+ * expression with rtx code OUTER.  That is, the hook can assume that there is
5647
+ * some RTX Y such that GET_CODE(Y)==OUTER and such that either (a) XEXP(Y,OPNO)
5648
+ * == X or (b) XVEC(Y,OPNO) contains X.
5649
+ *
5650
+ * ...
5651
+ * The hook returns true when all subexpressions of x have been processed and
5652
+ * false when rtx_cost should recurse.
5653 102 dgisselq
+ */
5654 111 dgisselq
+
5655 102 dgisselq
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
5656
+ * addressing mode that contains ADDR.  If not defined, the cost is computed
5657
+ * from the ADDR expression and the TARGET_RTX_COST hook.  In cases where more
5658
+ * than one form of an address is known, the form with the lowest cost will be
5659
+ * used.  If multiple forms have the same, lowest, cost, the one that is the
5660
+ * most complex will be used.
5661
+ *
5662
+ * ZipCPU really has only one address cost, the only type of address it
5663
+ * supports.  Sure, index addressing would cost us more, but we don't support
5664
+ * that so ... I think we're okay defining this as a constant.  Indeed, the
5665
+ * docs state that, "On RISC amchines, all instructions normally have the same
5666
+ * length and execution time.  Hence all addresses will have equal costs."
5667
+ */
5668
+#undef TARGET_ADDRESS_COST
5669
+#define        TARGET_ADDRESS_COST     zip_address_cost
5670
+
5671
+
5672
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
5673
+ * of the eager delay slot filler to disallow speculatively executed
5674
+ * instructions being placed in delay slots.  Targets such as certain MIPS
5675
+ * architectures posess both branches with and without delay slots.  As the
5676
+ * eager delay slot filler can decrease performance, disabling it is beneficial
5677
+ * when ordinary branches are available.  Use of delay slot branches filled
5678
+ * using basic filler is often still desirable as the delay slot can hide a
5679
+ * pipeline bubble.
5680
+ */
5681
+// How should Zip CPU define this--we have no delay slots.
5682
+
5683
+
5684
+/* 17.17 Instruction Scheduler */
5685
+
5686
+#define        TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
5687
+
5688
+/* 17.18 Dividing the Output into Sections */
5689
+
5690
+/* Switch to the text or data segment. */
5691
+#define        TEXT_SECTION_ASM_OP     "\t.text"
5692
+#define        DATA_SECTION_ASM_OP     "\t.data"
5693
+
5694
+// #undef      TARGET_LIBGCC_SDATA_SECTION
5695
+// #define     TARGET_LIBGCC_SDATA_SECTION     ".sdata"
5696
+
5697
+
5698
+/* 17.19 Position Independent Code */
5699
+
5700
+#define        PIC_OFFSET_TABLE_REGNUM                 zip_GOT
5701
+#define        PIC_OFFSET_TABLE_REG_CALL_CLOBBERED     0
5702
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
5703
+
5704
+/* 17.20 Defining the Output Assembler Language */
5705
+
5706
+/* 17.20.4 Output and Generation of Labels */
5707
+
5708
+/* ASM_OUTPUT_LABEL
5709
+ * ... A default definition of this macro is provided which is correct for
5710
+ * most systems.
5711
+ */
5712
+
5713
+/* ASM_OUTPUT_FUNCTION_LABEL
5714
+ * ... if not defined, then the function name is defined in the usual manner
5715
+ * as a label.
5716
+ */
5717
+
5718
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
5719
+ * is known to refer to a compiler-generated label.  The default definition
5720
+ * uses assemble_name_raw, which is like assemble_name except that it is more
5721
+ * efficient.
5722
+ */
5723
+
5724
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
5725
+ * to specify the size of a symbol, without any arguments.  ON systems that
5726
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
5727
+ * define this macro.
5728
+ *
5729
+ * Define this amcro only if it is correct to use the default definitions of
5730
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
5731
+ * If you need your own custom definitions of those macros, or if you do not
5732
+ * need explicit symbol sizes at all, do not define this macro.
5733
+ */
5734
+
5735
+/* ASM_OUTPUT_SIZE_DIRECTIVE
5736
+ * ASM_OUTPUT_MEASURED_SIZE
5737
+ */
5738
+
5739
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
5740
+ * the character '$' in label names.  By default constructors and destructors
5741
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
5742
+ * used instead.
5743
+ */
5744
+
5745
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
5746
+ * character '.' in label names.  By default constructors and destructors in
5747
+ * G++ have names that use '.'.  If this macro is defined, these names are
5748
+ * rewritten to avoid '.'.
5749
+ */
5750
+
5751
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
5752
+ * specify the type of a symbol, without any arguments.  On systems that use
5753
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
5754
+ *
5755
+ * Define this macro only if it is correct to use the default definition of
5756
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
5757
+ * definition of this macr, or if you do not need explicit symbol types at all,
5758
+ * do not define this macro.
5759
+ */
5760
+
5761
+/* TYPE OPERAND_FMD ... A
5762
+ */
5763
+
5764
+/* ASM_OUTPUT_TYPE_DIRECTIVE
5765
+ */
5766
+
5767
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
5768
+ * if this macro is not defined, then the function name is defined in the usual
5769
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
5770
+ */
5771
+
5772
+/* ASM_DECLARE_FUNCTION_SIZE
5773
+ * ASM_DECLARE_COLD_FUNCTION_NAME
5774
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
5775
+ * ASM_DECLARE_OBJECT_NAME
5776
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
5777
+ */
5778
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
5779
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
5780
+ * claiming a register REGNO for a global variable DECL with name NAME.
5781
+ *
5782
+ * If you don't defin this macro, that is equivalent to dfining it to do
5783
+ * nothing.
5784
+ */
5785
+
5786
+/* ASM_FINISH_DECLARE_OBJECT
5787
+ * TARGET_ASM_GLOBALIZE_LABEL
5788
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
5789
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
5790
+ * ASM_WEAKEN_LABEL
5791
+ * ASM_WEAKEN_DECL
5792
+ * ASM_OUTPUT_WEAKREF
5793
+ * SUPPORTS_WEAK
5794
+ * TARGET_SUPPORTS_WEAK
5795
+ * MAKE_DECL_ONE_ONLY
5796
+ * SUPPORTS_ONE_ONLY
5797
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
5798
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
5799
+ * ASM_OUTPUT_EXTERNAL
5800
+ * TARGET_ASM_EXTERNAL_LIBCALL
5801
+ * TARGET_ASM_MARK_DECLPRESERVED
5802
+ * ASM_OUTPUT_LABELREF
5803
+ * TARGET_MANGLE_ASSEMBLER_NAME
5804
+ * ASM_OUTPUT_SYMBOL_REF
5805
+ * ASM_OUTPUT_LABEL_REF
5806
+ * TARGET_ASM_INTERNAL_LABEL
5807
+ * ASM_OUTPUT_DEBUG_LABEL
5808
+ * ASM_GENERATE_INTERNAL_LABEL
5809
+ * ASM_FORMAT_PRIVATE_NAME
5810
+ */
5811
+
5812
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
5813
+ * assembler code which defines (equates) the symbol NAME to have the value
5814
+ * VALUE.
5815
+ *
5816
+ * ZipCPU---So many other things that we need depend upon this, that we need
5817
+ * to implement a non-default version.
5818
+ */
5819
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
5820
+
5821
+/* ASM_OUTPUT_DEF_FROM_DECLS
5822
+ * TARGET_DEFERRED_OUTPUT_DEFS
5823
+ * ASM_OUTPUT_WEAK_ALIAS
5824
+ * OBJ_GEN_METHOD_LABEL
5825
+ */
5826
+
5827
+
5828
+/* 17.20.7 Output of Assembler Instructions */
5829
+
5830
+#define        REGISTER_NAMES { "R0","R1","R2","R3","R4","R5","R6","R7","R8","R9", \
5831
+       "R10","R11","R12","SP","CC","PC" }
5832
+
5833
+/* REGISTER_PREFIX     (Undefined by default)
5834
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
5835
+ * USER_LABEL_PREFIX   defaults to "*"
5836
+ * IMMEDIATE_PREFIX    (Undefined by default)
5837
+ *
5838
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
5839
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
5840
+ * 'md' file must support multiple assembler formats.  In that case, the various
5841
+ * 'tm.h' files can define these macros differently.
5842
+ */
5843
+// #define     USER_LABEL_PREFIX       "*"
5844
+
5845
+/* Defining memory operand address formats is in this section. */
5846
+
5847
+/* 17.20.10 Assembler Commands for Alignment */
5848
+
5849
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
5850
+ * which is a common destination of jumps and has no fallthru incoming
5851
+ * edge.  This macro need not be defined if you don't want any special alignment
5852
+ * to be done at such a time.  Most machine descriptions do not currently define
5853
+ * this macro.
5854
+ *
5855
+ * ZipCPU---The assembler should automatically deal with label alignment, so
5856
+ * let's not do anything about it here.
5857
+ */
5858
+
5859
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
5860
+ */
5861
+
5862
+/* LABEL_ALIGN_AFTER_BARRIER
5863
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
5864
+ */
5865
+
5866
+/* LOOP_ALIGN(label)
5867
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
5868
+ * LABEL_ALIGN
5869
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
5870
+ */
5871
+
5872
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
5873
+ * stream an assembler instruction to advance the location counter by nbytes
5874
+ * bytes.
5875
+ */
5876
+
5877
+/* TARGET_ASM_LABEL_ALIGN */
5878
+/* Assembler Commands for Alignment */
5879
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
5880
+               { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
5881
+
5882
+
5883
+
5884
+/* 17.21 Controlling Debugging Information Format */
5885
+/* 17.22 Cross Compilation and Floating Point */
5886 111 dgisselq
+
5887
+// REAL_VALUE_TYPE
5888
+// REAL_VALUES_EQUAL
5889
+// REAL_VALUES_LESS ... Tess whether x is less than y
5890
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
5891
+ * If x is negative, returns zero.
5892
+ */
5893
+// REAL_VALUE_ATOF
5894
+// REAL_VALUE_NEGATIVE
5895
+// REAL_VALUE_ISINF
5896
+// REAL_VALUE_ISNAN
5897
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
5898
+ * on two floating point values X and Y, storing the result in OUT (which must
5899
+ * be a variable).
5900
+ *
5901
+ * The operation to be performed is specified by CODE.  Only the following
5902
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
5903
+ * MIN_EXPR.
5904
+ *
5905
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
5906
+ * floating point format cannot represent infinity, it will call abort().
5907
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
5908
+ */
5909
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
5910
+ * value X.
5911
+ */
5912
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
5913
+ */
5914 102 dgisselq
+/* 17.23 Mode switching instructions */
5915
+/* 17.24 Defining target-specific uses of __attribute__ */
5916
+#undef TARGET_OPTION_OVERRIDE
5917
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
5918
+
5919
+/* 17.25 Emulating TLS */
5920
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
5921
+
5922
+ // ZipCPU isn't MIPS.
5923
+
5924
+/* 17.27 Parameters for Precompiled Header Validity Checking */
5925
+/* 17.28 C++ ABI parameters */
5926
+/* 17.29 Adding support for named address spaces */
5927
+/* 17.30 Miscellaneous Parameters */
5928
+
5929
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
5930
+ * not your architecture has conditional branches that can span all of memory.
5931
+ * It is used in conjunction with an optimization that partitions hot and
5932
+ * cold basic blocks into separate sections of the executable.  If this macro
5933
+ * is set to false, gcc will convert any conditional branches that attempt to
5934
+ * cross between sections into unconditional branches or indirect jumps.
5935
+ *
5936
+ * ZipCPU --- The assembler renders long unconditional branch code without
5937
+ * problems, so we can pretend that such long branches exist.
5938
+ */
5939
+#define        HAS_LONG_COND_BRANCH true
5940
+
5941
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
5942
+ * or not your architecture has unconditional branches that can span all of
5943
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
5944
+ * conjunction with an optimization that partitions hot and cold basic blocks
5945
+ * into separate sections of the executable.  If this macro is set to false,
5946
+ * gcc will convert any unconditional branches that attempt to cross between
5947
+ * sections into indirect jumps.
5948
+ *
5949
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
5950
+ * jump.
5951
+ */
5952
+#define        HAS_LONG_UNCOND_BRANCH  true
5953
+
5954
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
5955
+ * mode that eleemnts of a jump-table should have.
5956
+ *
5957
+ */
5958
+#define        CASE_VECTOR_MODE        SImode
5959
+
5960
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
5961
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
5962
+ * If you define this, it enables extra code in branch shortening to deal with
5963
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
5964
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
5965
+ *
5966
+ * ZipCPU---No advantage here.
5967
+ */
5968
+
5969
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
5970
+ * jump-tables should contain relative addresses.  You need not define this
5971
+ * macro if jump-tables never contain relative addresses, or jump-tables
5972
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
5973
+ *
5974
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
5975
+ * code.
5976
+ */
5977
+
5978
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
5979
+ * number of different values for which it is best to use a jump-table instead
5980
+ * of a tree of conditional branches.  The default is four for machines with a
5981
+ * casesi instruction and five otherwise.  This is best for most machines.
5982
+ *
5983
+ * ZipCPU---Leave at the default.
5984
+ */
5985
+
5986
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
5987
+ * registers with integral mode smaller than a word are always performed on the
5988
+ * entire register.  Most RISC machines have this property and most CISC
5989
+ * machines do not.
5990
+ *
5991
+ * ZipCPU---We have the property, 'cause we're fairly risk.
5992
+ */
5993
+#undef WORD_REGISTER_OPERATIONS
5994
+#define        WORD_REGISTER_OPERATIONS        1
5995
+
5996
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
5997
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
5998
+ * word, set the bits outside of MEMMODE to be either the sign extension or
5999
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
6000
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
6001
+ * UNKNOWN for other modes.
6002
+ *
6003
+ * Do not define this macro if it would always return UNKNOWN.
6004
+ *
6005
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
6006
+ */
6007
+#undef LOAD_EXTEND_OP
6008
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
6009
+
6010
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
6011
+ *
6012
+ * ZipCPU---All immediates are sign extended, so yes.
6013
+ */
6014
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
6015
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
6016
+
6017
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
6018
+ */
6019
+
6020
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
6021
+ * quickly between memory and registers or between two memory locations.
6022
+ *
6023
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
6024
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
6025
+ * Therefore, this is defined to be one.
6026
+ */
6027
+#define        MOVE_MAX        1
6028
+
6029
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
6030
+ * move quickly between memory and registers or between two memory ...
6031
+ *
6032
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
6033
+ * definition of this.
6034
+ */
6035
+
6036
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
6037
+ * the number of bits actually used for the count of a shift operation is equal
6038
+ * to the number of bits needed to represent the size of the object being
6039
+ * shifted.
6040
+ *
6041
+ * You need not define this macro if it would have the value of zero.
6042
+ *
6043
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
6044
+ * value in the register, therefore this value should be zero, the default.
6045
+ */
6046
+
6047
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
6048
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
6049
+ * more than the width of the mode.
6050
+ *
6051
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
6052
+ * This is the case for the ZipCPU as well.
6053
+ */
6054
+
6055
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
6056
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
6057
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
6058
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
6059
+ *
6060
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
6061
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
6062
+ */
6063
+#undef TRULY_NOOP_TRUNCATION
6064
+#define TRULY_NOOP_TRUNCATION(O,I)     1
6065
+
6066
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
6067
+ * mode can be such that the values are always extended to a wider integral
6068
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
6069
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
6070
+ * use zero-extended.
6071
+ *
6072
+ */
6073
+// #undef      TARGET_MODE_REP_EXTENDED
6074
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
6075
+
6076
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
6077
+ * comparison operator with an integral mode and stored by a store-flag
6078
+ * instruction (cstoremode4) when the condition is true.  This description
6079
+ * must apply to all the cstoremode4 patterns and all the comparison operators
6080
+ * whose results have MODE_INT mode.
6081
+ *
6082
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
6083
+ */
6084
+
6085
+/* FLOAT_STORE_FLAG_VALUE
6086
+ *
6087
+ * ZipCPU
6088
+ */
6089
+
6090
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
6091
+ * comparison operations that return a vector result ...
6092
+ *
6093
+ * ZipCPU---Doesn't support vector operations.
6094
+ */
6095
+
6096
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6097
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6098
+ *
6099
+ * A C expression that indicates whetther the architecture defines a value for
6100
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
6101
+ * 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
6102
+ * entry, then the macro should evaluate to 2.  In cases where the value is
6103
+ * defined, value should be set to this value.
6104
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
6105
+ * be undefined.
6106
+ *
6107
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
6108
+ */
6109
+
6110
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
6111
+ * define this to be the integer mode corresponding to the width of a
6112
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
6113
+ * On some machines you must define this to be one of the partial
6114
+ * integer modes, such as PSImode.
6115
+ */
6116
+#undef Pmode
6117
+#define        Pmode   SImode
6118
+
6119
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
6120
+ * function being called, in call RTL expressions.  On most CISC machines, where
6121
+ * an instruction can begin at any byte address, this should be QImode.  On most
6122
+ * RISC machines, where all instructions have fixed size and alignment, this
6123
+ * should be a mode with the same size and alignment as the machine instruction
6124
+ * words--typically SImode or HImode.
6125
+ *
6126
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
6127
+ * addresses on the ZipCPU.
6128
+ */
6129
+#undef FUNCTION_MODE
6130
+#define        FUNCTION_MODE   SImode
6131
+
6132
+/* STDC_0_IN_SYSTEM_HEADERS
6133
+ */
6134
+
6135
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
6136
+ * file to be included at the start of all compilations, as if it had been
6137
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
6138
+ * or if the header is not found, or if the user specifies -ffreestanding or
6139
+ * -nostdinc, no header is included.
6140
+ *
6141
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
6142
+ * as NULL.
6143
+ */
6144
+#undef TARGET_C_PREINCLUDE
6145
+#define        TARGET_C_PREINCLUDE     NULL
6146
+
6147
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
6148
+ * specific C++ implicit extern C functions.  If this function returns true
6149
+ * for the name of a file-scope function, that function implicitly gets extern
6150
+ * "C" linkage rather than whatever linkage the declaration would normally have.
6151
+ * An example of such function is WinMain on Win32 targets.
6152
+ *
6153
+ * ZipCPU---Not ready to deal with this yet.
6154
+ */
6155
+
6156
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
6157
+ * support C++ as well as C.  This macro inhibits the usual method of using
6158
+ * system header files in C++, which is to pretend that the file's contents
6159
+ * are enclosed in 'extern "C" {...}'.
6160
+ *
6161
+ *
6162
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
6163
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
6164
+ */
6165
+
6166
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
6167
+ * target specific pragmas.
6168
+ *
6169
+ * ZipCPU --- let's not.
6170
+ */
6171
+
6172
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
6173
+ * expanded in the arguments of #pragma pack().
6174
+ *
6175
+ * ZipCPU ... why?
6176
+ */
6177
+
6178
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
6179
+ * default other than 0 (meaning the machine default), define this macro to
6180
+ * the necessary value (in bytes).  This must be a value that would also be
6181
+ * valid to use with #pragma pack() (that is a small power of two.
6182
+ */
6183
+
6184
+/* DOLLARS_IN_IDENTIFIERS
6185
+ * ZipCPU --- Default (not changing C)
6186
+ */
6187
+
6188
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
6189
+ * is nonzero if it is safe for the delay slot schedule to place instructions
6190
+ * in the delay slot of INSN, even if they appear to use a resource set or
6191
+ * clobbered in INSN.  INSN is always a ...
6192
+ *
6193
+ * ZipCPU --- You need not define this macro if it would always return zero.
6194
+ */
6195
+
6196
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
6197
+ * that is nonzero if it is safe for the delay slot schedule to place
6198
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
6199
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
6200
+ * machines where some insn or jump_insn is really a function call and ...
6201
+ *
6202
+ * ZipCPU --- You need not define this macro if it would always return zero.
6203
+ */
6204
+
6205
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
6206
+ * nonzero if, in some cases, global symbols from one translation unit may not
6207
+ * be bound to undefined symbols in another translation unit without user
6208
+ * intervention.  For instance, under Microsoft Windows symbols must be
6209
+ * explicitly imported from shared libraries (DLLs).
6210
+ *
6211
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
6212
+ * so we won't.
6213
+ */
6214
+
6215
+/* TARGET_MD_ASM_ADJUST
6216
+ */
6217
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6218
+ * define this macro if the default of "m" is wrong.
6219
+ *
6220
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6221
+ * works doesn't sound like a problem.  Let's not define this.
6222
+ */
6223
+
6224
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6225
+ * variable that specifies where the linker should look for libraries.
6226
+ *
6227
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6228
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6229
+ * libraries.
6230
+ */
6231
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6232
+
6233
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6234
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6235
+ *
6236
+ * ZipCPU does not.
6237
+ */
6238
+
6239
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6240
+ * instructions to execute via conditional execution instructions instead of a
6241
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6242
+ * cc0 and 1 if it does use cc0.
6243
+ *
6244
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6245
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6246
+ * something else, so let's keep looking into this.
6247
+ */
6248
+
6249
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6250 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6251 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6252
+ * structure, struct ce_if_block, which contains information about the currently
6253
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6254
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6255
+ * or FALSE to a null pointer if the tests cannot be converted.
6256
+ *
6257
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6258
+ * execution and conditional testing capabilities.
6259
+ */
6260 122 dgisselq
+#define        IFCVT_MODIFY_TESTS(CI,TR,FL)    zip_ifcvt_modify_tests(CI,&TR,&FL)
6261 102 dgisselq
+
6262
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6263
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6264
+ * into conditions combined by and and or operations.  BB contains the basic
6265
+ * block that contains the test that is currently being processed and about to
6266
+ * be turned into a condition.
6267
+ *
6268
+ *
6269
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6270
+ * execution and conditional testing capabilities.
6271
+ */
6272
+// #warning "Need to come back to this."
6273 122 dgisselq
+#define        IFCVT_MODIFY_MULTIPLE_TESTS(CI,BB,TR,FL) TR=NULL_RTX
6274 102 dgisselq
+
6275
+
6276
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6277
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6278
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6279
+ * information about the currently processed blocks.
6280
+ *
6281
+ *
6282
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6283
+ * execution and conditional testing capabilities.
6284
+ */
6285
+// #warning "Need to come back to this."
6286
+
6287
+
6288
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6289
+ * machine dependent modifications in converting code to conditional
6290
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6291
+ * structure pointed to be CEINFO.
6292
+ *
6293
+ *
6294
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6295
+ * execution and conditional testing capabilities.
6296
+ */
6297
+// #warning "Need to come back to this."
6298 122 dgisselq
+#define        IFCVT_MODIFY_FINAL(CEINFO)      zip_ifcvt_modify_final(CEINFO)
6299 102 dgisselq
+
6300
+
6301
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6302
+ * dependent modifications in converting code to conditional execution.  The
6303
+ * involved basic blocks can be found in the struct ce_if_block structure that
6304
+ * is pointed to by CEINFO.
6305
+ *
6306
+ *
6307
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6308
+ * execution and conditional testing capabilities.
6309
+ */
6310
+// #warning "Need to come back to this."
6311 122 dgisselq
+#define        IFCVT_MODIFY_CANCEL(CEINFO)     zip_ifcvt_modify_cancel(CEINFO)
6312 102 dgisselq
+
6313
+
6314
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6315
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6316
+ * that is pointed by CEINFO.
6317
+ *
6318
+ *
6319
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6320
+ * execution and conditional testing capabilities.
6321
+ */
6322
+// #warning "Need to come back to this."
6323 122 dgisselq
+#define        IFCVT_MACHDEP_INIT(CEINFO)      zip_ifcvt_machdep_init(CEINFO)
6324 102 dgisselq
+
6325
+
6326
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6327
+ * target specific pass over the instruction stream.  The compiler will run it
6328
+ * at all optimization levels, just before the point at which it normally does
6329
+ * delayed branch scheduling.
6330
+ *
6331
+ * You need not implement the hook if it has nothing to do.
6332
+ *
6333
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6334
+ * just get us started.
6335
+ */
6336
+
6337
+
6338
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6339
+ * specific builtin functions that need to be defined.  It should be a function
6340
+ * that performs the necessary setup.  Machine specific builtin functions can be
6341
+ * useful to expand special machine instructions that would otherwise not
6342
+ * normally be generated because they have no equivalent in the source language.
6343
+ *
6344
+ * To create a built in function, call the function lang_hooks.builtin_function
6345
+ * which is defined by the language front end.  You can use any type nodes
6346
+ * set up by build_common_tree_nodes; only language front ends that use those
6347
+ * two functions will call "TARGET_INIT_BUILTINS".
6348
+ *
6349
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6350
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6351
+ * restore_context(cstackregno).
6352
+ *
6353
+ */
6354
+#undef TARGET_INIT_BUILTINS
6355
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6356
+
6357
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6358
+ * machine specific builtin functions that need to be defined.  It should be a
6359
+ * function that returns the builtin function declaration for the builtin
6360
+ * function code code.  If there is no such builtin and it cannot be initialized
6361
+ * at this time if INITP is true the function should return NULL_TREE.  If
6362
+ * CODE is out of range the fucntion should return error-mark_node.
6363
+ *
6364
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6365
+ */
6366
+#undef TARGET_BUILTIN_DECL
6367
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6368
+
6369
+
6370
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6371
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6372
+ * TREE is the expression for the function call; the result should go to
6373
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6374
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6375
+ * non-zero if the value is to be ignored.  This function should return the
6376
+ * result of the call to the built-in function.
6377
+ *
6378
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6379
+ */
6380
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6381
+
6382
+
6383
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6384
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6385
+ *
6386
+ * ZipCPU --- not interested.
6387
+ */
6388
+/* TARGET_CHKP_BOUND_TYPE
6389
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6390
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6391
+ *
6392
+ * ZipCPU --- Same as last one.
6393
+ */
6394
+
6395
+
6396
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6397
+ * for a machine specific built-in function that was set up by
6398
+ * TARGET_INIT_BUILTINS.
6399
+ *
6400
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6401
+ * to then overload it?
6402
+ */
6403
+
6404
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6405
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6406
+ * is the declaration of the built-in function.  NARGS is the number of
6407
+ * arguments passed to the function; the arguments themselves are pointed to by
6408
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6409
+ * containing as simplified expression for the call's result.  If IGNORE is
6410
+ * true the value will be ignored.
6411
+ *
6412
+ * ZipCPU --- You know, this and the previous couple sound like something
6413
+ * whereby I might be able replace bit-reversal code with my bit reverse
6414
+ * instruction.  That would be very useful, but not necessary to get me
6415
+ * started.
6416
+ */
6417
+
6418
+/* TARGET_GIMPLE_FOLD_BUILTIN
6419
+ * TARGET_COMPARE_VERSION_PRIORITY
6420
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6421
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6422
+ * TARGET_CAN_USE_DOLOOP_P
6423
+ * TARGET_INVALID_WITHIN_DOOLOOP
6424
+ * TARGET_LEGITIMATE_COMBINED_INSN
6425
+ * TARGET_CAN_FOLLOW_JUMP
6426
+ * TARGET_COMMUTATIVE_P
6427
+ */
6428
+
6429
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6430
+ * register has been copied in a pseudo register, it is often not necessary
6431
+ * ...
6432
+ */
6433
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6434
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6435
+ * can use this hook to enhance precision of analysis for unspec and
6436
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6437
+ * elements of RTX in which case flags should be passed along.
6438
+ */
6439
+
6440
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6441
+ * it changes its current function context (CFUN).  You can define this
6442
+ * function if the back end needs to perform any initialization or reset
6443
+ * actions on a per-function basis.  For example, it may be used to implement
6444
+ * function attributes that affect register usage or code generation patterns.
6445
+ */
6446
+
6447
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6448
+ * suffix for object files on your target machine.  If you do not define this
6449
+ * macro, GCC will use ".o" as the suffix for object files.
6450
+ */
6451
+#define        TARGET_OBJECT_SUFFIX    ".o"
6452
+
6453
+/* TARGET_EXECUTABLE_SUFFIX
6454
+ */
6455
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6456
+
6457
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6458
+ * files specified on its command line and create an export list for the linker.
6459
+ * Define this macro for systems like AIX, where the linker discards object
6460
+ * files that are not referenced from main and uses export lists.
6461
+ *
6462
+ * ZipCPU --- shoudln't need this.
6463
+ */
6464
+
6465
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6466
+ * representing a variant of the method call mdecl, if Java Native Interface
6467
+ * (JNI) methods must be invoked differently from other methods on your
6468
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6469
+ * using the stdcall calling convention and this macro is then ...
6470
+ *
6471
+ * ZipCPU----Don't need this.  (yet)
6472
+ */
6473
+
6474
+
6475
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6476
+ * point in which a new jump instructions could be created.  On machines that
6477
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6478
+ * would typically be reload, so thiss target hook should be defined to a
6479
+ * function such as:
6480
+ *
6481 117 dgisselq
+ * ZipCPU --- I don't get what this is for.
6482
+ *     Actually, in hind sight, ZipCPU needs this.  Without this, the
6483
+ * compiler will try to reorder basic blocks, shuffling logic around and so
6484
+ * fortch, preventing our comparison optimizations from being used.  By setting
6485
+ * this function appropriately, we can prevent it from reversing conditions into
6486
+ * conditions we don't support.
6487 102 dgisselq
+ */
6488 117 dgisselq
+#define        TARGET_CANNOT_MODIFY_JUMPS_P    zip_cannot_modify_jumps_p
6489 102 dgisselq
+
6490
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6491
+ * class for which branch target register optimizations should be applied.  All
6492
+ * registers in this class should be usable interchangably.  After reload,
6493
+ * registers in this class will be re-allocated and loads will be hoisted out of
6494
+ * loops and be subjected to inter-block scheduling.
6495
+ *
6496
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6497
+ */
6498
+
6499
+
6500
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6501
+ * optimization will by default exclude callee-saved registers that are not
6502
+ * already live during the current function.  If this target hook returns true,
6503
+ * they will be included.  The target code must then make sure that all target
6504
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6505
+ * be saved are saaved.
6506
+ *
6507
+ * ZipCPU---
6508
+ */
6509
+
6510
+
6511
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6512
+ * if the target supports conditional execution.  This target hook is required
6513
+ * only when the target has several different modes and they have different
6514
+ * conditional execution capability, such as ARM.
6515
+ *
6516
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6517
+ * long version load immediate ...)
6518
+ */
6519
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6520
+
6521
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6522
+ * emit a comparison instruction for the first compare in a sequence of
6523
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6524
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6525
+ * compare are saved in prep_seq and the compare instructions are saved in
6526
+ * gen_seq.  They will be emitted when all the compares in the conditional
6527
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6528
+ * for op0 and op1.
6529
+ *
6530
+ *
6531
+ * ZipCPU---???
6532
+ */
6533
+
6534
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6535
+ * prepares to emit a conditional comparison within a sequence of conditional
6536
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6537
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6538
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6539
+ * emitted when all the compares in the conditional comparison are generated
6540
+ * without error.  The pPREV expression is the result of a prior call to either
6541
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6542
+ * PREV and this comparison is not supported, otherwise the result must be the
6543
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6544
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6545
+ * on the compares.
6546
+ *
6547
+ *
6548
+ * ZipCPU --- ???
6549
+ */
6550
+
6551
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6552
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6553
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6554
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6555
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6556
+ *
6557
+ *
6558
+ * ZipCPU -- ???
6559
+ */
6560
+
6561
+
6562
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6563
+ * C expression that specifies the maximum number of floating point
6564
+ * multiplications that should be emitted when expanding exponentiation by an
6565
+ * integer constant inline.  When this value is defined, exponentiation
6566
+ * requiring more than this number of multiplications is implemented by calling
6567
+ * the system library's pow, powf, or powl routines.  The default value
6568
+ places no upper bound on the multiplication count.
6569
+ *
6570
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6571
+ * ready for this macro.
6572
+ */
6573
+
6574
+
6575
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6576
+ * register any extra include files for the target.  The parameter stdinc
6577
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6578
+ * system root directory.  The parameter PFX is the prefix for the GCC
6579
+ * directoiry.
6580
+ *
6581
+ *
6582
+ * ZipCPU---None yet.
6583
+ */
6584
+
6585
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6586
+ * register any extrra include files for the target before any standard headers.
6587
+ * The parameter stdinc indicates if normal include files are present.
6588
+ *
6589
+ * ZipCPU --- None.
6590
+ */
6591
+
6592
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6593
+ * for the target.  The parameter path is the integer to register.  On Darwin
6594
+ * systems, this is used for Framework includes, which have semantics that are
6595
+ * different from -I.
6596
+ *
6597
+ *
6598
+ * ZipCPU --- None.
6599
+ */
6600
+
6601
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6602
+ * safe to use a local alias for a virtual function FN when constructing
6603
+ * thunks, false otherwise.  By default, the macro returns true for all
6604
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6605
+ * false otherwise.
6606
+ *
6607
+ *
6608
+ * ZipCPU --- ???
6609
+ */
6610
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6611
+
6612
+
6613
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6614
+ * variable containing target-specific format checking information for the
6615
+ * -Wformat option.  The default is to have no target-specific format checks.
6616
+ *
6617
+ * ZipCPU --- Default
6618
+ */
6619
+
6620
+/* TARGET_N_FORMAT_TYPES
6621
+ *
6622
+ * ZipCPU --- Default
6623
+ */
6624
+
6625
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6626
+ * a global variable containing target-specific format overrides for the
6627
+ * -Wformat option.  The default is to have no target specific format overrides.
6628
+ *
6629
+ * ZipCPU --- Default
6630
+ */
6631
+
6632
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6633
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6634
+ *
6635
+ * If defined, the (first) macro is the name of a global variable containing
6636
+ * target-specific format overrides for the -Wformat option.
6637
+ */
6638
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6639
+ * optional initialization routine for target specific customizations of the
6640
+* system printf and scanf formatter settings.
6641
+ */
6642
+
6643
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6644
+ * macro returns the diagnostic message when it is illegal to pass an argument
6645
+ * VAL to function FN with prototype TLIST.
6646
+ *
6647
+ * ZipCPU---Default.
6648
+ */
6649
+
6650
+/* TARGET_INVALID_CONVERSION
6651
+ * TARGET_INVALID_UNARY_OP
6652
+ * TARGET_INVALID_BINARY_OP
6653
+ * TARGET_INVALID_PARAMETER_TYPE
6654
+ * TARGET_INVALID_RETURN_TYPE
6655
+ * TARGET_PROMOTED_TYPE
6656
+ * TARGET_CONVERT_TO_TYPE
6657
+ * TARGET_USE_JCR_SECTION_TYPE
6658
+ * OBJC_JBLEN
6659
+ * LIBGCC2_UNWIND_ATTRIBUTE
6660
+ * TARGET_UPDATE_STACK_BOUNDARY
6661
+ * TARGET_GET_DRAP_RTX
6662
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6663
+ */
6664
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6665
+ * instructions to synthesize a constant. If there is another constant already
6666
+ * in a register that is close enough in value then it is preferable that the
6667
+ * new constant is computed from the register using immediate addition or
6668
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6669
+ * constant we also add a lower and an upper constant anchor to the available
6670
+ * expressions.  These are then queried when encountering new constants.  The
6671
+ * anchors are computed by rounding the constant up and down to a multiple of
6672
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6673
+ * positive value accepted by immediate-add plus one.  We currently assume that
6674
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6675
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6676
+ * to 0x8000.  The default value is zero, which disables this optimization.
6677
+ *
6678
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6679
+ * access registers plus immediates.  To use this, we *need* this capability.
6680
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6681
+ * signed immediate offsets)
6682
+ *
6683
+ * On ZipCPU---2^17
6684
+ */
6685
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
6686
+
6687
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
6688
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
6689
+ * if address Sanitizer is not supported by the target.
6690
+ */
6691
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
6692
+
6693
+/* TARGET_MEMMODEL_CHECK
6694
+ */
6695
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
6696
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
6697
+ */
6698
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
6699
+ * functions.  The support includes the assembler, linker, and dynamic linker.
6700
+ * The default value of this hook is based on target's libc.
6701
+ */
6702
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
6703
+
6704
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
6705
+ * an appropriate alignment in bits for an atomic object of machine mode
6706
+ * MODE.  If 0 is returned then the default alignment for the specified mode
6707
+ * is used.
6708
+ *
6709
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
6710
+ */
6711
+
6712
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
6713
+ * assignments that may raise floating-point exceptions to raise exceptions
6714
+ * corresponding to the arithmetic operation whose result was successfully
6715
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
6716
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
6717
+ * appropriate points in the compare-and-exchange sequence.  This hook should
6718
+ * set *hold to an expression equivalent
6719
+ *
6720
+ * ZipCPU --- ???
6721
+ */
6722
+
6723
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
6724
+ * the compilation unit and no named sections are available.  It is called once
6725
+ * for each symbol that must be recorded in the offload function and variable
6726
+ * table.
6727
+ *
6728
+ * ZipCPU --- Offloaded functions?
6729
+ */
6730
+
6731
+/* TARGET_OFFLOAD_OPTIONS
6732
+ *
6733
+ * ZipCPU---none defined
6734
+ */
6735
+
6736
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
6737
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
6738
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
6739
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
6740
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
6741
+ * HOST_WIDE_INT representation.
6742
+ *
6743
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
6744
+ * are wider than DImode ...)
6745
+ */
6746
+#define        TARGET_SUPPORTS_WIDE_INT        0
6747
+
6748
+
6749
+/* Now, for the prototype functions ...*/
6750
+// These have been moved to zip-protos.h
6751
+
6752
+// extern void zip_init_builtins(void);
6753
+// extern void zip_asm_output_anchor(rtx x);
6754
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
6755
+// extern void zip_asm_trampoline_template(FILE *);
6756
+// extern void zip_initial_elimination_offset(int from, int to);
6757
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
6758
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
6759
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
6760
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
6761
+// extern      int zip_address_operand(rtx op);
6762
+// extern      int zip_const_address_operand(rtx op);
6763
+// extern void zip_expand_prologue(void);
6764
+// extern void zip_expand_epilogue(void);
6765
+// extern bool zip_gen_move_rtl(rtx, rtx);
6766
+// extern bool zip_load_address_lod(rtx, rtx);
6767
+// extern bool zip_load_address_sto(rtx, rtx);
6768
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
6769
+// extern void zip_print_operand_address(FILE *fp, rtx x);
6770
+// extern bool zip_use_return_insn(void);
6771
+
6772 111 dgisselq
+#define        UQQmode USQmode
6773
+#define        UHQmode USQmode
6774
+#define        UHAmode USAmode
6775
+#define        QQmode  SQmode
6776
+#define        HQmode  SQmode
6777 102 dgisselq
+#define        QImode  SImode
6778
+#define        HImode  SImode
6779 111 dgisselq
+#define        QAmode  SAmode
6780
+#define        HAmode  SAmode
6781 102 dgisselq
+
6782
+#include "insn-modes.h"
6783
+#include "zip-protos.h"
6784
+
6785
+#endif /* GCC_ZIP_H */
6786
+
6787
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
6788
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
6789 122 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-04-06 17:47:12.387591487 -0400
6790
@@ -0,0 +1,2262 @@
6791 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6792
+;;
6793
+;; Filename:   zip.md
6794
+;;
6795
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
6796
+;;
6797
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
6798
+;;             GNU compiler collection (GCC).
6799
+;;
6800
+;;
6801
+;; Creator:    Dan Gisselquist, Ph.D.
6802
+;;             Gisselquist Technology, LLC
6803
+;;
6804
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6805
+;;
6806
+;; Copyright (C) 2015, Gisselquist Technology, LLC
6807
+;;
6808
+;; This program is free software (firmware): you can redistribute it and/or
6809
+;; modify it under the terms of  the GNU General Public License as published
6810
+;; by the Free Software Foundation, either version 3 of the License, or (at
6811
+;; your option) any later version.
6812
+;;
6813
+;; This program is distributed in the hope that it will be useful, but WITHOUT
6814
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
6815
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6816
+;; for more details.
6817
+;;
6818
+;; License:    GPL, v3, as defined and found on www.gnu.org,
6819
+;;             http://www.gnu.org/licenses/gpl.html
6820
+;;
6821
+;;
6822
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6823
+;;
6824
+;;
6825
+;; - Immediate integer operand constraints
6826
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
6827
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
6828
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
6829
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
6830
+;;     'R'     0...31                                          (Shift value)
6831
+;; - Memory constraints
6832 111 dgisselq
+;;     "Q"     Op-B capable references to memory
6833
+;;     "S"     References to constant memory
6834 102 dgisselq
+;; - Address constraints
6835 111 dgisselq
+;;     "U"     Op-B capable address that references to memory
6836
+;;     "T"     Constant memory addresses
6837 102 dgisselq
+(define_constraint "M"
6838
+  "An 13-bit signed immediate such as a MOV instruction can handle"
6839
+  (and (match_code "const_int")
6840
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
6841
+(define_constraint "N"
6842
+  "An 14-bit signed immediate offset such as an Op-B register offset"
6843
+  (and (match_code "const_int")
6844
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
6845
+(define_constraint "O"
6846
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
6847
+  (and (match_code "const_int")
6848
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
6849
+(define_constraint "R"
6850
+  "Bits that a value may be shifted"
6851
+  (and (match_code "const_int")
6852
+       (match_test "(ival < 32) && (ival >= 0)")))
6853
+;;
6854
+;
6855
+;
6856
+; Our builtin functions, by identifier
6857
+;
6858
+(define_constants
6859 117 dgisselq
+       [(UNSPEC_RTU             1)
6860
+       (UNSPEC_HALT             2)
6861
+       (UNSPEC_IDLE             3)
6862
+       (UNSPEC_SYSCALL          4)
6863
+       (UNSPEC_SAVE_CONTEXT     5)
6864
+       (UNSPEC_RESTORE_CONTEXT  6)
6865
+       (UNSPEC_BITREV           7)
6866
+       (UNSPEC_GETUCC           8)
6867
+       (UNSPEC_GETCC            9)
6868
+       (UNSPEC_LDILO           10)
6869 102 dgisselq
+       ])
6870
+;
6871
+;
6872
+; Registers by name
6873
+(define_constants
6874
+  [(RTN_REG            0)      ; Return address register
6875
+   (RTNV_REG           1)      ; Subroutine return value register
6876
+   (AP_REG             10)     ; Hopefully never used
6877
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
6878
+   (FP_REG             12)
6879
+   (SP_REG             13)
6880
+   (CC_REG             14)
6881
+   (PC_REG             15)
6882
+  ])
6883
+;
6884
+;
6885
+;
6886
+
6887
+;; Predicates
6888
+(define_predicate "zip_const_address_operand_p"
6889
+       (match_code "symbol_ref,const,label_ref,code_label")
6890
+{
6891
+       return zip_const_address_operand(op);
6892
+})
6893
+
6894
+(define_predicate "zip_address_operand_p"
6895
+       (match_code "reg,plus")
6896
+{
6897 111 dgisselq
+       return zip_pd_opb_operand(op);
6898 102 dgisselq
+})
6899
+
6900 111 dgisselq
+(define_predicate "zip_opb_operand_p"
6901 122 dgisselq
+       (match_code "reg,plus,const_int,subreg")
6902 111 dgisselq
+{
6903
+       return zip_pd_opb_operand(op);
6904
+})
6905
+
6906 122 dgisselq
+(define_predicate "zip_opb_immv_p"
6907
+       (match_code "const_int")
6908
+{
6909
+       return (INTVAL(op)<((1<<13)-1))&&(INTVAL(op)>=-((1<<13)));
6910
+})
6911
+
6912 111 dgisselq
+(define_predicate "zip_opb_single_operand_p"
6913 122 dgisselq
+       (match_code "reg,subreg,const_int")
6914 111 dgisselq
+{
6915
+       return zip_pd_opb_operand(op);
6916
+})
6917
+
6918 102 dgisselq
+(define_predicate "zip_mov_operand_p"
6919
+       (match_code "reg,plus")
6920
+{
6921
+       return zip_pd_mov_operand(op);
6922
+})
6923
+
6924
+(define_predicate "zip_memory_operand_p"
6925
+       (match_code "mem")
6926
+{
6927 111 dgisselq
+       return zip_pd_opb_operand(XEXP(op,0));
6928 102 dgisselq
+})
6929
+
6930 111 dgisselq
+(define_predicate "zip_imm_operand_p"
6931
+       (match_code "const_int")
6932
+{
6933
+       return zip_pd_imm_operand(op);
6934
+})
6935
+
6936
+(define_predicate "zip_mvimm_operand_p"
6937
+       (match_code "const_int")
6938
+{
6939
+       return zip_pd_mvimm_operand(op);
6940
+})
6941
+
6942
+(define_predicate "zip_movdst_operand_p"
6943
+       (match_code "mem,reg,subreg")
6944
+{
6945
+       if (MEM_P(op)) // Check for valid store address
6946
+               return zip_pd_opb_operand(XEXP(op,0));
6947 122 dgisselq
+       else if (SUBREG_P(op))
6948
+               return 1;
6949
+       else if ((REG_P(op))||(SUBREG_P(op)))
6950
+               return register_operand(op, GET_MODE(op));
6951 111 dgisselq
+       return 1;
6952
+})
6953
+
6954
+(define_predicate "zip_movsrc_operand_p"
6955
+       (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
6956
+{
6957
+       if (MEM_P(op))
6958
+               return zip_pd_opb_operand(XEXP(op,0));
6959
+       else if (GET_CODE(op)==PLUS)
6960
+               return zip_pd_opb_operand(op);
6961 122 dgisselq
+       else if (SUBREG_P(op)) {
6962
+               //; As far as predicates are concerned, subregs must be valid.
6963
+               //; The details of them are settled within the constraints.
6964
+               return 1;
6965
+       } else if ((REG_P(op))||(SUBREG_P(op)))
6966
+               return register_operand(op,SImode);
6967
+       else if (CONST_INT_P(op))
6968
+               return 1;
6969 111 dgisselq
+       return 1;
6970
+})
6971
+
6972 102 dgisselq
+;; Constraints
6973
+;
6974
+(define_memory_constraint "S"
6975
+       "Any memory referenced by a constant address, possibly unknown at compile time"
6976
+       (and (match_code "mem")
6977
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
6978
+(define_memory_constraint "Q"
6979
+       "Any memory addressed suitably for a load or store instruction"
6980
+       (and (match_code "mem")
6981
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
6982
+(define_address_constraint "U"
6983
+       "An address suitable for a load or store instruction"
6984
+       (and (match_code "reg,plus")
6985
+               (match_test "zip_ct_address_operand(op)")))
6986
+(define_address_constraint "T"
6987
+       "Any constant address, to include those made by symbols unknown at compile time"
6988
+       (and (match_code "label_ref,code_label,symbol_ref,const")
6989
+               (match_test "zip_ct_const_address_operand(op)")))
6990
+;
6991
+;
6992
+;; Attributes
6993
+;
6994
+(define_attr "predicable"  "no,yes" (const_string "yes"))
6995
+(define_attr "conditional" "no,yes" (const_string "no"))
6996
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
6997
+;
6998
+; Mode attributes
6999
+; (define_mode_iterator ZI [QI HI SI])
7000
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
7001
+(define_mode_iterator ZI [SI])
7002
+(define_mode_attr zipa [(SI "")])
7003
+;
7004
+;
7005
+;
7006
+;; Instructions
7007
+;
7008
+; (define_insn
7009
+;      optional name
7010
+;      RTL template -- a vector of incomplete RTL expressions describing the
7011
+;              semantics of the instruction.  It is incomplete because it may
7012
+;              contain match_operand, match_operator, and match_dup expressions
7013
+;      The condition --- contains a C expression, may be an empty string
7014
+;      output template or output statement--fragment of C code returning a str
7015
+;      Attributes --
7016
+;      )
7017
+;
7018
+; (match_operand:m n predicate constraint)
7019
+;      Placeholder for operand #n of the instruction
7020
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
7021
+;                              (expression, machine mode)
7022
+;              we can build functions:
7023
+;                      "isregister"    to describe a register
7024
+;                      "isimmediate"   to describe an immediate
7025
+;                      "offsetreg"     to describe a register plus offset
7026
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
7027
+;              But ... functions "address_operand", "immediate_operand",
7028
+;                      "register_operand", "indirect_operand"
7029
+;              "comparison_operatot" and "ordered_comparison_operator"
7030
+;              are also available--be aware, they include more comparisons
7031
+;              than Zip CPU can do.
7032
+;
7033
+;
7034
+;
7035
+;
7036
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7037
+;;
7038
+;; Move instructions: both
7039
+;      (arbitrary) from variables to variables, but this gets
7040
+;              expanded into:
7041
+;      from registers to registers
7042
+;      from immediates to registers
7043
+;;
7044
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7045
+;
7046
+;
7047
+;
7048
+(define_expand "mov<mode>"
7049 111 dgisselq
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "")
7050
+               (match_operand:ZI 1 "general_operand" ""))]
7051 102 dgisselq
+       ""
7052 111 dgisselq
+       {//; Everything except mem=const or mem=mem can be done easily
7053
+       //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
7054
+       //; fprintf(stderr, "ZIP-GEN-MOVE\n");
7055
+       //; zip_debug_rtx_pfx("FROM: ", operands[1]);
7056
+       //; zip_debug_rtx_pfx("TO  : ", operands[0]);
7057
+
7058
+       //; Need to load into a register between memory slots
7059
+       if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
7060
+               //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
7061
+               if (can_create_pseudo_p()) {
7062
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
7063
+                       emit_insn(gen_movsi(tmp,operands[1]));
7064
+                       operands[1] = tmp;
7065
+               }
7066 102 dgisselq
+       }
7067 111 dgisselq
+
7068
+       //; Op[0] has a bad address, need to legitimize it
7069
+       if ((MEM_P(operands[0]))&&
7070
+               ((zip_const_address_operand(XEXP(operands[0],0)))
7071
+               ||(!zip_pd_opb_operand(XEXP(operands[0],0))))
7072
+               )
7073
+               {
7074
+               //; fprintf(stderr, "GEN-MOVSI: Not to a MEM(REG)\n");
7075
+               if (can_create_pseudo_p()) {
7076
+                       rtx tmp = gen_reg_rtx(Pmode);
7077
+                       //; Load the address into a register
7078
+                       emit_insn(gen_movsi(tmp,XEXP(operands[0],0)));
7079
+                       XEXP(operands[0],0) = tmp;
7080
+                       mark_reg_pointer(tmp,1);
7081
+               }
7082
+       }
7083
+       //; Op[1] is a constant.  Need to load into a register before we can
7084
+       //; place it into memory.
7085
+       if ((MEM_P(operands[0]))&&
7086
+               ((CONSTANT_P(operands[1]))
7087
+               ||(CONST_INT_P(operands[1])))) {
7088
+               //; fprintf(stderr, "GEN-MOVSI: CONST -> MEM\n");
7089
+               //; zip_debug_rtx_pfx("MEM  : ", operands[0]);
7090
+               //; zip_debug_rtx_pfx("CONST: ", operands[1]);
7091
+               if (can_create_pseudo_p()) {
7092
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[0]));
7093
+                       emit_insn(gen_movsi(tmp,operands[1]));
7094
+                       operands[1] = tmp;
7095
+               }
7096
+       }
7097
+       //; Op[1] has a bad address, need to legitimize it
7098
+       if ((MEM_P(operands[1]))&&
7099
+               //; (!REG_P(XEXP(operands[1],0)))
7100
+               ((zip_const_address_operand(XEXP(operands[1],0)))
7101 122 dgisselq
+               ||(!zip_pd_opb_operand(XEXP(operands[1],0))))) {
7102 111 dgisselq
+               //; fprintf(stderr, "GEN-MOVSI: Not from a MEM(REG)\n");
7103
+               if (can_create_pseudo_p()) {
7104
+                       rtx tmp = gen_reg_rtx(Pmode);
7105
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7106
+                       XEXP(operands[1],0) = tmp;
7107
+               } else if (REG_P(operands[0])) { //; Can we steal Op[0]'s reg?
7108
+                       rtx tmp = operands[0];
7109
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7110
+                       XEXP(operands[1],0) = tmp;
7111
+               }
7112
+       }
7113
+       }
7114 102 dgisselq
+       [(set_attr "ccresult" "unchanged")])
7115 111 dgisselq
+(define_insn "movsi_raw"
7116
+       [(set (match_operand:SI 0 "zip_movdst_operand_p" "=r,Q,r,r")
7117
+               (match_operand:SI 1 "zip_movsrc_operand_p" "r,r,Q,i"))]
7118 122 dgisselq
+       "(register_operand(operands[0],SImode))||(register_operand(operands[1],SImode))"
7119 111 dgisselq
+       "@
7120
+       MOV\t%1,%0
7121
+       STO\t%1,%0
7122
+       LOD\t%1,%0
7123
+       LDI\t%1,%0"
7124
+       [(set_attr "ccresult" "unchanged")])
7125 102 dgisselq
+(define_insn "mov<mode>_reg"   ; Register to register move
7126
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7127
+               (match_operand:ZI 1 "register_operand" "r"))]
7128
+       ""
7129
+       "MOV    %1,%0"
7130
+       [(set_attr "ccresult" "unchanged")])
7131
+(define_insn "mov<mode>_reg_off"       ; Register to register move
7132
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7133
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7134 111 dgisselq
+                       (match_operand:ZI 2 "zip_mvimm_operand_p" "M")))
7135
+               ]
7136 102 dgisselq
+       ""
7137
+       "MOV    %2(%1),%0"
7138
+       [(set_attr "ccresult" "unchanged")])
7139 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
7140
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
7141
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7142
+;      ""
7143
+;      "LOD    %1,%0"
7144
+;      [(set_attr "ccresult" "unchanged")])
7145
+;(define_insn "mov<mode>_sto"  ; Store into memory
7146
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7147
+;              (match_operand:ZI 1 "register_operand" "r"))]
7148
+;      ""
7149
+;      "STO    %1,%0"
7150
+;      [(set_attr "ccresult" "unchanged")])
7151
+(define_expand "mov<mode>_lod" ; Load from memory
7152 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7153
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7154 103 dgisselq
+       "")
7155
+(define_insn "*movsi_lod"
7156
+       [(set (match_operand:SI 0 "register_operand" "=r")
7157 111 dgisselq
+               (match_operand:SI 1 "zip_memory_operand_p" ""))]
7158 102 dgisselq
+       ""
7159 103 dgisselq
+       "LOD\t%1,%0"
7160
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7161 111 dgisselq
+;(define_insn "*movsi_lod_off"
7162
+       ;[(set (match_operand:SI 0 "register_operand" "=r")
7163
+               ;(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
7164
+                       ;(match_operand:SI 2 "const_int_operand" "N"))))]
7165
+       ;""
7166
+       ;"LOD\t%2(%1),%0"
7167
+       ;[(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7168 103 dgisselq
+(define_expand "mov<mode>_sto" ; Store into memory
7169 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7170
+               (match_operand:ZI 1 "register_operand" "r"))]
7171 103 dgisselq
+       "")
7172
+(define_insn "*movsi_sto"
7173 111 dgisselq
+       [(set (match_operand:SI 0 "zip_memory_operand_p" "=Q")
7174 103 dgisselq
+               (match_operand:SI 1 "register_operand" "r"))]
7175 102 dgisselq
+       ""
7176 111 dgisselq
+       "STO\t%1,%0"
7177 103 dgisselq
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7178 111 dgisselq
+;(define_insn "*movsi_sto_off"
7179
+       ;[(set (mem:SI (plus:SI
7180
+                       ;(match_operand:SI 0 "register_operand" "r")
7181
+                       ;(match_operand:SI 1 "const_int_operand" "N")))
7182
+               ;(match_operand:SI 2 "register_operand" "r"))]
7183
+       ;""
7184
+       ;"STO\t%2,%1(%0)"
7185
+       ;[(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7186 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
7187
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7188
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
7189
+       ""
7190
+       "LDI    %1,%0"
7191
+       [(set_attr "ccresult" "unchanged")])
7192
+;
7193
+;
7194
+;
7195
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7196
+;;
7197
+;; Load and store multiple values
7198
+;;
7199
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7200
+;
7201
+; So far, from the code I've seen from GCC's output,
7202
+; these instructions do not appear to be necessary.
7203
+;
7204
+;(define_insn "load_multiple"
7205
+;      for(a=0; a<%2; a++)
7206
+;              LOD a(%1),%0+a
7207
+;(define_insn "store_multiple"
7208
+;      for(a=0; a<%2; a++)
7209
+;              STO %0+a,a(%1)
7210
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
7211
+;
7212
+;
7213
+;
7214
+;
7215
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7216
+;;
7217
+;; General arithmetic instructions
7218
+;;
7219
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7220
+;
7221
+;
7222
+;
7223
+;
7224 111 dgisselq
+(define_expand "add<mode>3" ; Fastest/best instruction always goes first
7225 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7226 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7227 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7228
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))
7229
+               ]) ])
7230 111 dgisselq
+(define_insn "*addsi3_reg" ; Fastest/best instruction always goes first
7231 122 dgisselq
+       [(set (match_operand:SI 0 "register_operand" "=r")
7232
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7233
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7234
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7235 102 dgisselq
+       ""
7236
+       "ADD    %2,%0"
7237
+       [(set_attr "ccresult" "set")])
7238
+(define_insn "add<mode>3_off" ; Fastest/best instruction always goes first
7239
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7240 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7241
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7242 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7243
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7244 102 dgisselq
+       ""
7245
+       "ADD    %3+%2,%0"
7246
+       [(set_attr "ccresult" "set")])
7247
+;
7248
+;
7249
+;
7250 103 dgisselq
+(define_expand "sub<mode>3"
7251 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7252 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7253 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7254 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])])
7255 111 dgisselq
+(define_insn "sub<mode>3_reg"
7256 103 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7257
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7258 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7259 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7260 102 dgisselq
+       ""
7261
+       "SUB    %2,%0"
7262
+       [(set_attr "ccresult" "set")])
7263
+(define_insn "sub<mode>3_off"
7264
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7265 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7266
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7267 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7268
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7269 102 dgisselq
+       ""
7270
+       "SUB    %3+%2,%0"
7271
+       [(set_attr "ccresult" "set")])
7272
+(define_insn "mul<mode>3"
7273
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7274
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
7275
+                       (match_operand:ZI 2 "register_operand" "r")))
7276 122 dgisselq
+       (clobber (match_scratch:ZI 3 "=r"))
7277
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7278 102 dgisselq
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7279
+       ""
7280
+       "MOV    %1,%0
7281
+       MPYS    %2,%0
7282
+       MOV     %1,%3
7283
+       ROL     16,%3
7284
+       MPYS    %2,%3
7285
+       ROL     16,%3
7286
+       AND     0x0ffff,%3
7287
+       ADD     %3,%0
7288
+       MOV     %2,%3
7289
+       ROL     16,%3
7290
+       MPYS    %1,%3
7291
+       ROL     16,%3
7292
+       AND     0x0ffff,%3
7293
+       ADD     %3,%0"
7294
+       [(set_attr "ccresult" "unknown")])
7295
+
7296 111 dgisselq
+(define_expand "div<mode>3"
7297 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7298 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7299 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7300
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7301 111 dgisselq
+       "(ZIP_DIVIDE)")
7302
+(define_insn "div<mode>3_reg"
7303
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7304
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7305 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7306
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7307 111 dgisselq
+       "(ZIP_DIVIDE)"
7308 102 dgisselq
+       "DIVS   %2,%0"
7309
+       [(set_attr "ccresult" "set")])
7310
+(define_insn "div<mode>3_off"
7311
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7312 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7313
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7314 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7315
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7316 111 dgisselq
+       "(ZIP_DIVIDE)"
7317 102 dgisselq
+       "DIVS   %3+%2,%0"
7318
+       [(set_attr "ccresult" "set")])
7319 111 dgisselq
+(define_expand "udiv<mode>3"
7320 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7321 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7322 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7323
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7324 111 dgisselq
+       "(ZIP_DIVIDE)")
7325
+(define_insn "udiv<mode>3_reg"
7326
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7327
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7328 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7329
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7330 111 dgisselq
+       "(ZIP_DIVIDE)"
7331 102 dgisselq
+       "DIVU   %2,%0"
7332
+       [(set_attr "ccresult" "set")])
7333
+(define_insn "udiv<mode>3_off"
7334
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7335 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7336
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7337 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7338
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7339 111 dgisselq
+       "(ZIP_DIVIDE)"
7340 102 dgisselq
+       "DIVU   %3+%2,%0"
7341
+       [(set_attr "ccresult" "set")])
7342
+;;
7343
+;; modsi3
7344
+;; umodsi3
7345
+;;
7346
+(define_insn "umin<mode>3"
7347
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7348
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
7349
+                       (match_operand:ZI 2 "register_operand" "r")))
7350 122 dgisselq
+       (clobber (reg:CC CC_REG))
7351 102 dgisselq
+       ]
7352
+       ""
7353
+       "CMP    %0,%2
7354
+       MOV.C   %2,%0"
7355
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7356
+(define_insn "umax<mode>3"
7357
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7358
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
7359
+                       (match_operand:ZI 2 "register_operand" "r")))
7360 122 dgisselq
+       (clobber (reg:CC CC_REG))
7361 102 dgisselq
+       ]
7362
+       ""
7363
+       "CMP    %2,%0
7364
+       MOV.C   %2,%0"
7365
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7366
+(define_insn "smin<mode>3"
7367
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7368
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
7369
+                       (match_operand:ZI 2 "register_operand" "r")))
7370 122 dgisselq
+       (clobber (reg:CC CC_REG))
7371 102 dgisselq
+       ]
7372
+       ""
7373
+       "CMP    %2,%0
7374
+       MOV.GT  %2,%0"
7375
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7376
+(define_insn "smax<mode>3"
7377
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7378
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
7379
+                       (match_operand:ZI 2 "register_operand" "r")))
7380 122 dgisselq
+       (clobber (reg:CC CC_REG))
7381 102 dgisselq
+       ]
7382
+       ""
7383
+       "CMP    %0,%2
7384
+       MOV.LT  %2,%0"
7385
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7386 111 dgisselq
+(define_expand "and<mode>3"
7387 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7388 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7389 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7390
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])])
7391 111 dgisselq
+(define_insn "and<mode>3_reg"
7392
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7393
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
7394 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7395
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7396 102 dgisselq
+       ""
7397
+       "AND    %2,%0"
7398
+       [(set_attr "ccresult" "set")])
7399
+(define_insn "and<mode>3_off"
7400
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7401
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
7402
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7403 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7404
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7405 102 dgisselq
+       ""
7406
+       "AND    %3+%2,%0"
7407
+       [(set_attr "ccresult" "set")])
7408 111 dgisselq
+(define_expand "ior<mode>3"
7409 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7410 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7411 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7412
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])])
7413 111 dgisselq
+(define_insn "ior<mode>3_reg"
7414
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7415
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
7416 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7417
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7418 102 dgisselq
+       ""
7419
+       "OR     %2,%0"
7420
+       [(set_attr "ccresult" "set")])
7421
+(define_insn "ior<mode>3_off"
7422
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7423
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
7424
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7425 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7426
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7427 102 dgisselq
+       ""
7428
+       "OR     %3+%2,%0"
7429
+       [(set_attr "ccresult" "set")])
7430 111 dgisselq
+(define_expand "xor<mode>3"
7431 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7432 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7433 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7434
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7435
+       "")
7436 111 dgisselq
+(define_insn "xor<mode>3_reg"
7437
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7438
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
7439 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7440
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7441 102 dgisselq
+       ""
7442
+       "XOR    %2,%0"
7443
+       [(set_attr "ccresult" "set")])
7444
+(define_insn "xor<mode>3_off"
7445
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7446
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
7447
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7448 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7449
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7450 102 dgisselq
+       ""
7451
+       "XOR    %3+%2,%0"
7452
+       [(set_attr "ccresult" "set")])
7453
+;(define_insn "addv<mode>4"
7454
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
7455
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
7456
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
7457 122 dgisselq
+       ;(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
7458 102 dgisselq
+                       ;(label_ref (match_operand 3))
7459
+                       ;(pc)))]
7460
+       ;""
7461
+       ;"MOV   %1,%0
7462
+       ;ADD    %2,%0
7463
+       ;BV     %3"
7464
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7465
+;;(define_insn "subvsi4"
7466
+;;     MOV     %1,%0
7467
+;;     SUB     %2,%0
7468
+;;     BV      %3
7469
+;;(mulvsi4)
7470
+;;(define_insn "uaddvsi4"
7471
+;;     ADD     %2,%0
7472
+;;     BC      %3
7473
+;;(define_insn "usubvsi4"
7474
+;;     MOV     %1,%0
7475
+;;     SUB     %2,%0
7476
+;;     BC      %3
7477
+;;
7478
+;; (define_insn "umulvsi4"
7479
+;;     ... ???)
7480
+;;
7481
+(define_insn "ashr<mode>3"
7482
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7483
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7484 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
7485
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7486 102 dgisselq
+       ""
7487
+       "ASR    %2,%0"
7488
+       [(set_attr "ccresult" "set")])
7489 111 dgisselq
+(define_insn "ashl<mode>3"
7490
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7491
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
7492 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
7493
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7494 111 dgisselq
+       ""
7495 122 dgisselq
+       "LSL    %2,%0"
7496 111 dgisselq
+       [(set_attr "ccresult" "set")])
7497 102 dgisselq
+(define_insn "lshr<mode>3"
7498
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7499
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
7500 122 dgisselq
+                       (match_operand:ZI 2 "register_operand" "rR")))
7501
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7502 102 dgisselq
+       ""
7503
+       "LSR    %2,%0"
7504
+       [(set_attr "ccresult" "set")])
7505
+(define_insn "rotl<mode>3"
7506
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7507
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
7508 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
7509
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7510 102 dgisselq
+       ""
7511
+       "ROL    %2,%0"
7512
+       [(set_attr "ccresult" "set")])
7513
+;
7514
+(define_insn "neg<mode>2"
7515
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7516
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
7517 122 dgisselq
+       (clobber (reg:CC CC_REG))]
7518 102 dgisselq
+       ""
7519
+       "NEG    %1,%0"
7520
+       [(set_attr "ccresult" "validzn")])
7521
+(define_insn "abs<mode>2"
7522
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7523
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
7524 122 dgisselq
+       (clobber (reg:CC CC_REG))]
7525 102 dgisselq
+       ""
7526
+       "TEST   %0
7527
+       NEG.LT  %0"
7528
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7529
+(define_insn "popcount<mode>2"
7530
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7531
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7532 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7533 102 dgisselq
+       ""
7534
+       "POPC   %1,%0"
7535
+       [(set_attr "ccresult" "set")])
7536
+(define_expand "parity<mode>2"
7537 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7538 102 dgisselq
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
7539 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
7540
+       (parallel [
7541
+               (set (match_dup 0) (and:ZI (match_dup 0) (const_int -2)))
7542
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
7543 102 dgisselq
+       ])
7544
+(define_insn "one_cmpl<mode>2"
7545
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7546
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
7547 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7548 102 dgisselq
+       ""
7549
+       "XOR    -1,%0"
7550
+       [(set_attr "ccresult" "set")])
7551
+;
7552
+;
7553
+;
7554
+;
7555 117 dgisselq
+;
7556 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7557
+;;
7558
+;; General arithmetic instructions -- double words
7559
+;;
7560
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7561
+;
7562
+;
7563
+;
7564 111 dgisselq
+(define_expand "movdi3"
7565
+       [(set (match_operand:DI 0 "nonimmediate_operand" "")
7566
+               (match_operand:DI 1 "general_operand" ""))])
7567
+(define_insn "movdi_lod"
7568
+       [(set (match_operand:DI 0 "register_operand" "=r")
7569 122 dgisselq
+               (mem:DI (match_operand:SI 1 "zip_opb_operand_p" "")))]
7570 111 dgisselq
+       ""
7571
+       {
7572 122 dgisselq
+               if (REG_P(operands[1]))
7573 111 dgisselq
+                       return "LOD\t(%1),%H0\n\tLOD\t1(%1),%L0";
7574 122 dgisselq
+               else if (GET_CODE(operands[1])==PLUS) {
7575
+                       if ((REG_P(XEXP(operands[1],0)))
7576
+                               &&(CONST_INT_P(XEXP(operands[1],1)))) {
7577 111 dgisselq
+                               static  char    buf[64];
7578
+                               sprintf(buf,
7579
+                                       "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
7580 122 dgisselq
+                                       INTVAL(XEXP(operands[1],1)),
7581
+                                       INTVAL(XEXP(operands[1],1)+1));
7582 111 dgisselq
+                               return buf;
7583
+                       }
7584 122 dgisselq
+               } return "BREAK";
7585 111 dgisselq
+       }
7586
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7587
+(define_insn "movdi_sto"
7588
+       [(set (mem:DI (match_operand:SI 0 "zip_opb_operand_p" ""))
7589
+               (match_operand:DI 1 "register_operand" "r"))]
7590
+       ""
7591
+       {
7592
+               if (REG_P(operands[0]))
7593
+                       return "STO\t%H0,(%1)\n\tSTO\t%L0,1(%1)";
7594
+               else if (GET_CODE(operands[0])==PLUS) {
7595
+                       if ((REG_P(XEXP(operands[0],0)))
7596
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
7597
+                               static  char    buf[64];
7598
+                               sprintf(buf,
7599
+                                       "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
7600
+                                       INTVAL(XEXP(operands[0],1)),
7601
+                                       INTVAL(XEXP(operands[0],1)+1));
7602
+                               return buf;
7603
+                       }
7604
+               } else return "BREAK";
7605
+       }
7606
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7607
+(define_insn "movdi_ldi"
7608
+       [(set (match_operand:DI 0 "register_operand" "=r")
7609
+               (match_operand:DI 1 "immediate_operand" "i"))]
7610
+       ""
7611
+       "LDI\t%H1,%H0\n\tLDI\t%L1,%L0"
7612
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7613 102 dgisselq
+(define_insn "adddi3" ; Fastest/best instruction always goes first
7614
+       [(set (match_operand:DI 0 "register_operand" "=r")
7615 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
7616 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7617 122 dgisselq
+       (clobber (reg:CC CC_REG))
7618 102 dgisselq
+       ]
7619
+       ""
7620
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
7621
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7622
+;
7623
+(define_insn "subdi3"
7624
+       [(set (match_operand:DI 0 "register_operand" "=r")
7625 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
7626 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
7627 122 dgisselq
+       (clobber (reg:CC CC_REG))
7628 102 dgisselq
+       ]
7629
+       ""
7630
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
7631
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7632
+;
7633
+(define_insn "anddi3"
7634
+       [(set (match_operand:DI 0 "register_operand" "=r")
7635
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
7636
+                       (match_operand:DI 2 "register_operand" "r")))
7637 122 dgisselq
+       (clobber (reg:CC CC_REG))
7638 102 dgisselq
+       ]
7639
+       ""
7640
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
7641
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7642
+;
7643
+(define_insn "iordi3"
7644
+       [(set (match_operand:DI 0 "register_operand" "=r")
7645
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
7646
+                       (match_operand:DI 2 "register_operand" "r")))
7647 122 dgisselq
+       (clobber (reg:CC CC_REG))
7648 102 dgisselq
+       ]
7649
+       ""
7650
+       "OR     %2,%0\n\tOR\t%H2,%H0"
7651
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7652
+;
7653
+(define_insn "xordi3"
7654
+       [(set (match_operand:DI 0 "register_operand" "=r")
7655
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
7656
+                       (match_operand:DI 2 "register_operand" "r")))
7657 122 dgisselq
+       (clobber (reg:CC CC_REG))
7658 102 dgisselq
+       ]
7659
+       ""
7660
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
7661
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7662
+;
7663
+(define_insn "negdi2"
7664
+       [(set (match_operand:DI 0 "register_operand" "=r")
7665 122 dgisselq
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))
7666
+       (clobber (reg:CC CC_REG))
7667
+       ]
7668 102 dgisselq
+       ""
7669
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
7670
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7671
+;
7672
+(define_insn "absdi2"
7673 122 dgisselq
+       [(set (match_operand:DI 0 "register_operand" "=r")
7674
+               (abs:DI (match_operand:DI 1 "register_operand" "0")))
7675
+       (clobber (match_scratch:SI 2 "=r"))
7676
+       (clobber (reg:CC CC_REG))
7677
+       ]
7678 102 dgisselq
+       ""
7679
+       "CLR    %2
7680
+       TEST    %H0             ; Problem, we can't tell conditions
7681
+       LDILO.LT        1,%2
7682
+       XOR.LT  -1,%L0
7683
+       XOR.LT  -1,%H0
7684
+       ADD     %2,%L0
7685 122 dgisselq
+       ADD.C   1,%H0"
7686 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7687
+(define_insn "one_cmpldi2"
7688
+       [(set (match_operand:DI 0 "register_operand" "=r")
7689
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
7690 122 dgisselq
+       (clobber (reg:CC CC_REG))
7691 102 dgisselq
+       ]
7692
+       ""
7693
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
7694
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7695
+(define_insn "umindi3"
7696
+       [(set (match_operand:DI 0 "register_operand" "=r")
7697
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
7698
+                       (match_operand:DI 2 "register_operand" "r")))
7699 122 dgisselq
+       (clobber (reg:CC CC_REG))
7700 102 dgisselq
+       ]
7701
+       ""
7702
+       "CMP    %H0,%H2
7703
+       CMP.Z   %L0,%L2
7704
+       MOV.C   %H2,%H0
7705
+       MOV.C   %L2,%L0"
7706
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7707
+(define_insn "umaxdi3"
7708
+       [(set (match_operand:DI 0 "register_operand" "=r")
7709
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
7710
+                       (match_operand:DI 2 "register_operand" "r")))
7711 122 dgisselq
+       (clobber (reg:CC CC_REG))
7712 102 dgisselq
+       ]
7713
+       ""
7714
+       "CMP    %H2,%H0
7715
+       CMP.Z   %L2,%L0
7716
+       MOV.C   %H2,%H0
7717
+       MOV.C   %L2,%L0"
7718
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7719
+(define_insn "popcountdi2"
7720
+       [(set (match_operand:SI 0 "register_operand" "=r")
7721 122 dgisselq
+               (popcount:SI (match_operand:DI 1 "register_operand" "r")))
7722 102 dgisselq
+       (clobber (match_scratch:SI 2 "=r"))
7723 122 dgisselq
+       (clobber (reg:CC CC_REG))
7724 102 dgisselq
+       ]
7725
+       ""
7726
+       "POPC   %L1,%0
7727
+       POPC    %H1,%2
7728
+       ADD     %2,%0"
7729
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
7730
+(define_expand "paritydi2"
7731
+       [(set (match_operand:SI 0 "register_operand" "=r")
7732
+               (popcount (match_operand:DI 1 "register_operand" "r")))
7733
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
7734
+       ])
7735 117 dgisselq
+;(define_insn "extendsidi2"
7736
+;      [(set (match_operand:DI 0 "register_operand" "=r")
7737
+;              (sign_extend:DI (match_operand:SI 0 "register_operand" "r")))]
7738
+;      ""
7739
+;      "TEST\t%1\nMOV\t%1,%L0\nCLR\t%L1\nLDI.LT\t-1,%L1"
7740
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7741
+;(define_insn "mulsidi3"
7742
+;      [(set (match_operand:DI 0 "register_operand" "=r")
7743
+;              (mult:SI (match_operand:SI 1 "register_operand" "%r")
7744
+;                      (match_operand:SI 2 "register_operand" "r")))
7745
+;      (clobber (match_scratch:SI 3 "=r"))]
7746
+;      ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7747
+;      ""
7748
+;      "MOV    %1,%L0
7749
+;      MPYS    %2,%L0                  ; L0 = R2 * R1
7750
+;      MOV     %1,%3                   ; R3 = R1
7751
+;      ROL     16,%3                   ; R3 = (R1 <<< 16)
7752
+;      MPYS    %2,%3                   ; R3 = (R1 <<< 16) * R2
7753
+;      ROL     16,%3                   ; R3 = upper bits of (R1<<<16)*R2
7754
+;      AND     0x0ffff,%3
7755
+;      ADD     %3,%L0                  ; L0 = L0 + R3 = L0  + (R1>>16)*R2
7756
+;      MOV     %2,%3
7757
+;      ROL     16,%3
7758
+;      MPYS    %1,%3
7759
+;      ROL     16,%3
7760
+;      AND     0x0ffff,%3
7761
+;      ADD     %3,%0"
7762
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7763
+
7764 102 dgisselq
+;
7765
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
7766
+;      mult:di, div:di, divu:di
7767
+;
7768
+;
7769
+;
7770
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7771
+;;
7772
+;; Conditional arithmetic instructions
7773
+;;
7774
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7775
+;
7776
+;
7777
+;
7778
+;
7779
+(define_expand "cstore<mode>4" ; Store 0 or 1 in %0 based on cmp between %2&%3
7780 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 2 "register_operand" "r")
7781
+               (match_operand:ZI 3 "zip_opb_operand_p" "rO")))
7782 102 dgisselq
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7783
+                       (match_operator 1 "ordered_comparison_operator"
7784 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
7785 102 dgisselq
+                       (const_int 1) (const_int 0)))]
7786
+       ""
7787
+       )
7788
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
7789
+       [(set (match_operand:SI 0 "register_operand" "=r")
7790
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
7791 122 dgisselq
+                       [(match_operand:DI 2 "register_operand" "r")
7792
+                               (match_operand:DI 3 "register_operand" "r")])
7793
+                       (const_int 1) (const_int 0)))
7794
+       (clobber (reg:CC CC_REG))]
7795 102 dgisselq
+       ""
7796
+       {
7797
+               switch(GET_CODE(operands[1])) {
7798
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
7799
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
7800
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
7801
+               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";
7802
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
7803
+               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";
7804
+               default:
7805
+                       gcc_unreachable();
7806
+               }
7807
+       }
7808
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7809
+;
7810
+;
7811
+;
7812
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7813
+;;
7814
+;; Comparison instructions, both compare and test
7815
+;;
7816
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7817
+;
7818
+;
7819
+;
7820
+;; This will only work so well, since the direction of the compare is
7821
+;; important in unsigned compares.
7822
+;;
7823 122 dgisselq
+(define_expand "cmp<mode>"
7824
+       [(set (reg:CC CC_REG) (compare:CC
7825
+               (match_operand:ZI 0 "register_operand" "r")
7826
+               (match_operand:ZI 1 "nonmemory_operand" "")))]
7827 102 dgisselq
+       ""
7828 122 dgisselq
+       {
7829
+               if (!zip_opb_operand_p(operands[1],SImode)) {
7830
+                       if (can_create_pseudo_p()) {
7831
+                               //; fprintf(stderr, "Generating pseudo register for compare\n");
7832
+                               rtx tmp = gen_reg_rtx(SImode);
7833
+                               emit_insn(gen_movsi(tmp,operands[1]));
7834
+                               operands[1] = tmp;
7835
+                       } else FAIL;
7836
+               }
7837
+       })
7838
+(define_insn "cmp<mode>_reg"
7839
+       [(set (reg:CC CC_REG) (compare:CC
7840
+               (match_operand:ZI 0 "register_operand" "r")
7841
+               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO")))]
7842
+       ""
7843 102 dgisselq
+       "CMP\t%1,%0"
7844
+       [(set_attr "ccresult" "set")])
7845
+(define_insn "cmp<mode>_off"
7846 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
7847
+               (match_operand:ZI 0 "register_operand" "r")
7848 117 dgisselq
+               (plus (match_operand:ZI 1 "register_operand" "r")
7849 122 dgisselq
+                       (match_operand 2 "zip_opb_immv_p" "N"))))]
7850 102 dgisselq
+       ""
7851
+       "CMP\t%2+%1,%0"
7852
+       [(set_attr "ccresult" "set")])
7853
+(define_insn "test<mode>"
7854 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_operand:ZI 0 "register_operand" "r")
7855
+                               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO"))
7856 102 dgisselq
+                       (const_int 0)))]
7857
+       ""
7858
+       "TEST   %1,%0"
7859
+       [(set_attr "ccresult" "set")])
7860
+(define_insn "test<mode>_off"
7861 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
7862
+               (and:ZI (match_operand:ZI 0 "register_operand" "r")
7863
+                       (plus:ZI
7864
+                               (match_operand:ZI 1 "register_operand" "r")
7865
+                               (match_operand:ZI 2 "zip_opb_immv_p" "N")))
7866
+               (const_int 0)))]
7867 102 dgisselq
+       ""
7868
+       "TEST   %2+%1,%0"
7869
+       [(set_attr "ccresult" "set")])
7870
+(define_insn "nop"
7871
+       [(const_int 0)]
7872
+       ""
7873
+       "NOOP"
7874
+       [(set_attr "ccresult" "unchanged")])
7875
+;
7876
+;
7877
+;
7878
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7879
+;;
7880
+;; Conditional execution predicates
7881
+;;
7882
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7883
+;
7884
+; Sadly, these aren't complete like they should be.  Although these are all of
7885
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
7886
+; other conditions then these.  That is, (cond_exec ...) is not as well
7887
+; recognized as (if_then_else ...).  So we have to duplicate things to support
7888
+; both methods.
7889
+;
7890
+(define_cond_exec
7891 122 dgisselq
+       [(ne (reg:CC CC_REG) (const_int 0))]
7892 102 dgisselq
+       ""
7893
+       "(NZ)"
7894
+       [(set_attr "conditional" "yes")])
7895
+(define_cond_exec
7896 122 dgisselq
+       [(lt (reg:CC CC_REG) (const_int 0))]
7897 102 dgisselq
+       ""
7898
+       "(LT)"
7899
+       [(set_attr "conditional" "yes")])
7900
+(define_cond_exec
7901 122 dgisselq
+       [(eq (reg:CC CC_REG) (const_int 0))]
7902 102 dgisselq
+       ""
7903
+       "(Z)"
7904
+       [(set_attr "conditional" "yes")])
7905
+(define_cond_exec
7906 122 dgisselq
+       [(gt (reg:CC CC_REG) (const_int 0))]
7907 102 dgisselq
+       ""
7908
+       "(GT)"
7909
+       [(set_attr "conditional" "yes")])
7910
+(define_cond_exec
7911 122 dgisselq
+       [(ge (reg:CC CC_REG) (const_int 0))]
7912 102 dgisselq
+       ""
7913
+       "(GE)"
7914
+       [(set_attr "conditional" "yes")])
7915
+(define_cond_exec
7916 122 dgisselq
+       [(ltu (reg:CC CC_REG) (const_int 0))]
7917 102 dgisselq
+       ""
7918
+       "(C)"
7919
+       [(set_attr "conditional" "yes")])
7920
+;
7921
+;
7922
+;
7923
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7924
+;;
7925
+;; Conditional move instructions, since these won't accept conditional
7926
+;;     execution RTL
7927
+;;
7928
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7929
+;
7930
+; // Look for #define HAVE_conditional_move to understand how these might be
7931
+; // used.
7932
+;
7933
+(define_insn "set_zero_or_one<mode>"
7934
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
7935
+                       (match_operator 1 "ordered_comparison_operator"
7936 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
7937 102 dgisselq
+                       (const_int 1) (const_int 0)))]
7938
+       ""
7939
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
7940
+       }
7941
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7942
+(define_insn "mov<mode>cc"
7943
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7944
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7945 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
7946 102 dgisselq
+                       (match_operand:ZI 2 "general_operand" "rio")
7947
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
7948
+       ""
7949
+       {
7950
+       return zip_movsicc(operands[0], operands[1], operands[2], operands[3]);
7951
+       }
7952
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7953
+(define_insn "add<mode>cc"
7954
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
7955
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7956 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
7957 102 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
7958
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
7959
+                       (match_dup 0)))]
7960
+       ""
7961
+       {
7962
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
7963
+       }
7964
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
7965
+;
7966
+;
7967
+;(define_expand "mov<mode>cc"
7968
+;      [(set (match_operand:ZI 0 "general_operand" "=rm,rm,r,r,r"
7969
+;              (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
7970 122 dgisselq
+;                      [(reg:CC CC_REG) (const_int 0)])
7971 102 dgisselq
+;                      (match_operand:ZI 2 "general_operand" "0,r,0,m,rm")
7972
+;                      (match_operand:ZI 3 "general_operand" "r,0,m,0,rm"))))]
7973
+;      )
7974
+;
7975
+;
7976
+;
7977
+; While an interesting approach, the following suffers from problems when the
7978
+; move amount is constant.  At anything less than four, moves should not require
7979
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
7980
+; are not required and should result in a hardcoded result.  Practically,
7981
+; though, this should really be a define_expand instruction, calling on the
7982
+; RTX's of all the respective subinstructions found below.
7983
+;
7984
+;(define_insn "movmemSI"
7985
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
7986
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
7987
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
7988
+;              (match_operand 3 "" "")                 ;Alignment
7989
+;              (clobber (match_scratch:SI 4 "=r"))
7990
+;              (clobber (match_scratch:SI 5 "=r"))
7991
+;              (clobber (match_scratch:SI 6 "=r"))
7992
+;              (clobber (match_scratch:SI 7 "=r"))]
7993
+;      ""
7994
+;      "TEST\t1,%2
7995
+;      LOD.NZ\t%1,%4
7996
+;      STO.NZ\t%4,%0
7997
+;      ADD.NZ\t1,%0
7998
+;      ADD.NZ\t1,%1
7999
+;      TEST\t2,%2
8000
+;      LOD.NZ\t%1,%4
8001
+;      LOD.NZ\t1(%1),%5
8002
+;      STO.NZ\t%4,(%0)
8003
+;      STO.NZ\t%4,1(%0)
8004
+;      ADD.NZ\t2,%0
8005
+;      ADD.NZ\t2,%1
8006
+;      AND\t-4,%2
8007
+;      BZ\t.Lskp%=\n.Ltop%=:
8008
+;      LOD\t(%1),%4
8009
+;      LOD\t1(%1),%5
8010
+;      LOD\t2(%1,%6
8011
+;      LOD\t3(%1),%7
8012
+;      STO\t%4,(%1)
8013
+;      STO\t%5,1(%1)
8014
+;      STO\t%6,2(%1)
8015
+;      STO\t%7,3(%1)
8016
+;      SUB\t4,%2
8017
+;      BZ\t%.Lskp%=
8018
+;      BRA\t.Ltop%=\n.Lskp%=:"
8019
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8020
+;(define_insn "setmemsi"
8021
+;      [(parallel
8022
+;              [(set (mem:BLK
8023
+;                      (match_operand 0 "register_operand" "+r")); Destination
8024
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
8025
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
8026
+;              (match_operand 3 "" "")]
8027
+;      ""
8028
+;      "TEST\t1,%1
8029
+;      STO.NZ\t%2,(%0)
8030
+;      ADD.NZ\t1,%0
8031
+;      TEST\t2,%1
8032
+;      STO.NZ\t%2,(%0)
8033
+;      STO.NZ\t%2,1(%0)
8034
+;      ADD.NZ\t2,%0
8035
+;      AND\t-4,%1
8036
+;      BZ\t.Lskp%=\n.Ltop%=:\n
8037
+;      STO\t%2,(%0)
8038
+;      STO\t%2,1(%0)
8039
+;      STO\t%2,2(%0)
8040
+;      STO\t%2,3(%0)
8041
+;      SUB\t%4,%0
8042
+;      BZ\t.Lskp%=
8043
+;      BRA\t.Ltop%=\n.Lskp%=:"
8044
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8045
+;;
8046
+;
8047
+;
8048
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8049
+;;
8050
+;; Control flow instructions
8051
+;;
8052
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8053
+;
8054
+;
8055
+;
8056
+(define_expand "jump"
8057
+       [(set (pc)
8058
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
8059
+(define_insn "jump_const"      ; Must be modeless, VOIDmode, not SI or any othr
8060
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8061
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
8062
+       ""
8063
+       "BRA    %0"
8064
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8065
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
8066
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8067
+               (label_ref (match_operand 0 "" "")))]
8068
+       ""
8069
+       "BRA    %0"
8070
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8071
+;
8072
+; This is really the same thing as an indirect jump ... the big difference
8073
+; is that the zip_address_operand_p checks for an "N" type condition, not an
8074
+; "M" type condition ... a bug, but one that works for now.  (The assembler
8075
+; should be able to catch and except on it ...)
8076
+;
8077
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8078
+(define_insn "jump_variable"
8079
+       [(set (pc)
8080
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
8081
+       ""
8082
+       "JMP    %0"
8083
+       [(set_attr "ccresult" "unchanged")])
8084
+;
8085
+; Indirect jumps ... both to registers, and registers plus offsets
8086
+;
8087
+(define_insn "indirect_jump"
8088
+       [(set (pc)
8089
+               (match_operand:SI 0 "register_operand" "r"))]
8090
+       ""
8091
+       "JMP    %0"
8092
+       [(set_attr "ccresult" "unchanged")])
8093
+(define_insn "indirect_jump_mem"
8094
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
8095
+       ""
8096
+       "LOD    %0,PC"
8097
+       [(set_attr "ccresult" "unchanged")])
8098
+(define_insn "indirect_jump_off"
8099
+       [(set (pc)
8100
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
8101
+                       (match_operand:SI 1 "const_int_operand" "M")))]
8102
+       ""
8103
+       "JMP    %1(%0)"
8104
+       [(set_attr "ccresult" "unchanged")])
8105
+;;
8106
+; cbranchsi4
8107
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
8108
+;;     Op 1&2 the operands of the compare instruction
8109
+;;     Op 3 is the jump label
8110
+;;
8111
+;;
8112
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
8113
+;;
8114
+(define_expand "cbranch<mode>4"
8115 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 1 "register_operand" "r")
8116
+               (match_operand:ZI 2 "zip_opb_operand_p" "rO")))
8117 102 dgisselq
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
8118 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8119 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
8120
+                       (pc)))]
8121
+       ""
8122
+       {
8123 117 dgisselq
+               extern void zip_debug_rtx_pfx(const char *, const_rtx);
8124 102 dgisselq
+               //; Two branches give us no end of difficulty when implementing.
8125
+               //; Let's check for these two branch codes, and swap the
8126
+               //; comparison to simplify them.
8127 122 dgisselq
+               //; fprintf(stderr, "CBRANCH\n");
8128
+               //; zip_debug_rtx_pfx("- CMP: ", operands[0]);
8129
+               //; zip_debug_rtx_pfx("- A  : ", operands[1]);
8130
+               //; zip_debug_rtx_pfx("- B  : ", operands[2]);
8131
+               //; zip_debug_rtx_pfx("- JMP: ", operands[3]);
8132 117 dgisselq
+               //; Can we do better if we reverse some compares?
8133 102 dgisselq
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
8134 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
8135
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
8136 102 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8137
+                       DONE;
8138
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
8139 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
8140
+                       emit_insn(gen_cmpsi_off(operands[2], operands[1],
8141
+                                       GEN_INT(1)));
8142
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8143 102 dgisselq
+                       DONE;
8144 117 dgisselq
+               } else if ((GET_CODE(operands[0])==LE)&&(REG_P(operands[2]))) {
8145 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(LE,?,REG,?)\n");
8146 117 dgisselq
+                       //; Swap operands, turn into a GTE compare
8147 122 dgisselq
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
8148 117 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ge(operands[3]));
8149
+                       DONE;
8150 102 dgisselq
+               } // ; Otherwise ... just handle the branch normally
8151
+
8152
+               //; Except ... we can do better for some instructions, such as
8153
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
8154
+               //; would be difficult to explain to users why MIN_INT didn't
8155
+               //; compare properly.  Hence we only adjust constant integers.
8156
+               //;
8157 122 dgisselq
+               if (GET_CODE(operands[0])==LE) {
8158
+                       if ((CONST_INT_P(operands[2]))
8159 117 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8160 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
8161
+                               emit_insn(gen_cmpsi(operands[1],
8162
+                                               GEN_INT(INTVAL(operands[2])+1)));
8163
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8164
+                               DONE;
8165
+                       //; Now for the controversial ones--where we add one
8166
+                       //; when it may or may not be permissable.  For now, we
8167
+                       //; just do it anyway and postpone the philosophical
8168
+                       //; discussion for later.
8169
+                       } else if (REG_P(operands[2])) {
8170
+                               emit_insn(gen_cmpsi_off(operands[1],
8171
+                                               operands[2],GEN_INT(1)));
8172
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8173
+                               DONE;
8174
+                       } else if ((GET_CODE(operands[2])==PLUS)
8175
+                               &&(REG_P(XEXP(operands[2],0)))
8176
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
8177
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
8178
+                               emit_insn(gen_cmpsi_off(operands[1],
8179
+                                               XEXP(operands[2],0),
8180
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
8181
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
8182
+                               DONE;
8183
+                       }
8184
+               } else if (GET_CODE(operands[0])==LEU) {
8185
+                       if ((CONST_INT_P(operands[2]))
8186 102 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
8187 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
8188
+                               emit_insn(gen_cmpsi(operands[1],
8189
+                                               GEN_INT(INTVAL(operands[2])+1)));
8190
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8191
+                               DONE;
8192
+                       //; Now for the controversial ones--this time having
8193
+                       //; to do with unsigned compares.
8194
+                       } else if (REG_P(operands[2])) {
8195
+                               emit_insn(gen_cmpsi_off(operands[1],
8196
+                                                       operands[2],GEN_INT(1)));
8197
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8198
+                               DONE;
8199
+                       } else if ((GET_CODE(operands[2])==PLUS)
8200
+                               &&(REG_P(XEXP(operands[2],0)))
8201
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
8202
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
8203
+                               emit_insn(gen_cmpsi_off(operands[1],
8204
+                                       XEXP(operands[2],0),
8205
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
8206
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8207
+                               DONE;
8208
+                       }
8209 102 dgisselq
+               }
8210
+       })
8211
+(define_insn "cbranch_jmp_eq"
8212 122 dgisselq
+       [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
8213 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8214
+                (pc)))]
8215
+       ""
8216
+       "BZ\t%0"
8217
+       [(set_attr "predicable" "no")
8218
+               (set_attr "conditional" "yes")
8219
+               (set_attr "ccresult" "unchanged")])
8220
+(define_insn "cbranch_jmp_neq"
8221 122 dgisselq
+       [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
8222 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8223
+                (pc)))]
8224
+       ""
8225
+       "BNZ\t%0"
8226
+       [(set_attr "predicable" "no")
8227
+               (set_attr "conditional" "yes")
8228
+               (set_attr "ccresult" "unchanged")])
8229
+(define_insn "cbranch_jmp_lt"
8230 122 dgisselq
+       [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
8231 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8232
+                (pc)))]
8233
+       ""
8234
+       "BLT\t%0"
8235
+       [(set_attr "predicable" "no")
8236
+               (set_attr "conditional" "yes")
8237
+               (set_attr "ccresult" "unchanged")])
8238
+(define_insn "cbranch_jmp_le"
8239 122 dgisselq
+       [(set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
8240 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8241
+                (pc)))]
8242
+       ""
8243
+       "BLT\t%0
8244
+       BZ\t%0"
8245
+       [(set_attr "predicable" "no")
8246
+               (set_attr "conditional" "yes")
8247
+               (set_attr "ccresult" "unchanged")])
8248
+(define_insn "cbranch_jmp_gt"
8249 122 dgisselq
+       [(set (pc) (if_then_else (gt (reg:CC CC_REG) (const_int 0))
8250 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8251
+                (pc)))]
8252
+       ""
8253
+       "BGT\t%0"
8254
+       [(set_attr "predicable" "no")
8255
+               (set_attr "conditional" "yes")
8256
+               (set_attr "ccresult" "unchanged")])
8257
+(define_insn "cbranch_jmp_ge"
8258 122 dgisselq
+       [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
8259 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8260
+                (pc)))]
8261
+       ""
8262
+       "BGE\t%0"
8263
+       [(set_attr "predicable" "no")
8264
+               (set_attr "conditional" "yes")
8265
+               (set_attr "ccresult" "unchanged")])
8266
+(define_insn "cbranch_jmp_ltu"
8267 122 dgisselq
+       [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
8268 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8269
+                (pc)))]
8270
+       ""
8271
+       "BC\t%0"
8272
+       [(set_attr "predicable" "no")
8273
+               (set_attr "conditional" "yes")
8274
+               (set_attr "ccresult" "unchanged")])
8275
+(define_insn "cbranch_jmp_gtu"
8276 122 dgisselq
+       [(set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
8277 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8278 122 dgisselq
+                (pc)))
8279
+       ;(clobber (reg:CC CC_REG))
8280
+       ]
8281 102 dgisselq
+       ""      ; Flip the condition, and then we can jump
8282
+       "XOR\t2,CC
8283
+       BC\t%0"
8284
+       [(set_attr "predicable" "no")
8285
+               (set_attr "conditional" "yes")
8286
+               (set_attr "ccresult" "unknown")])
8287
+(define_insn "cbranch_jmp_leu"
8288 122 dgisselq
+       [(set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
8289 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8290
+                (pc)))]
8291
+       ""      ; Need to check for both LTU (i.e. C) and Z
8292
+       "BC\t%0
8293
+       BZ\t%0"
8294
+       [(set_attr "predicable" "no")
8295
+               (set_attr "conditional" "yes")
8296
+               (set_attr "ccresult" "unchanged")])
8297
+(define_insn "cbranch_jmp_geu"
8298 122 dgisselq
+       [(set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
8299 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
8300 122 dgisselq
+                (pc)))
8301
+       ;(clobber (reg:CC CC_REG))
8302
+       ]
8303 102 dgisselq
+       ""      ; Flip the comparison, then check for GEU (once flipped)a
8304
+               ; Z is naturally checked for, as C would've never been set on Z
8305
+               ; so by flipping it, it is tantamount to saying Z or GTU.
8306
+       "BZ\t%0
8307
+       XOR\t2,CC
8308
+       BC\t%0"
8309
+       [(set_attr "predicable" "no")
8310
+               (set_attr "conditional" "yes")
8311
+               (set_attr "ccresult" "unknown")])
8312
+(define_insn "cbranchdi4"
8313
+       [(set (pc) (if_then_else
8314
+               (match_operator 0 "ordered_comparison_operator"
8315
+                       [(match_operand:DI 1 "register_operand" "r")
8316 122 dgisselq
+                               (match_operand:DI 2 "register_operand" "r")])
8317 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
8318
+                       (pc)))
8319 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8320 102 dgisselq
+       ""
8321
+       {
8322
+               switch(GET_CODE(operands[0])) {
8323
+               case EQ:
8324
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
8325
+               case NE:
8326
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
8327
+               case LE:
8328
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
8329
+               case GT:
8330
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
8331
+               case LT:
8332
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
8333
+               case GE:
8334
+                       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%=:";
8335
+               case LTU:
8336
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
8337
+               case LEU:
8338
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
8339
+               case GTU:
8340
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
8341
+               case GEU:
8342
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
8343
+               default:
8344
+                       gcc_unreachable();
8345
+               }
8346
+       }
8347
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8348
+;
8349
+;
8350
+;
8351
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8352
+;;
8353
+;; Subroutine call
8354
+;;
8355
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8356
+;
8357
+;
8358
+; There are two types of calls: "call" and "call_value".
8359
+;
8360
+; Each of these types of calls are then expanded into one of:
8361
+;
8362
+;      _const          - A call to a constant address, such as a symbol
8363
+;                      reference or a fixed location
8364
+;
8365
+;      _label          - This should be the same as _const, except that for
8366
+;                      some reason the RTL and matching rules are separate.
8367
+;                      Hence we have a separate rule for this.
8368
+;
8369
+;      _mem            - The memory address we wish to jump to is stored in
8370
+;                      memory somewhere, and we have only a pointer.  In this
8371
+;                      case, we load that pointer straight to the PC and go.
8372
+;
8373
+;      _var            - The address to jump to is given as an offset to a
8374
+;                      register, such as X+R3.  This is an indirect jump.
8375
+;                      Although we support it, it does require different RTL
8376
+;                      code.
8377
+;
8378
+(define_expand "call"
8379
+       [(call (match_operand 0 "" "")
8380
+               (match_operand 1 "" ""))]
8381
+       ""
8382
+       {
8383
+               if (MEM_P(operands[0])) {
8384
+                       // This should always be the case
8385
+                       rtx addr = XEXP(operands[0],0);
8386
+                       if (zip_const_address_operand_p(addr, SImode)) {
8387 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_void_call_const()\n");
8388 102 dgisselq
+                               emit_call_insn(gen_void_call_const(addr,
8389
+                                               operands[1]));
8390
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
8391
+                                                       XEXP(addr,0)))) {
8392
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
8393
+                                                                operands[1]));
8394
+                       } else {
8395
+                               emit_call_insn(gen_void_call_var(addr,
8396
+                                                                operands[1]));
8397
+                       }
8398
+                       DONE;
8399
+               }
8400
+       })
8401
+;
8402
+;
8403
+;
8404
+; How do we want to do this better?
8405
+;      Replace the RTL w/
8406
+;              return_label= gen_label_rtx();
8407
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
8408
+;                      gen_rtx_REG(zip_PC),return_label));
8409
+;              emit_jump(label_rtx(
8410
+;
8411
+;              emit_label(return_label);
8412
+;
8413
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
8414
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
8415
+; label gets removed and the call gets lost.  Hence we do it this way (below).
8416
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
8417
+; recognize as such, but for now we'll use .Lcall# as our label.
8418
+;
8419
+(define_insn "void_call_const"
8420 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
8421 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8422 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8423
+               (clobber (reg:CC CC_REG))]
8424 102 dgisselq
+       ""
8425
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
8426
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8427
+(define_insn "void_call_mem"
8428 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
8429 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8430 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8431
+               (clobber (reg:CC CC_REG))]
8432 102 dgisselq
+       ""
8433
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
8434
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8435
+;
8436
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8437
+(define_insn "void_call_var"
8438 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
8439 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
8440 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8441
+               (clobber (reg:CC CC_REG))]
8442 102 dgisselq
+       ""
8443
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
8444
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8445
+(define_expand "call_value"
8446 122 dgisselq
+       [(parallel [(set (reg:SI RTNV_REG)
8447 102 dgisselq
+               (call (match_operand:SI 1 "" "")
8448 111 dgisselq
+                       (match_operand 2 "const_int_operand" "n")))
8449 122 dgisselq
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))
8450
+       (clobber (reg:CC CC_REG))])]
8451 102 dgisselq
+       ""
8452
+       {
8453 122 dgisselq
+               //; extern void zip_debug_rtx(const_rtx);
8454
+               //; fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
8455
+               //; zip_debug_rtx(operands[1]);
8456 102 dgisselq
+               if (MEM_P(operands[1])) {
8457 122 dgisselq
+                       //; fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
8458
+                       //; zip_debug_rtx(operands[1]);
8459
+                       //; This should always be the case
8460 102 dgisselq
+                       rtx addr = XEXP(operands[1],0);
8461
+                       if (zip_const_address_operand_p(addr, SImode)) {
8462 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_reg_call_const()\n");
8463 102 dgisselq
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
8464
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
8465 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
8466 102 dgisselq
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
8467
+                       } else {
8468 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
8469 102 dgisselq
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
8470
+                       }
8471
+                       DONE;
8472
+               }
8473
+       })
8474
+(define_insn "reg_call_const"
8475 122 dgisselq
+       [(set (reg:SI RTNV_REG)
8476 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
8477 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
8478 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8479
+               (clobber (reg:CC CC_REG))]
8480 102 dgisselq
+       ""
8481
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
8482
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8483
+(define_insn "reg_call_mem"
8484
+       [(set (reg:SI RTNV_REG)
8485 111 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
8486
+                       (match_operand 1 "const_int_operand" "n")))
8487 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8488
+               (clobber (reg:CC CC_REG))]
8489 102 dgisselq
+       ""
8490 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tLOD\t%0,PC\n.Lcall%=:"
8491 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8492 111 dgisselq
+;
8493 102 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8494
+(define_insn "reg_call_var"
8495 122 dgisselq
+       [(set (reg:SI RTNV_REG)
8496 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
8497 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
8498 122 dgisselq
+               (clobber (reg:SI RTN_REG))
8499
+               (clobber (reg:CC CC_REG))]
8500 102 dgisselq
+       ""
8501 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tJMP\t%0\n.Lcall%=:"
8502 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8503
+;
8504
+;
8505
+;
8506
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8507
+;;
8508
+;; Frame manipulation RTX
8509
+;;
8510
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8511
+;
8512
+;
8513
+;
8514
+(define_expand "prologue"
8515
+       [(const_int 0)]
8516
+       ""
8517
+       "{ zip_expand_prologue(); DONE; }")
8518
+(define_expand "epilogue"
8519
+       [(return)]
8520
+       ""
8521
+       "{ zip_expand_epilogue(); DONE; }")
8522
+(define_expand "return" ; In order to use the function predicate, this *must*
8523
+       [(return)]      ; be a define_expand
8524
+       "zip_use_return_insn()")
8525
+       ; "JMP  R0"
8526
+       ; [(set_attr "ccresult" "unchanged")])
8527
+(define_insn "*return" ; A "*" -- means it cannot be called from C
8528
+       [(return)]
8529
+       ""
8530
+       "JMP    R0"
8531
+       [(set_attr "ccresult" "unchanged")])
8532
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
8533
+       [(simple_return)]
8534
+       ""
8535
+       "JMP    R0"
8536
+       [(set_attr "ccresult" "unchanged")])
8537
+;
8538
+;
8539
+;
8540
+;;;;;;;;;;;;;;;;;;;;;;;;;;
8541
+;;
8542
+;; Zip Builtin Functions
8543
+;;
8544
+;;;;;;;;;;;;;;;;;;;;;;;;;;
8545
+;
8546
+;
8547
+;
8548
+(define_insn "zip_rtu"
8549
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
8550 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8551 102 dgisselq
+       "(!ZIP_USER)"
8552
+       "RTU"
8553
+       [(set_attr "ccresult" "unknown")])
8554
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
8555
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
8556 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8557 102 dgisselq
+       "(!ZIP_USER)"
8558
+       "HALT"
8559
+       [(set_attr "ccresult" "unknown")])
8560
+(define_insn "zip_idle"
8561
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
8562 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8563 102 dgisselq
+       ""
8564
+       "WAIT"
8565
+       [(set_attr "ccresult" "unknown")])
8566
+(define_insn "zip_syscall"
8567
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
8568
+       ""
8569
+       "CLR\tCC"
8570
+       [(set_attr "ccresult" "unknown")])
8571
+;
8572
+;
8573
+; Operator "save_context"
8574
+;
8575 117 dgisselq
+;      Okay, so we're not really reading and writing operand 0, %0, however
8576
+;      if we don't list it as a "+r" register, the compiler may allocate it
8577
+;      among the other registers, thus we clobber it in the middle of the
8578
+;      operation before the task is complete.
8579 102 dgisselq
+;
8580
+(define_insn "zip_save_context"
8581 117 dgisselq
+       [(unspec_volatile
8582
+                       [ (match_operand:SI 0 "register_operand" "+r") ]
8583 102 dgisselq
+                       UNSPEC_SAVE_CONTEXT)
8584
+               (clobber (match_scratch:SI 1 "=r"))
8585
+               (clobber (match_scratch:SI 2 "=r"))
8586
+               (clobber (match_scratch:SI 3 "=r"))
8587 117 dgisselq
+               (clobber (match_scratch:SI 4 "=r"))]
8588 102 dgisselq
+       "(!ZIP_USER)"
8589
+       "MOV\tuR0,%1
8590
+       MOV\tuR1,%2
8591
+       MOV\tuR2,%3
8592
+       MOV\tuR3,%4
8593
+       STO\t%1,%0
8594
+       STO\t%2,1(%0)
8595
+       STO\t%3,2(%0)
8596
+       STO\t%4,3(%0)
8597
+       MOV\tuR4,%1
8598
+       MOV\tuR5,%2
8599
+       MOV\tuR6,%3
8600
+       MOV\tuR7,%4
8601
+       STO\t%1,4(%0)
8602
+       STO\t%2,5(%0)
8603
+       STO\t%3,6(%0)
8604
+       STO\t%4,7(%0)
8605
+       MOV\tuR8,%1
8606
+       MOV\tuR9,%2
8607
+       MOV\tuR10,%3
8608
+       MOV\tuR11,%4
8609
+       STO\t%1,8(%0)
8610
+       STO\t%2,9(%0)
8611
+       STO\t%3,10(%0)
8612
+       STO\t%4,11(%0)
8613
+       MOV\tuR12,%1
8614
+       MOV\tuSP,%2
8615
+       MOV\tuCC,%3
8616
+       MOV\tuPC,%4
8617
+       STO\t%1,12(%0)
8618
+       STO\t%2,13(%0)
8619
+       STO\t%3,14(%0)
8620
+       STO\t%4,15(%0)"
8621 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8622 117 dgisselq
+;
8623
+; See the comment above about why operand 0, %0, *must* be a "+r" operand,
8624
+; even though we don't really read (or change) its value throughout this
8625
+; operation.
8626
+;
8627 102 dgisselq
+(define_insn "zip_restore_context"
8628
+       [(unspec_volatile [
8629 117 dgisselq
+               (match_operand:SI 0 "register_operand" "+r")] UNSPEC_RESTORE_CONTEXT)
8630 102 dgisselq
+       (clobber (match_scratch:SI 1 "=r"))
8631
+       (clobber (match_scratch:SI 2 "=r"))
8632
+       (clobber (match_scratch:SI 3 "=r"))
8633 117 dgisselq
+       (clobber (match_scratch:SI 4 "=r"))]
8634 102 dgisselq
+       "(!ZIP_USER)"
8635
+       "LOD\t0(%0),%1
8636
+       LOD\t1(%0),%2
8637
+       LOD\t2(%0),%3
8638
+       LOD\t3(%0),%4
8639
+       MOV\t%1,uR0
8640
+       MOV\t%2,uR1
8641
+       MOV\t%3,uR2
8642
+       MOV\t%4,uR3
8643
+       LOD\t4(%0),%1
8644
+       LOD\t5(%0),%2
8645
+       LOD\t6(%0),%3
8646
+       LOD\t7(%0),%4
8647
+       MOV\t%1,uR4
8648
+       MOV\t%2,uR5
8649
+       MOV\t%3,uR6
8650
+       MOV\t%4,uR7
8651
+       LOD\t8(%0),%1
8652
+       LOD\t9(%0),%2
8653
+       LOD\t10(%0),%3
8654
+       LOD\t11(%0),%4
8655
+       MOV\t%1,uR8
8656
+       MOV\t%2,uR9
8657
+       MOV\t%3,uR10
8658
+       MOV\t%4,uR11
8659
+       LOD\t12(%0),%1
8660
+       LOD\t13(%0),%2
8661
+       LOD\t14(%0),%3
8662
+       LOD\t15(%0),%4
8663
+       MOV\t%1,uR12
8664
+       MOV\t%2,uSP
8665
+       MOV\t%3,uCC
8666
+       MOV\t%4,uPC"
8667 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8668 102 dgisselq
+(define_insn "zip_bitrev"
8669
+       [(set (match_operand:SI 0 "register_operand" "=r")
8670
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
8671
+       ]
8672
+       ""
8673
+       "BREV\t%1,%0"
8674 122 dgisselq
+       [(set_attr "ccresult" "unchanged")])
8675 102 dgisselq
+(define_insn "zip_cc"
8676
+       [(set (match_operand:SI 0 "register_operand" "=r")
8677
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8678
+       ""
8679
+       "MOV\tCC,%0"
8680
+       [(set_attr "ccresult" "unchanged")])
8681 117 dgisselq
+(define_insn "zip_ucc"
8682
+       [(set (match_operand:SI 0 "register_operand" "=r")
8683
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETUCC))]
8684
+       ""
8685
+       "MOV\tuCC,%0"
8686
+       [(set_attr "ccresult" "unchanged")])
8687 111 dgisselq
+(define_insn "zip_cc_sto"
8688
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
8689 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8690 111 dgisselq
+       ""
8691
+       "STO\tCC,(%0)"
8692
+       [(set_attr "ccresult" "unchanged")])
8693
+(define_insn "zip_cc_sto_off"
8694
+       [(set (mem:SI (plus:SI
8695
+                       (match_operand:SI 0 "register_operand" "r")
8696
+                       (match_operand:SI 1 "const_int_operand" "N")))
8697 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
8698 111 dgisselq
+       ""
8699
+       "STO\tCC,%1(%0)"
8700
+       [(set_attr "ccresult" "unchanged")])
8701 102 dgisselq
+(define_insn "ldilo"
8702
+       [(set (match_operand:SI 0 "register_operand" "=r")
8703
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
8704
+       ""
8705
+       "LDILO  %1,%0"
8706
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8707
+
8708
+;
8709
+;
8710
+;
8711
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8712
+;;
8713
+;; Floating point Op-codes
8714
+;;
8715
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8716
+;
8717
+;
8718
+;
8719
+(define_insn "addsf3"
8720
+       [(set (match_operand:SF 0 "register_operand" "=r")
8721
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
8722 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
8723
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8724 102 dgisselq
+       "(ZIP_FPU)"
8725
+       "FPADD  %2,%0"
8726
+       [(set_attr "ccresult" "unknown")])
8727
+(define_insn "subsf3"
8728
+       [(set (match_operand:SF 0 "register_operand" "=r")
8729
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
8730 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
8731
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8732 102 dgisselq
+       "(ZIP_FPU)"
8733
+       "FPSUB  %2,%0"
8734
+       [(set_attr "ccresult" "unknown")])
8735
+(define_insn "mulsf3"
8736
+       [(set (match_operand:SF 0 "register_operand" "=r")
8737
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
8738 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
8739
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8740 102 dgisselq
+       "(ZIP_FPU)"
8741
+       "FPMUL  %2,%0"
8742
+       [(set_attr "ccresult" "unknown")])
8743
+(define_insn "divsf3"
8744
+       [(set (match_operand:SF 0 "register_operand" "=r")
8745
+               (div:SF (match_operand:SF 1 "register_operand" "0")
8746 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
8747
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8748 102 dgisselq
+       "(ZIP_FPU)"
8749
+       "FPDIV  %2,%0"
8750
+       [(set_attr "ccresult" "unknown")])
8751 111 dgisselq
+(define_expand "negsf2"
8752
+       [(set (match_operand:SF 0 "register_operand" "=r")
8753
+               (neg:SF (match_operand:SF 1 "register_operand" "0")))
8754
+       ]
8755
+       ""
8756
+       {
8757
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
8758
+               if (can_create_pseudo_p()) {
8759
+                       rtx tmp = gen_reg_rtx(SImode);
8760
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
8761 122 dgisselq
+                       emit_insn(gen_xorsi3(operands[0], operands[0], tmp));
8762 111 dgisselq
+                       DONE;
8763
+               } else {
8764
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8765 122 dgisselq
+                       emit_insn(gen_iorsi3(operands[0], operands[0],
8766
+                               gen_int_mode(1,SImode)));
8767 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8768
+                       DONE;
8769
+               }
8770
+       })
8771
+(define_expand "abssf2"
8772 122 dgisselq
+       [(set (match_operand:SF 0 "register_operand" "=r")
8773
+               (abs:SF (match_operand:SF 1 "register_operand" "0")))
8774 111 dgisselq
+       ]
8775
+       ""
8776
+       {
8777
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
8778
+               if (can_create_pseudo_p()) {
8779
+                       rtx tmp = gen_reg_rtx(SImode);
8780
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
8781 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0], tmp));
8782 111 dgisselq
+                       DONE;
8783
+               } else {
8784
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8785 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0],
8786
+                               gen_int_mode(-2,SImode)));
8787 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
8788
+                       DONE;
8789
+               }
8790
+       })
8791 102 dgisselq
+;
8792
+;
8793
+;
8794
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8795
+;;
8796
+;; Trap Instruction
8797
+;;
8798
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8799
+;
8800
+;
8801
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
8802
+; *nothing* should ever trap, and so we should never get here.  However, the
8803
+; compiler seems to want a trap instruction for some reason.  (It keeps us
8804
+; from calling the abort() function, if we don't define these ...)  So let's
8805
+; just grab onto the break instruction and declare it to be a trap instruction
8806
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
8807
+; will work for both user and system instructions.
8808
+;
8809
+(define_insn "trap"
8810
+       [(trap_if (const_int 1) (const_int 0))]
8811
+       ""
8812
+       "BREAK"
8813
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
8814
+;
8815
+(define_expand "ctrap<mode>4"
8816 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8817
+               (match_operand:ZI 1 "register_operand" "r")
8818
+               (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8819 102 dgisselq
+       (trap_if (match_operator 0 "ordered_comparison_operator"
8820 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8821 102 dgisselq
+                       (match_operand 3 "const_int_operand" "O"))]
8822
+       ""
8823
+       )
8824
+(define_insn "trapif"
8825
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
8826 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8827 102 dgisselq
+                       (match_operand 1 "const_int_operand" "O"))]
8828
+       ""
8829
+       "BREAK\t%1"
8830
+       [(set_attr "predicable" "no")])
8831
+;
8832
+;
8833
+;
8834
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8835
+;;
8836
+;; Unimplemented (or not yet implemented) RTL Codes
8837
+;;
8838
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8839
+;
8840
+;
8841
+;
8842
+;(define_insn "sync_compare_and_swapsi"
8843
+;      [(set ...
8844
+;              )]
8845
+;      "(ZIP_ATMOC)"
8846
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
8847
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
8848
+;      CMP     %0,%2   DCD-valid
8849
+;      STO.Z   %2,%1   PF-valid
8850
+;
8851
+;(define_insn "sync_lock_test_and_setsi"
8852
+;      LOCK
8853
+;      LOD     %1,%0
8854
+;      STO     %0,%1
8855
+;
8856
+;(define_insn "sync_lock_releasesi"
8857
+;      STO     %1,%0
8858
+;
8859
+;
8860
+;(define_insn "negvsi3"
8861
+;      "MOV    %1,%0
8862
+;      XOR     -1,%0
8863
+;      ADD     1,%0
8864
+;      BV      %2"
8865
+;      "")
8866
+
8867 117 dgisselq
+(define_peephole2
8868 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8869
+               (match_operand:SI 0 "register_operand")
8870
+               (match_operand:SI 1 "register_operand")))
8871
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
8872
+                       (label_ref (match_operand 2 ""))
8873 117 dgisselq
+                       (pc)))]
8874
+       ""
8875 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1) (match_dup 0)))
8876
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
8877 117 dgisselq
+                       (label_ref (match_dup 2))
8878
+                       (pc)))]
8879
+       "")
8880
+(define_peephole2
8881 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8882
+               (match_operand:SI 0 "register_operand")
8883
+               (match_operand:SI 1 "register_operand")))
8884
+       (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
8885
+                       (label_ref (match_operand 2 ""))
8886 117 dgisselq
+                       (pc)))]
8887
+       ""
8888 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8889
+               (match_dup 1) (plus (match_dup 0) (const_int 1))))
8890
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
8891 117 dgisselq
+                       (label_ref (match_dup 2))
8892
+                       (pc)))]
8893
+       "")
8894
+(define_peephole2
8895 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8896
+               (match_operand:SI 0 "register_operand")
8897
+               (match_operand:SI 1 "register_operand")))
8898
+       (set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
8899
+                       (label_ref (match_operand 2 ""))
8900 117 dgisselq
+                       (pc)))]
8901
+       ""
8902 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1)
8903
+                       (plus:SI (match_dup 0) (const_int 1))))
8904
+       (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
8905 117 dgisselq
+                       (label_ref (match_dup 2))
8906
+                       (pc)))]
8907
+       "")
8908
+(define_peephole2
8909 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8910
+               (match_operand:SI 0 "register_operand" "")
8911 117 dgisselq
+               (match_operand:SI 1 "register_operand" "")))
8912 122 dgisselq
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
8913 117 dgisselq
+                       (label_ref (match_operand 2 "" ""))
8914
+                       (pc)))]
8915
+       ""
8916 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
8917
+                       (plus (match_dup 1) (const_int 1))))
8918
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
8919 117 dgisselq
+                       (label_ref (match_dup 2))
8920
+                       (pc)))]
8921
+       "")
8922
+;
8923
+; I need to revisit these peephole optimizations when I can come up with another
8924
+; way of adding one to the constant integer.  The approach listed below just
8925
+; ... doesn't work.
8926 102 dgisselq
+;
8927 117 dgisselq
+;(define_peephole2
8928 122 dgisselq
+;      [(set (reg:CC CC_REG) (compare (match_operand:SI 0 "register_operand" "")
8929 117 dgisselq
+;              (match_operand:SI 1 "const_int_operand" "")))
8930 122 dgisselq
+;      (set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
8931 117 dgisselq
+;                      (label_ref (match_operand 2 "" ""))
8932
+;                      (pc)))]
8933
+;      "(INTVAL(operands[1])<((1<<17)-2))"
8934 122 dgisselq
+;      [(set (reg:CC CC_REG) (compare (match_dup 0) (plus (match_dup 1) (const_int 1))))
8935
+;      (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
8936 117 dgisselq
+;                      (label_ref (match_dup 2))
8937
+;                      (pc)))]
8938
+;      "")
8939
+;(define_peephole2
8940 122 dgisselq
+;      [(set (reg:CC CC_REG) (compare (match_operand:SI 0 "register_operand" "")
8941 117 dgisselq
+;              (match_operand:SI 1 "const_int_operand" "")))
8942 122 dgisselq
+;      (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
8943 117 dgisselq
+;                      (label_ref (match_operand 2 "" ""))
8944
+;                      (pc)))]
8945
+;      "(INTVAL(operands[1])<((1<<17)-2))"
8946 122 dgisselq
+;      [(set (reg:CC CC_REG) (compare (match_dup 0) (plus (match_dup 1) (const_int 1))))
8947
+;      (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
8948 117 dgisselq
+;                      (label_ref (match_dup 2))
8949
+;                      (pc)))]
8950
+;      "")
8951
+;
8952
+;
8953
+;
8954
+; Need a peephole optimizer (not peephole2) for
8955
+;      [(call ...
8956
+;      (set (pc) (label))]
8957
+;      To result with
8958
+;      "MOV\tlabel,R0
8959
+;      JMP\tsubroutine"
8960
+;
8961 122 dgisselq
+; and for
8962
+;      BRA target
8963
+;      BRA target ; two branches to the same identical target in a row ...
8964
+;
8965
+;
8966
+;
8967
+; Match:
8968
+;      MOV A(R1),R3
8969
+;      CMP R3,R0
8970
+;      (R3 is dead)
8971
+; Transform to:
8972
+;      CMP A(R1),R0
8973
+;
8974
+(define_peephole2
8975
+       [(set (match_operand:SI 3 "register_operand")
8976
+               (plus:SI (match_operand:SI 1 "register_operand")
8977
+                       (match_operand:SI 2 "zip_mvimm_operand_p")))
8978
+       (set (reg:CC CC_REG)
8979
+               (compare:CC (match_operand:SI 0 "register_operand")
8980
+                       (match_dup 3)))]
8981
+       "peep2_regno_dead_p(2, REGNO(operands[3]))"
8982
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
8983
+               (plus:SI (match_dup 1) (match_dup 2))))]
8984
+       "")
8985
+;
8986
+;
8987
+; Match:
8988
+;      ALU OpB,R0
8989
+;      CMP 0,R0
8990
+; Transform to:
8991
+;      ALU OpB,R0
8992
+;
8993
+(define_peephole2
8994
+       [(parallel [(set (match_operand 0 "register_operand")
8995
+                       (match_operand 1 ""))
8996
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
8997
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8998
+       ""
8999
+       [(parallel [(set (match_dup 0) (match_dup 1))
9000
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9001
+       ])
9002
+;
9003
+;
9004
+; Match:
9005
+;      ALU OpB,R0
9006
+;      MOV R1,R2       // Can be LDI, LOD, STO, etc.
9007
+;      CMP 0,R1
9008
+; Transform to:
9009
+;      ALU OpB,R0
9010
+;      MOV R0,R1
9011
+;
9012
+(define_peephole2
9013
+       [(parallel [(set (match_operand 0 "register_operand")
9014
+                       (match_operand 1 ""))
9015
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9016
+       (set (match_operand 2 "nonimmediate_operand") (match_operand 3 ""))
9017
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9018
+       "(!REG_P(operands[2]))||((REGNO(operands[2])!=REGNO(operands[0]))&&((REGNO(operands[2])>FIRST_PSEUDO_REGISTER)||(REGNO(operands[2])<CC_REG)))"
9019
+       [(parallel [(set (match_dup 0) (match_dup 1))
9020
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9021
+       (set (match_dup 2) (match_dup 3))
9022
+       ])
9023
+;
9024
+;
9025
+; Match:
9026
+;      ALU OpB,R0
9027
+;      MOV R0,R1
9028
+;      CMP 0,R1
9029
+; Transform to:
9030
+;      ALU OpB,R0
9031
+;      MOV R0,R1
9032
+;
9033
+(define_peephole2
9034
+       [(parallel [(set (match_operand 0 "register_operand")
9035
+                       (match_operand 1 ""))
9036
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9037
+       (set (match_operand 2 "register_operand") (match_dup 0))
9038
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))]
9039
+       ""
9040
+       [(parallel [(set (match_dup 0) (match_dup 1))
9041
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9042
+       (set (match_dup 2) (match_dup 3))
9043
+       ])
9044
+
9045
+;
9046 102 dgisselq
+; STILL MISSING:
9047
+;      SYSCALL(ID)
9048
+;              MOV %ID,R0
9049
+;              CLR     CC
9050
+;      cmove   ... the conditional move, created from a
9051
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
9052
+;      pattern
9053
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
9054
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
9055 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-08 12:10:21.982586940 -0500
9056
@@ -0,0 +1,23 @@
9057 102 dgisselq
+/*
9058
+ * Commends in C-long comment form
9059
+ * class
9060
+ *     Mode = "SI"
9061
+ *     PRECISION, BYTESIZE, COUNT ??
9062
+ *     FORMAT
9063
+ *     EXPR
9064 111 dgisselq
+ *
9065
+ * The manual says I need to define BITS_PER_UNIT here.
9066 102 dgisselq
+ */
9067
+// INT_MODE(QI, 1);
9068
+// INT_MODE(HI, 1);
9069
+// INT_MODE(SI, 1);
9070
+// INT_MODE(DI, 2);
9071
+
9072
+// FLOAT_MODE(SF, 1, ieee_single_format);
9073
+// FLOAT_MODE(DF, 2, ieee_single_format);
9074
+
9075
+// We cannot override machmodes.def from here.  Thus, even though our QI,
9076
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
9077
+// change needed to be made in machmodes.def.  Hence, here is a target
9078
+// configuration change--in machmodes.def--that properly belonged in the
9079
+// config directory.
9080
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
9081
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
9082 122 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-04-06 14:25:35.431154171 -0400
9083
@@ -0,0 +1,78 @@
9084 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
9085
+//
9086
+// Filename:   zip-protos.h
9087
+//
9088
+// Project:    Zip CPU backend for the GNU Compiler Collection
9089
+//
9090
+// Purpose:
9091
+//
9092
+// Creator:    Dan Gisselquist, Ph.D.
9093
+//             Gisselquist Technology, LLC
9094
+//
9095
+////////////////////////////////////////////////////////////////////////////////
9096
+//
9097
+// Copyright (C) 2016, Gisselquist Technology, LLC
9098
+//
9099
+// This program is free software (firmware): you can redistribute it and/or
9100
+// modify it under the terms of  the GNU General Public License as published
9101
+// by the Free Software Foundation, either version 3 of the License, or (at
9102
+// your option) any later version.
9103
+//
9104
+// This program is distributed in the hope that it will be useful, but WITHOUT
9105
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
9106
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9107
+// for more details.
9108
+//
9109
+// You should have received a copy of the GNU General Public License along
9110
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
9111
+// target there if the PDF file isn't present.)  If not, see
9112
+// <http://www.gnu.org/licenses/> for a copy.
9113
+//
9114
+// License:    GPL, v3, as defined and found on www.gnu.org,
9115
+//             http://www.gnu.org/licenses/gpl.html
9116
+//
9117
+//
9118
+////////////////////////////////////////////////////////////////////////////////
9119
+#ifndef        ZIP_PROTOS_H
9120
+#define        ZIP_PROTOS_H
9121
+
9122
+extern void    zip_expand_prologue(void);
9123
+extern void    zip_expand_epilogue(void);
9124
+extern int     zip_initial_elimination_offset(int, int);
9125
+extern void    zip_print_operand(FILE *, rtx, int);
9126
+extern void    zip_print_operand_address(FILE *, rtx);
9127
+extern enum    reg_class       zip_reg_class(int);
9128
+extern rtx     zip_return_addr_rtx(int, rtx);
9129
+extern int     zip_num_arg_regs(enum machine_mode, tree);
9130
+
9131
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
9132 122 dgisselq
+
9133
+#ifdef HAVE_cc0
9134 102 dgisselq
+extern void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
9135 122 dgisselq
+#else
9136
+extern void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
9137
+#endif
9138 102 dgisselq
+extern int     zip_address_operand(rtx op);
9139
+extern int     zip_const_address_operand(rtx op);
9140
+extern bool    zip_gen_move_rtl(rtx, rtx);
9141
+extern bool    zip_use_return_insn(void);
9142
+extern const char *zip_set_zero_or_one(rtx, rtx);
9143
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
9144
+
9145
+extern int     zip_ct_address_operand(rtx op);
9146 111 dgisselq
+extern int     zip_pd_opb_operand(rtx op);
9147 102 dgisselq
+extern int     zip_pd_mov_operand(rtx op);
9148 111 dgisselq
+extern int     zip_pd_imm_operand(rtx op);
9149
+extern int     zip_pd_mvimm_operand(rtx op);
9150 102 dgisselq
+extern int     zip_ct_const_address_operand(rtx op);
9151
+extern int     zip_pd_const_address_operand(rtx op);
9152
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
9153
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
9154
+
9155 122 dgisselq
+extern void    zip_ifcvt_machdep_init(struct ce_if_block *ceinfo);
9156
+extern void    zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo);
9157
+extern void    zip_ifcvt_modify_final(struct ce_if_block *ceinfo);
9158
+extern void    zip_ifcvt_modify_tests(struct ce_if_block *ceinfo, rtx *true_expr, rtx *false_expr);
9159
+
9160 102 dgisselq
+#endif
9161
+
9162
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
9163
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
9164
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
9165
@@ -479,6 +479,10 @@
9166
 tilepro*-*-*)
9167
        cpu_type=tilepro
9168
        ;;
9169
+zip*)
9170
+       cpu_type=zip
9171
+       tmake_file=zip/t-zip
9172
+       ;;
9173
 esac
9174
 
9175
 tm_file=${cpu_type}/${cpu_type}.h
9176
@@ -2972,6 +2976,15 @@
9177
        c_target_objs="m32c-pragma.o"
9178
        cxx_target_objs="m32c-pragma.o"
9179
        ;;
9180
+zip-*-netbsd*)
9181
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
9182
+       tmake_file="${tmake_file} zip/t-zip"
9183
+       ;;
9184
+zip*)
9185
+       target_has_targetm_common=yes
9186
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
9187
+       tmake_file="${tmake_file} zip/t-zip"
9188
+       ;;
9189
 *)
9190
        echo "*** Configuration ${target} not supported" 1>&2
9191
        exit 1
9192
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
9193
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
9194 122 dgisselq
+++ gcc-5.3.0-zip/gcc/cse.c     2016-04-05 22:26:30.816200542 -0400
9195 111 dgisselq
@@ -634,6 +634,15 @@
9196 102 dgisselq
 
9197
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
9198
 
9199 111 dgisselq
+// #define     DO_ZIP_DEBUGS
9200 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
9201
+#include <stdio.h>
9202
+extern void zip_debug_rtx(const_rtx);
9203
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
9204
+#else
9205
+#define        ZIP_DEBUG_LINE(STR,RTX)
9206
+#endif
9207
+
9208
 static bool
9209
 fixed_base_plus_p (rtx x)
9210
 {
9211
@@ -2898,6 +2907,7 @@
9212
          validate_canon_reg (&XVECEXP (x, i, j), insn);
9213
     }
9214
 
9215
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
9216
   return x;
9217
 }
9218
 
9219
@@ -3144,14 +3154,16 @@
9220
   if (x == 0)
9221
     return x;
9222
 
9223
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
9224
   /* Try to perform some initial simplifications on X.  */
9225
   code = GET_CODE (x);
9226
   switch (code)
9227
     {
9228
     case MEM:
9229
     case SUBREG:
9230
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
9231
-        return new_rtx;
9232
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
9233
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
9234
+        return new_rtx; }
9235
       return x;
9236
 
9237
     case CONST:
9238
@@ -3208,6 +3220,8 @@
9239
        rtx folded_arg = XEXP (x, i), const_arg;
9240
        machine_mode mode_arg = GET_MODE (folded_arg);
9241
 
9242
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
9243
+
9244
        switch (GET_CODE (folded_arg))
9245
          {
9246
          case MEM:
9247
@@ -3317,6 +3331,7 @@
9248
        }
9249
 
9250
       apply_change_group ();
9251
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
9252
     }
9253
 
9254
   /* If X is an arithmetic operation, see if we can simplify it.  */
9255
@@ -4203,6 +4218,7 @@
9256
 {
9257
   rtx dest = SET_DEST (set);
9258
   rtx src = SET_SRC (set);
9259
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
9260
 
9261
   if (REG_P (dest)
9262
       && REG_P (src) && ! HARD_REGISTER_P (src)
9263
@@ -4258,6 +4274,7 @@
9264
            }
9265
        }
9266
     }
9267
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
9268
 }
9269
 
9270
 /* Record all the SETs in this instruction into SETS_PTR,
9271
@@ -4351,6 +4368,7 @@
9272
   rtx tem;
9273
   rtx x = PATTERN (insn);
9274
   int i;
9275
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
9276
 
9277
   if (CALL_P (insn))
9278
     {
9279
@@ -4364,6 +4382,7 @@
9280
       canon_reg (SET_SRC (x), insn);
9281
       apply_change_group ();
9282
       fold_rtx (SET_SRC (x), insn);
9283
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
9284
     }
9285
   else if (GET_CODE (x) == CLOBBER)
9286
     {
9287
@@ -4400,6 +4419,7 @@
9288
     canon_reg (PATTERN (insn), insn);
9289
   else if (GET_CODE (x) == PARALLEL)
9290
     {
9291
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
9292
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
9293
        {
9294
          rtx y = XVECEXP (x, 0, i);
9295
@@ -4491,6 +4511,7 @@
9296
 
9297
      The result of apply_change_group can be ignored; see canon_reg.  */
9298
 
9299
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
9300
   apply_change_group ();
9301
 }
9302
 
9303
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
9304
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
9305
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
9306
@@ -480,6 +480,8 @@
9307
 #define LOG2_BITS_PER_UNIT 3
9308
 #elif BITS_PER_UNIT == 16
9309
 #define LOG2_BITS_PER_UNIT 4
9310
+#elif BITS_PER_UNIT == 32
9311
+#define LOG2_BITS_PER_UNIT 5
9312
 #else
9313
 #error Unknown BITS_PER_UNIT
9314
 #endif
9315
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
9316
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
9317
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
9318
@@ -0,0 +1,214 @@
9319
+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
9320
+entering extended mode
9321
+ restricted \write18 enabled.
9322
+ file:line:error style messages enabled.
9323
+ %&-line parsing enabled.
9324
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
9325
+gcc.texi
9326
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
9327
+Loading texinfo [version 2013-09-11.11]:
9328
+\bindingoffset=\dimen16
9329
+\normaloffset=\dimen17
9330
+\pagewidth=\dimen18
9331
+\pageheight=\dimen19
9332
+\outerhsize=\dimen20
9333
+\outervsize=\dimen21
9334
+\cornerlong=\dimen22
9335
+\cornerthick=\dimen23
9336
+\topandbottommargin=\dimen24
9337
+\headlinebox=\box16
9338
+\footlinebox=\box17
9339
+\margin=\insert252
9340
+\EMsimple=\toks13
9341
+\groupbox=\box18
9342
+\groupinvalidhelp=\toks14
9343
+\mil=\dimen25
9344
+\exdentamount=\skip18
9345
+\inmarginspacing=\skip19
9346
+\centerpenalty=\count27
9347
+ pdf,
9348
+\tempnum=\count28
9349
+\lnkcount=\count29
9350
+\filename=\toks15
9351
+\filenamelength=\count30
9352
+\pgn=\count31
9353
+\toksA=\toks16
9354
+\toksB=\toks17
9355
+\toksC=\toks18
9356
+\toksD=\toks19
9357
+\boxA=\box19
9358
+\countA=\count32
9359
+\nopdfimagehelp=\toks20
9360
+ fonts,
9361
+\sffam=\fam8
9362
+\textleading=\dimen26
9363
+ markup,
9364
+\fontdepth=\count33
9365
+ glyphs,
9366
+\errorbox=\box20
9367
+
9368
+page headings,
9369
+\titlepagetopglue=\skip20
9370
+\titlepagebottomglue=\skip21
9371
+\evenheadline=\toks21
9372
+\oddheadline=\toks22
9373
+\evenfootline=\toks23
9374
+\oddfootline=\toks24
9375
+ tables,
9376
+\tableindent=\dimen27
9377
+\itemindent=\dimen28
9378
+\itemmargin=\dimen29
9379
+\itemmax=\dimen30
9380
+\itemno=\count34
9381
+\multitableparskip=\skip22
9382
+\multitableparindent=\skip23
9383
+\multitablecolspace=\dimen31
9384
+\multitablelinespace=\skip24
9385
+\colcount=\count35
9386
+\everytab=\toks25
9387
+ conditionals,
9388
+\doignorecount=\count36
9389
+ indexing,
9390
+\whatsitskip=\skip25
9391
+\whatsitpenalty=\count37
9392
+\secondaryindent=\skip26
9393
+\partialpage=\box21
9394
+\doublecolumnhsize=\dimen32
9395
+ sectioning,
9396
+\unnumberedno=\count38
9397
+\chapno=\count39
9398
+\secno=\count40
9399
+\subsecno=\count41
9400
+\subsubsecno=\count42
9401
+\appendixno=\count43
9402
+\absseclevel=\count44
9403
+\secbase=\count45
9404
+\chapheadingskip=\skip27
9405
+\secheadingskip=\skip28
9406
+\subsecheadingskip=\skip29
9407
+ toc,
9408
+\tocfile=\write0
9409
+\contentsrightmargin=\skip30
9410
+\savepageno=\count46
9411
+\lastnegativepageno=\count47
9412
+\tocindent=\dimen33
9413
+ environments,
9414
+\lispnarrowing=\skip31
9415
+\envskipamount=\skip32
9416
+\circthick=\dimen34
9417
+\cartouter=\dimen35
9418
+\cartinner=\dimen36
9419
+\normbskip=\skip33
9420
+\normpskip=\skip34
9421
+\normlskip=\skip35
9422
+\lskip=\skip36
9423
+\rskip=\skip37
9424
+\nonfillparindent=\dimen37
9425
+\tabw=\dimen38
9426
+\verbbox=\box22
9427
+
9428
+defuns,
9429
+\defbodyindent=\skip38
9430
+\defargsindent=\skip39
9431
+\deflastargmargin=\skip40
9432
+\defunpenalty=\count48
9433
+\parencount=\count49
9434
+\brackcount=\count50
9435
+ macros,
9436
+\paramno=\count51
9437
+\macname=\toks26
9438
+ cross references,
9439
+\auxfile=\write1
9440
+\savesfregister=\count52
9441
+\toprefbox=\box23
9442
+\printedrefnamebox=\box24
9443
+\infofilenamebox=\box25
9444
+\printedmanualbox=\box26
9445
+ insertions,
9446
+\footnoteno=\count53
9447
+\SAVEfootins=\box27
9448
+\SAVEmargin=\box28
9449
+
9450
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
9451
+This is `epsf.tex' v2.7.4 <14 February 2011>
9452
+\epsffilein=\read1
9453
+\epsfframemargin=\dimen39
9454
+\epsfframethickness=\dimen40
9455
+\epsfrsize=\dimen41
9456
+\epsftmp=\dimen42
9457
+\epsftsize=\dimen43
9458
+\epsfxsize=\dimen44
9459
+\epsfysize=\dimen45
9460
+\pspoints=\dimen46
9461
+)
9462
+\noepsfhelp=\toks27
9463
+ localization,
9464
+\nolanghelp=\toks28
9465
+\countUTFx=\count54
9466
+\countUTFy=\count55
9467
+\countUTFz=\count56
9468
+ formatting,
9469
+\defaultparindent=\dimen47
9470
+ and turning on texinfo input format.)
9471
+\openout1 = `gcc.aux'.
9472
+
9473
+@cpindfile=@write2
9474
+@fnindfile=@write3
9475
+@vrindfile=@write4
9476
+@tpindfile=@write5
9477
+@kyindfile=@write6
9478
+@pgindfile=@write7
9479
+texinfo.tex: doing @include of gcc-common.texi
9480
+
9481
+
9482
+./gcc.texi:25: I can't find file `gcc-common.texi'.
9483
+@temp ->@input gcc-common.texi
9484
+
9485
+@includezzz ...and @input #1 }@expandafter }@temp
9486
+                                                  @popthisfilestack
9487
+l.25 @include gcc-common.texi
9488
+
9489
+(Press Enter to retry, or Control-D to exit)
9490
+Please type another input file name: include/gcc-common.texi
9491
+(./include/gcc-common.texi
9492
+texinfo.tex: doing @include of gcc-vers.texi
9493
+
9494
+
9495
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
9496
+@temp ->@input gcc-vers.texi
9497
+
9498
+@includezzz ...and @input #1 }@expandafter }@temp
9499
+                                                  @popthisfilestack
9500
+l.11 @include gcc-vers.texi
9501
+
9502
+(Press Enter to retry, or Control-D to exit)
9503
+Please type another input file name: include/gcc-vers.texi
9504
+./include/gcc-common.texi:11: I can't find file `include/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:
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: Emergency stop.
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
+End of file on the terminal!
9530
+
9531
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
9532
+duced!
9533 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/emit-rtl.c gcc-5.3.0-zip/gcc/emit-rtl.c
9534
--- gcc-5.3.0-original/gcc/emit-rtl.c   2015-08-05 07:20:59.000000000 -0400
9535
+++ gcc-5.3.0-zip/gcc/emit-rtl.c        2016-04-01 06:40:42.812171791 -0400
9536
@@ -81,6 +81,15 @@
9537
 #include "builtins.h"
9538
 #include "rtl-iter.h"
9539
 
9540
+// #define     DO_ZIP_DEBUGS
9541
+#include <stdio.h>
9542
+#ifdef DO_ZIP_DEBUGS
9543
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9544
+extern void    zip_debug_rtx(const_rtx);
9545
+#else
9546
+#define        ZIP_DEBUG_LINE(STR,RTX)
9547
+#endif
9548
+
9549
 struct target_rtl default_target_rtl;
9550
 #if SWITCHABLE_TARGET
9551
 struct target_rtl *this_target_rtl = &default_target_rtl;
9552
@@ -2925,6 +2934,8 @@
9553
   int copied = 0;
9554
   int length;
9555
 
9556
+ZIP_DEBUG_LINE("Copy RTX if shared",*orig1);
9557
+
9558
   /* Repeat is used to turn tail-recursion into iteration.  */
9559
 repeat:
9560
   x = *orig1;
9561
@@ -2979,6 +2990,8 @@
9562
       break;
9563
     }
9564
 
9565
+ZIP_DEBUG_LINE("Before RTX_FLAG",x);
9566
+
9567
   /* This rtx may not be shared.  If it has already been seen,
9568
      replace it with a copy of itself.  */
9569
 
9570
@@ -2989,6 +3002,8 @@
9571
     }
9572
   RTX_FLAG (x, used) = 1;
9573
 
9574
+ZIP_DEBUG_LINE("Post RTX_FLAG",x);
9575
+
9576
   /* Now scan the subexpressions recursively.
9577
      We can store any replaced subexpressions directly into X
9578
      since we know X is not shared!  Any vectors in X
9579 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
9580
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
9581 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
9582 102 dgisselq
@@ -7999,6 +7999,8 @@
9583
    the back of the caller.
9584
    The normal operating mode is to pass FALSE for this parameter.  */
9585
 
9586
+#include "print-tree.h"
9587
+
9588
 rtx
9589
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
9590
                  enum expand_modifier modifier, rtx *alt_rtl,
9591 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/final.c gcc-5.3.0-zip/gcc/final.c
9592
--- gcc-5.3.0-original/gcc/final.c      2015-01-15 08:28:42.000000000 -0500
9593 122 dgisselq
+++ gcc-5.3.0-zip/gcc/final.c   2016-04-06 10:11:34.628479923 -0400
9594 111 dgisselq
@@ -109,6 +109,14 @@
9595
 #include "wide-int-print.h"
9596
 #include "rtl-iter.h"
9597
 
9598 122 dgisselq
+// #define     DO_ZIP_DEBUGS
9599 111 dgisselq
+#ifdef DO_ZIP_DEBUGS
9600
+extern void zip_debug_rtx(const_rtx);
9601
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9602
+#else
9603
+#define        ZIP_DEBUG_LINE(STR,RTX)
9604
+#endif
9605
+
9606
 #ifdef XCOFF_DEBUGGING_INFO
9607
 #include "xcoffout.h"          /* Needed for external data
9608
                                   declarations for e.g. AIX 4.x.  */
9609
@@ -2071,6 +2079,8 @@
9610
   /* Output the insns.  */
9611
   for (insn = first; insn;)
9612
     {
9613
+       ZIP_DEBUG_LINE("final()\n", insn);
9614
+
9615
       if (HAVE_ATTR_length)
9616
        {
9617
          if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
9618 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
9619
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
9620
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
9621
@@ -330,7 +330,8 @@
9622
         the size of a CC mode is four units.  */
9623
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
9624
 
9625
-      m->bytesize = 4;
9626
+       /* For the ZipCPU, however, it is only one unit */
9627
+      m->bytesize = 1;
9628
       m->ncomponents = 1;
9629
       m->component = 0;
9630
       break;
9631
@@ -766,11 +767,12 @@
9632
 
9633
   /* So put the default value unless the target needs a non standard
9634
      value. */
9635
-#ifdef BITS_PER_UNIT
9636
-  bits_per_unit = BITS_PER_UNIT;
9637
-#else
9638
-  bits_per_unit = 8;
9639
-#endif
9640
+// #ifdef BITS_PER_UNIT
9641
+  // bits_per_unit = BITS_PER_UNIT;
9642
+// #else
9643
+  bits_per_unit = 32;
9644
+#warning "Is there a more automated way to set bits per unit?"
9645
+// #endif
9646
 
9647
 #ifdef MAX_BITSIZE_MODE_ANY_INT
9648
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
9649
@@ -1083,7 +1085,7 @@
9650
       first = modes[c];
9651
       last = 0;
9652
       for (m = first; m; last = m, m = m->next)
9653
-       ;
9654
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
9655
 
9656
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
9657
         end will try to use it for bitfields in structures and the
9658
@@ -1268,7 +1270,7 @@
9659
            continue;
9660
          if (m->precision != (unsigned int) -1)
9661
            {
9662
-             if (m2->precision != 2 * m->precision)
9663
+             if (m2->precision < 2 * m->precision)
9664
                continue;
9665
            }
9666
          else
9667
@@ -1323,7 +1325,6 @@
9668
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
9669
     else
9670
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
9671
-
9672
   puts ("#undef MODE_MASK");
9673
   print_closer ();
9674
 }
9675
@@ -1351,12 +1352,23 @@
9676
   int c;
9677
   struct mode_data *m;
9678
 
9679
+  puts(
9680
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
9681
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
9682
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
9683
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
9684
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
9685
+" * of the target word in size.  However, this tries to do a little something\n"
9686
+" * teach our compiler what we are doing.\n"
9687
+" */\n");
9688
   print_maybe_const_decl ("%sunsigned char",
9689
                          "mode_base_align", "NUM_MACHINE_MODES",
9690
                          alignment);
9691
 
9692
   for_all_modes (c, m)
9693
-    tagged_printf ("%u", m->alignment, m->name);
9694
+    tagged_printf ("%u", 4*m->bytesize,
9695
+               // m->alignment,
9696
+               m->name);
9697
 
9698
   print_closer ();
9699
 }
9700 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/jump.c gcc-5.3.0-zip/gcc/jump.c
9701
--- gcc-5.3.0-original/gcc/jump.c       2015-01-27 04:19:30.000000000 -0500
9702 122 dgisselq
+++ gcc-5.3.0-zip/gcc/jump.c    2016-04-06 14:06:50.207563805 -0400
9703 117 dgisselq
@@ -80,6 +80,14 @@
9704
 #include "target.h"
9705
 #include "rtl-iter.h"
9706
 
9707
+// #define     DO_ZIP_DEBUGS
9708
+#ifdef DO_ZIP_DEBUGS
9709
+#include <stdio.h>
9710
+#define        ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
9711
+extern void zip_debug_rtx(const_rtx);
9712
+#else
9713
+#define        ZIP_DEBUG_LINE(STR,RTX)
9714
+#endif
9715
 /* Optimize jump y; x: ... y: jumpif... x?
9716
    Don't know if it is worth bothering with.  */
9717
 /* Optimize two cases of conditional jump to conditional jump?
9718
@@ -1136,6 +1144,7 @@
9719
   int i;
9720
   const char *fmt;
9721
 
9722
+ZIP_DEBUG_LINE("Mark jump label",insn);
9723
   switch (code)
9724
     {
9725
     case PC:
9726
@@ -1248,6 +1257,8 @@
9727
       break;
9728
     }
9729
 
9730
+ZIP_DEBUG_LINE("Post case",insn);
9731
+
9732
   fmt = GET_RTX_FORMAT (code);
9733
 
9734
   /* The primary target of a tablejump is the label of the ADDR_VEC,
9735 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
9736
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
9737 111 dgisselq
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-08 11:56:45.375491523 -0500
9738 102 dgisselq
@@ -184,11 +184,11 @@
9739
    larger types, then corresponding modes must be added here.  The
9740
    name OI is reserved for a 256-bit type (needed by some back ends).
9741
     */
9742
-INT_MODE (QI, 1);
9743
-INT_MODE (HI, 2);
9744
-INT_MODE (SI, 4);
9745
-INT_MODE (DI, 8);
9746
-INT_MODE (TI, 16);
9747
+// INT_MODE (QI, 1);
9748
+// INT_MODE (HI, 1);
9749
+INT_MODE (SI, 1);
9750
+INT_MODE (DI, 2);
9751
+INT_MODE (TI, 4);
9752
 
9753
 /* No partial integer modes are defined by default.  */
9754
 
9755 111 dgisselq
@@ -206,35 +206,35 @@
9756 102 dgisselq
    These are the IEEE mappings.  They can be overridden with
9757
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
9758
 
9759
-FLOAT_MODE (SF, 4, ieee_single_format);
9760
-FLOAT_MODE (DF, 8, ieee_double_format);
9761
+FLOAT_MODE (SF, 1, ieee_single_format);
9762
+FLOAT_MODE (DF, 2, ieee_double_format);
9763
 
9764
 /* Basic CC modes.
9765
    FIXME define this only for targets that need it.  */
9766 111 dgisselq
 CC_MODE (CC);
9767 102 dgisselq
 
9768
 /* Fixed-point modes.  */
9769 111 dgisselq
-FRACT_MODE (QQ, 1, 7); /* s.7 */
9770 102 dgisselq
-FRACT_MODE (HQ, 2, 15); /* s.15 */
9771
-FRACT_MODE (SQ, 4, 31); /* s.31 */
9772
-FRACT_MODE (DQ, 8, 63); /* s.63 */
9773
-FRACT_MODE (TQ, 16, 127); /* s.127 */
9774 111 dgisselq
-
9775
-UFRACT_MODE (UQQ, 1, 8); /* .8 */
9776 102 dgisselq
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
9777
-UFRACT_MODE (USQ, 4, 32); /* .32 */
9778
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
9779
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
9780 111 dgisselq
-
9781
-ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
9782
-ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
9783
-ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
9784
-ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
9785
-
9786
-UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
9787
-UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
9788
-UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
9789
-UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
9790
+/* FRACT_MODE (QQ, 1, 7); /* s.7 */
9791
+/* FRACT_MODE (HQ, 1, 15); /* s.15 */
9792
+FRACT_MODE (SQ, 1, 31); /* s.31 */
9793
+FRACT_MODE (DQ, 2, 63); /* s.63 */
9794
+FRACT_MODE (TQ, 4, 127); /* s.127 */
9795
+
9796
+/* UFRACT_MODE (UQQ, 1, 8); /* .8 */
9797
+/* UFRACT_MODE (UHQ, 1, 16); /* .16 */
9798 102 dgisselq
+UFRACT_MODE (USQ, 1, 32); /* .32 */
9799
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
9800
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
9801 111 dgisselq
+
9802
+/* ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
9803
+ACCUM_MODE (SA, 1, 16, 15); /* s16.15 */
9804
+ACCUM_MODE (DA, 2, 32, 31); /* s32.31 */
9805
+ACCUM_MODE (TA, 4, 64, 63); /* s64.63 */
9806
+
9807
+/* UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
9808
+UACCUM_MODE (USA, 1, 16, 16); /* 16.16 */
9809
+UACCUM_MODE (UDA, 2, 32, 32); /* 32.32 */
9810
+UACCUM_MODE (UTA, 4, 64, 64); /* 64.64 */
9811 102 dgisselq
 
9812 111 dgisselq
 /* Allow the target to specify additional modes of various kinds.  */
9813
 #if HAVE_EXTRA_MODES
9814 102 dgisselq
@@ -246,9 +246,9 @@
9815
 COMPLEX_MODES (FLOAT);
9816
 
9817
 /* Decimal floating point modes.  */
9818
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
9819
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
9820
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
9821
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
9822
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
9823
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
9824
 
9825
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
9826
    The tm.h file specifies which one.  It is not a distinct mode.  */
9827
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
9828
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
9829
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
9830
@@ -180,13 +180,7 @@
9831
 /* Get the size in bytes and bits of an object of mode MODE.  */
9832
 
9833
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
9834
-#if GCC_VERSION >= 4001
9835
-#define GET_MODE_SIZE(MODE) \
9836
-  ((unsigned short) (__builtin_constant_p (MODE) \
9837
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
9838
-#else
9839
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
9840
-#endif
9841
 #define GET_MODE_BITSIZE(MODE) \
9842
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
9843
 
9844
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
9845
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
9846
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
9847
@@ -765,10 +765,14 @@
9848
        {
9849
          switch (TYPE_MODE (type))
9850
            {
9851
+#ifdef HAVE_QImode
9852
            case QImode:
9853
              charType = 'C'; break;
9854
+#endif
9855
+#ifdef HAVE_HImode
9856
            case HImode:
9857
              charType = 'S'; break;
9858
+#endif
9859
            case SImode:
9860
              {
9861
                if (type == long_unsigned_type_node)
9862
@@ -788,10 +792,14 @@
9863
        {
9864
          switch (TYPE_MODE (type))
9865
            {
9866
+#ifdef HAVE_QImode
9867
            case QImode:
9868
              charType = 'c'; break;
9869
+#endif
9870
+#ifdef HAVE_HImode
9871
            case HImode:
9872
              charType = 's'; break;
9873
+#endif
9874
            case SImode:
9875
              {
9876
                if (type == long_integer_type_node)
9877
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
9878
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
9879 111 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-24 21:30:23.402590035 -0400
9880
@@ -71,6 +71,14 @@
9881 102 dgisselq
 #include "df.h"
9882
 #include "dbgcnt.h"
9883
 
9884 111 dgisselq
+// #define     DO_ZIP_DEBUGS
9885 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
9886
+extern void zip_debug_rtx(const_rtx);
9887
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9888
+#else
9889
+#define        ZIP_DEBUG_LINE(STR,RTX)
9890
+#endif
9891
+
9892
 static int reload_cse_noop_set_p (rtx);
9893
 static bool reload_cse_simplify (rtx_insn *, rtx);
9894
 static void reload_cse_regs_1 (void);
9895 111 dgisselq
@@ -120,6 +128,8 @@
9896 102 dgisselq
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
9897
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
9898
 
9899
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
9900
+
9901
   if (GET_CODE (body) == SET)
9902
     {
9903
       int count = 0;
9904 111 dgisselq
@@ -147,6 +157,7 @@
9905 102 dgisselq
        apply_change_group ();
9906
       else
9907
        reload_cse_simplify_operands (insn, testreg);
9908
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
9909
     }
9910
   else if (GET_CODE (body) == PARALLEL)
9911
     {
9912 111 dgisselq
@@ -205,6 +216,7 @@
9913 102 dgisselq
        apply_change_group ();
9914
       else
9915
        reload_cse_simplify_operands (insn, testreg);
9916
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
9917
     }
9918
 
9919
 done:
9920 111 dgisselq
@@ -246,6 +258,7 @@
9921 102 dgisselq
          cfg_changed |= reload_cse_simplify (insn, testreg);
9922
 
9923
        cselib_process_insn (insn);
9924
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
9925
       }
9926
 
9927
   /* Clean up.  */
9928 111 dgisselq
@@ -276,6 +289,8 @@
9929 102 dgisselq
 #endif
9930
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
9931
 
9932
+
9933
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
9934
   dreg = true_regnum (SET_DEST (set));
9935
   if (dreg < 0)
9936
     return 0;
9937 111 dgisselq
@@ -427,6 +442,7 @@
9938 102 dgisselq
   /* Array of alternatives, sorted in order of decreasing desirability.  */
9939
   int *alternative_order;
9940
 
9941
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
9942
   extract_constrain_insn (insn);
9943
 
9944
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
9945 111 dgisselq
@@ -519,6 +535,7 @@
9946 102 dgisselq
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
9947
     }
9948
 
9949
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
9950
   alternative_mask preferred = get_preferred_alternatives (insn);
9951
   for (i = 0; i < recog_data.n_operands; i++)
9952
     {
9953 111 dgisselq
@@ -617,6 +634,7 @@
9954 102 dgisselq
            }
9955
        }
9956
     }
9957
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
9958
 
9959
   /* Record all alternatives which are better or equal to the currently
9960
      matching one in the alternative_order array.  */
9961 111 dgisselq
@@ -666,6 +684,7 @@
9962 102 dgisselq
       validate_change (insn, recog_data.operand_loc[i],
9963
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
9964
     }
9965
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
9966
 
9967
   for (i = recog_data.n_dups - 1; i >= 0; i--)
9968
     {
9969 111 dgisselq
@@ -679,6 +698,7 @@
9970 102 dgisselq
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
9971
     }
9972
 
9973
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
9974
   return apply_change_group ();
9975
 }
9976
 
9977 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/recog.c gcc-5.3.0-zip/gcc/recog.c
9978
--- gcc-5.3.0-original/gcc/recog.c      2015-03-20 02:07:30.000000000 -0400
9979 122 dgisselq
+++ gcc-5.3.0-zip/gcc/recog.c   2016-04-06 17:45:29.552304498 -0400
9980 117 dgisselq
@@ -68,6 +68,15 @@
9981
 #include "df.h"
9982
 #include "insn-codes.h"
9983
 
9984
+// #define     DO_ZIP_DEBUGS
9985
+#ifdef DO_ZIP_DEBUGS
9986
+extern void    zip_debug_rtx(const_rtx);
9987
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
9988
+#else
9989
+#define        ZIP_DEBUG_LINE(STR,RTX)
9990
+#endif
9991
+
9992
+
9993
 #ifndef STACK_PUSH_CODE
9994
 #ifdef STACK_GROWS_DOWNWARD
9995
 #define STACK_PUSH_CODE PRE_DEC
9996 122 dgisselq
@@ -2283,6 +2292,7 @@
9997
   recog_data.n_dups = 0;
9998
   recog_data.is_asm = false;
9999
 
10000
+ZIP_DEBUG_LINE("Extract-insn", insn);
10001
   switch (GET_CODE (body))
10002
     {
10003
     case USE:
10004
@@ -3671,7 +3681,6 @@
10005 117 dgisselq
            break;
10006
 
10007
          /* The buffer filled to the current maximum, so try to match.  */
10008
-
10009
          pos = peep2_buf_position (peep2_current + peep2_current_count);
10010
          peep2_insn_data[pos].insn = PEEP2_EOB;
10011
          COPY_REG_SET (peep2_insn_data[pos].live_before, live);
10012 122 dgisselq
@@ -3704,6 +3713,7 @@
10013 117 dgisselq
     rebuild_jump_labels (get_insns ());
10014
   if (peep2_do_cleanup_cfg)
10015
     cleanup_cfg (CLEANUP_CFG_CHANGED);
10016
+
10017
 }
10018
 #endif /* HAVE_peephole2 */
10019
 
10020
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
10021
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
10022 122 dgisselq
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-04-06 17:44:36.240674020 -0400
10023 117 dgisselq
@@ -72,6 +72,14 @@
10024
 #include "dumpfile.h"
10025
 #include "rtl-iter.h"
10026
 
10027
+// #define     DO_ZIP_DEBUGS
10028
+#ifdef DO_ZIP_DEBUGS
10029
+extern void    zip_debug_rtx(const_rtx);
10030
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10031
+#else
10032
+#define        ZIP_DEBUG_LINE(STR,RTX)
10033
+#endif
10034
+
10035
 /* This file contains the reload pass of the compiler, which is
10036
    run after register allocation has been done.  It checks that
10037
    each insn is valid (operands required to be in registers really
10038
@@ -794,6 +802,18 @@
10039
   basic_block bb;
10040
   bool inserted;
10041
 
10042
+#ifdef DO_ZIP_DEBUGS
10043
+  {
10044
+       int     total_count = 0, current_count = 0;
10045
+       for (insn = first; insn; insn = NEXT_INSN (insn))
10046
+               total_count++;
10047
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
10048
+               fprintf(stderr, "B %3d/%3d", current_count++, total_count);
10049
+               zip_debug_rtx(insn);
10050
+       }
10051
+  }
10052
+#endif
10053
+
10054
   /* Make sure even insns with volatile mem refs are recognizable.  */
10055
   init_recog ();
10056
 
10057
@@ -1366,6 +1386,18 @@
10058
 
10059
   reload_completed = !failure;
10060
 
10061
+#ifdef DO_ZIP_DEBUGS
10062
+  {
10063
+       int     total_count = 0, current_count = 0;
10064
+       for (insn = first; insn; insn = NEXT_INSN (insn))
10065
+               total_count++;
10066
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
10067
+               fprintf(stderr, "A %3d/%3d", current_count++, total_count);
10068
+               zip_debug_rtx(insn);
10069
+       }
10070
+  }
10071
+#endif
10072
+
10073
   return need_dce;
10074
 }
10075
 
10076 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
10077
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
10078 122 dgisselq
+++ gcc-5.3.0-zip/gcc/reload.c  2016-04-06 17:49:33.418613170 -0400
10079
@@ -136,6 +136,15 @@
10080
 #include "target.h"
10081
 #include "ira.h"
10082
 
10083
+// #define     DO_ZIP_DEBUGS
10084
+#ifdef DO_ZIP_DEBUGS
10085
+extern void zip_debug_rtx(const_rtx);
10086
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
10087
+#else
10088
+#define        ZIP_DEBUG_LINE(STR,RTX)
10089
+#endif
10090
+
10091
+
10092
 /* True if X is a constant that can be forced into the constant pool.
10093
    MODE is the mode of the operand, or VOIDmode if not known.  */
10094
 #define CONST_POOL_OK_P(MODE, X)               \
10095
@@ -2700,6 +2709,8 @@
10096
   hard_regs_live_known = live_known;
10097
   static_reload_reg_p = reload_reg_p;
10098
 
10099
+ZIP_DEBUG_LINE("Find reloads\n", insn);
10100
+
10101
   /* JUMP_INSNs and CALL_INSNs are not allowed to have any output reloads;
10102
      neither are insns that SET cc0.  Insns that use CC0 are not allowed
10103
      to have any input reloads.  */
10104
@@ -2707,8 +2718,17 @@
10105 102 dgisselq
     no_output_reloads = 1;
10106
 
10107
 #ifdef HAVE_cc0
10108
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
10109
+  // cond_exec instruction, we cannot change the input so that the instruction
10110
+  // relies on another register--cc0 is specific.  This requries that the
10111
+  // references be only cc0 and (const_int 0), rather than allowing other
10112
+  // registers here as well.
10113
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
10114
     no_input_reloads = 1;
10115
+  // If the result of an instruction is the cc0 register, that cannot
10116
+  // be changed, therefore no output reloading is allowed.  This only
10117
+  // works if instructions *only* set the cc0 register, and not multiple
10118
+  // registers.
10119
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
10120
     no_output_reloads = 1;
10121
 #endif
10122
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
10123
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
10124
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
10125
@@ -503,6 +503,11 @@
10126
        return 0
10127
     }
10128
 
10129
+    # Zip CPU doesn't support profiling (yet)
10130
+    if { [istarget zip*] }
10131
+        return 0
10132
+    }
10133
+
10134
     # MinGW does not support -p.
10135
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
10136
        return 0
10137
@@ -986,6 +991,12 @@
10138
        }]
10139
     }
10140
 
10141
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
10142
+    # set supports it, the CPU just isn't ready yet.
10143
+    if { [istarget zip*-*-*] } {
10144
+        return 0
10145
+    }
10146
+
10147
     # This proc is actually checking the availabilty of FPU
10148
     # support for doubles, so on the RX we must fail if the
10149
     # 64-bit double multilib has been selected.
10150
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
10151
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
10152
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
10153
@@ -972,7 +972,7 @@
10154
     {
10155
       if (val & 1)
10156
        {
10157
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
10158
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
10159
          result += powi_lookup_cost (digit, cache)
10160
                    + POWI_WINDOW_SIZE + 1;
10161
          val >>= POWI_WINDOW_SIZE;
10162
@@ -1012,7 +1012,7 @@
10163
     }
10164
   else if (n & 1)
10165
     {
10166
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
10167
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
10168
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
10169
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
10170
     }
10171
@@ -1651,7 +1651,7 @@
10172
 };
10173
 
10174
 #define BITS_PER_MARKER 8
10175
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
10176
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
10177
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
10178
 #define HEAD_MARKER(n, size) \
10179
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
10180
@@ -1687,7 +1687,7 @@
10181
   /* Zero out the extra bits of N in order to avoid them being shifted
10182
      into the significant bits.  */
10183
   if (size < 64 / BITS_PER_MARKER)
10184
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10185
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10186
 
10187
   switch (code)
10188
     {
10189
@@ -1714,7 +1714,7 @@
10190
     }
10191
   /* Zero unused bits for size.  */
10192
   if (size < 64 / BITS_PER_MARKER)
10193
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10194
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10195
   return true;
10196
 }
10197
 
10198
@@ -1761,7 +1761,7 @@
10199
   n->n = CMPNOP;
10200
 
10201
   if (size < 64 / BITS_PER_MARKER)
10202
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
10203
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
10204
 
10205
   return true;
10206
 }
10207
@@ -2020,7 +2020,7 @@
10208
          {
10209
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
10210
            uint64_t val = int_cst_value (rhs2), mask = 0;
10211
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
10212
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
10213
 
10214
            /* Only constants masking full bytes are allowed.  */
10215
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
10216
@@ -2064,7 +2064,7 @@
10217
              {
10218
                /* If STMT casts to a smaller type mask out the bits not
10219
                   belonging to the target type.  */
10220
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
10221
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
10222
              }
10223
            n->type = type;
10224
            if (!n->base_addr)
10225
@@ -2177,7 +2177,7 @@
10226
     {
10227
       uint64_t mask;
10228
 
10229
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
10230
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
10231
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
10232
       cmpnop &= mask;
10233
     }
10234
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
10235
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
10236 117 dgisselq
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-31 18:55:03.584197958 -0400
10237 102 dgisselq
@@ -143,6 +143,13 @@
10238
 #include "rtl-iter.h"
10239
 #include "fibonacci_heap.h"
10240
 
10241 117 dgisselq
+#ifdef DO_ZIP_DEBUGS
10242 102 dgisselq
+#include <stdio.h>
10243
+extern void zip_debug_rtx(const_rtx);
10244
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10245
+#else
10246
+#define ZIP_DEBUG_LINE(STR,RTX)
10247
+#endif
10248
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
10249
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
10250
 
10251
@@ -6356,6 +6363,7 @@
10252
                machine_mode indmode
10253
                  = TYPE_MODE (TREE_TYPE (argtype));
10254
                rtx mem = gen_rtx_MEM (indmode, x);
10255
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
10256
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
10257
                if (val && cselib_preserved_value_p (val))
10258
                  {
10259
@@ -6462,12 +6470,14 @@
10260
       machine_mode mode
10261
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
10262
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
10263
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
10264
       HOST_WIDE_INT token
10265
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
10266
       if (token)
10267
        clobbered = plus_constant (mode, clobbered,
10268
                                   token * GET_MODE_SIZE (mode));
10269
       clobbered = gen_rtx_MEM (mode, clobbered);
10270
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
10271
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
10272
       call_arguments
10273
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
10274
@@ -9790,6 +9800,7 @@
10275
              machine_mode indmode
10276
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
10277
              rtx mem = gen_rtx_MEM (indmode, incoming);
10278
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
10279
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
10280
                                                         VOIDmode,
10281
                                                         get_insns ());
10282
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
10283
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
10284
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
10285
@@ -195,6 +195,9 @@
10286
 tic6x-*-*)
10287
        cpu_type=c6x
10288
        ;;
10289
+zip*)
10290
+       cpu_type=zip
10291
+       ;;
10292
 esac
10293
 
10294
 # Common parts for widely ported systems.
10295
@@ -1300,6 +1303,9 @@
10296
        echo "*** Configuration ${host} not supported" 1>&2
10297
        exit 1
10298
        ;;
10299
+zip*)
10300
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
10301
+       ;;
10302
 esac
10303
 
10304
 case ${host} in
10305
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
10306
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
10307
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
10308
@@ -150,6 +150,9 @@
10309
        # Need to link with -lpthread so libgomp.so is self-contained.
10310
        XLDFLAGS="${XLDFLAGS} -lpthread"
10311
        ;;
10312
+  zip*)
10313
+        config_path="bsd posix"
10314
+        ;;
10315
 
10316
   *)
10317
        ;;

powered by: WebSVN 2.1.0

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