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

Subversion Repositories zipcpu

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

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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-05-11 20:53:17.315195621 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-05-11 20:53:17.315195621 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-05-11 20:53:17.315195621 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-05-11 20:53:17.315195621 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-05-11 20:53:17.315195621 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-05-11 20:53:17.315195621 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-05-11 20:53:17.315195621 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-05-11 20:53:17.315195621 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-05-11 20:53:17.319195598 -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 142 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-05-11 20:53:17.319195598 -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 142 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-05-09 11:40:35.637861735 -0400
700
@@ -0,0 +1,2286 @@
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 142 dgisselq
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x2000;
812
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1fff;
813 102 dgisselq
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
814
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
815
+static int     zip_sched_issue_rate(void) { return 1; }
816
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
817
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
818
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
819
+       void    zip_debug_rtx(const_rtx x);
820
+static void    zip_override_options(void);
821
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
822
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
823 111 dgisselq
+static rtx     zip_legitimize_address(rtx x, rtx oldx, machine_mode mode);
824 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void);
825 122 dgisselq
+#ifdef HAVE_cc0
826
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
827
+#error "We're not supposed to have CC0 anymore"
828
+#else
829
+static bool    zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b);
830
+#endif
831 102 dgisselq
+
832
+
833 103 dgisselq
+#define        ALL_DEBUG_OFF   false
834 102 dgisselq
+#define        ALL_DEBUG_ON    false
835
+
836
+enum ZIP_BUILTIN_ID_CODE {
837
+       ZIP_BUILTIN_RTU,
838
+       ZIP_BUILTIN_HALT,
839
+       ZIP_BUILTIN_IDLE,
840
+       ZIP_BUILTIN_SYSCALL,
841
+       ZIP_BUILTIN_SAVE_CONTEXT,
842
+       ZIP_BUILTIN_RESTORE_CONTEXT,
843
+       ZIP_BUILTIN_BITREV,
844
+       ZIP_BUILTIN_CC,
845 117 dgisselq
+       ZIP_BUILTIN_UCC,
846 102 dgisselq
+       ZIP_BUILTIN_MAX
847
+};
848
+
849
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
850
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
851
+
852
+
853
+#include "gt-zip.h"
854
+
855
+/* The Global 'targetm' Variable. */
856
+struct gcc_target      targetm = TARGET_INITIALIZER;
857
+
858
+
859
+enum   reg_class zip_reg_class(int);
860
+
861
+#define        LOSE_AND_RETURN(msgid, x)               \
862
+       do {                                    \
863
+               zip_operand_lossage(msgid, x);  \
864
+               return;                         \
865
+       } while(0)
866
+
867
+/* Per-function machine data. */
868
+struct GTY(()) machine_function
869
+{
870
+       /* number of pretented arguments for varargs */
871
+       int     pretend_size;
872
+
873
+       /* Number of bytes saved on the stack for local variables. */
874
+       int     local_vars_size;
875
+
876
+       /* Number of bytes saved on stack for register save area */
877
+       int     saved_reg_size;
878
+       int     save_ret;
879
+
880
+       int     sp_fp_offset;
881
+       bool    fp_needed;
882
+       int     size_for_adjusting_sp;
883
+};
884
+
885
+/* Allocate a chunk of memory for per-function machine-dependent data. */
886
+
887
+static struct machine_function *
888
+zip_init_machine_status(void) {
889
+       return ggc_cleared_alloc<machine_function>();
890
+}
891
+
892
+static void
893
+zip_override_options(void)
894
+{
895
+       init_machine_status = zip_init_machine_status;
896
+}
897
+
898
+enum   reg_class
899
+zip_reg_class(int regno)
900
+{
901
+       if (is_ZIP_GENERAL_REG(regno)) {
902
+               return GENERAL_REGS;
903
+       } else if (is_ZIP_REG(regno)) {
904
+               return ALL_REGS;
905
+       } return NO_REGS;
906
+}
907
+
908
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
909
+static bool
910
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
911
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
912
+       return (size == -1)||(size > UNITS_PER_WORD);
913
+}
914
+
915
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
916
+ * insn.  Formatted output isn't easily implemented, since we use output operand
917
+ * lossage to output the actual message and handle the categorization of the
918
+ * error.  */
919
+
920
+static void
921
+zip_operand_lossage(const char *msgid, rtx op) {
922
+       fprintf(stderr, "Operand lossage??\n");
923
+       debug_rtx(op);
924
+       zip_debug_rtx(op);
925
+       output_operand_lossage("%s", msgid);
926
+}
927
+
928
+/* The PRINT_OPERAND_ADDRESS worker.   */
929
+void
930
+zip_print_operand_address(FILE *file, rtx x) {
931
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
932
+
933
+       if (dbg) zip_debug_rtx(x);
934
+       switch(GET_CODE(x)) {
935
+               case REG:
936 127 dgisselq
+                       gcc_assert(is_ZIP_REG(REGNO(x)));
937 102 dgisselq
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
938
+                       break;
939
+               case SYMBOL_REF:
940
+                       fprintf(file, "%s", XSTR(x,0));
941
+                       break;
942
+               case LABEL_REF:
943
+                       x = LABEL_REF_LABEL(x);
944
+               case CODE_LABEL:
945
+                       { char buf[256];
946
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
947
+#ifdef ASM_OUTPUT_LABEL_REF
948
+                       ASM_OUTPUT_LABEL_REF(file, buf);
949
+#else
950
+                       assemble_name(file, buf);
951
+#endif
952
+                       }
953
+                       break;
954
+               case PLUS:
955 111 dgisselq
+                       if (!REG_P(XEXP(x, 0))) {
956
+                               fprintf(stderr, "Unsupported address construct\n");
957
+                               zip_debug_rtx(x);
958 102 dgisselq
+                               abort();
959 127 dgisselq
+                       } gcc_assert(is_ZIP_REG(REGNO(XEXP(x,0))));
960
+                       if (CONST_INT_P(XEXP(x, 1))) {
961 102 dgisselq
+                               if (INTVAL(XEXP(x,1))!=0) {
962
+                                       fprintf(file, "%ld(%s)",
963 135 dgisselq
+                                       (long)INTVAL(XEXP(x, 1)),
964 102 dgisselq
+                                       reg_names[REGNO(XEXP(x, 0))]);
965
+                               } else {
966
+                                       fprintf(file, "(%s)",
967
+                                       reg_names[REGNO(XEXP(x, 0))]);
968
+                               }
969
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
970
+                               fprintf(file, "%s(%s)", XSTR(x,0),
971
+                                       reg_names[REGNO(XEXP(x, 0))]);
972
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
973
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
974
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
975
+                               fprintf(file, "%s-%s(%s)",
976
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
977
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
978
+                                       reg_names[REGNO(XEXP(x, 0))]);
979
+                       } else
980
+                               fprintf(file, "#INVALID(%s)",
981
+                                       reg_names[REGNO(XEXP(x, 0))]);
982
+                       /*
983
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
984
+                               fprintf(file, "%s(%s)",
985
+                                       GET_CODE(XEXP(addr, 1)),
986
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
987
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
988
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
989
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
990
+                               fprintf(file, "%s-%s(%s)",
991
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
992
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
993
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
994
+                       }
995
+                       */
996
+                       break;
997
+               // We don't support direct memory addressing within our
998
+               // instruction set, even though the instructions themselves
999
+               // would support direct memory addressing of the lower 18 bits
1000
+               // of memory space.
1001
+               case MEM:
1002
+                       if (dbg) zip_debug_rtx(x);
1003
+                       zip_print_operand_address(file, XEXP(x, 0));
1004
+                       break;
1005 111 dgisselq
+               case CONST_INT:
1006 135 dgisselq
+                       fprintf(file, "%ld",(long)INTVAL(x));
1007 111 dgisselq
+                       break;
1008 102 dgisselq
+               default:
1009 111 dgisselq
+                       fprintf(stderr, "Unknown address format\n");
1010
+                       zip_debug_rtx(x);
1011 102 dgisselq
+                       abort(); break;
1012
+                       // output_addr_const(file, x);
1013
+               break;
1014
+       }
1015
+}
1016
+
1017
+/* The PRINT_OPERAND worker. */
1018
+
1019
+void
1020
+zip_print_operand(FILE *file, rtx x, int code)
1021
+{
1022
+       rtx operand = x;
1023
+       int     rgoff = 0;
1024
+
1025
+       // fprintf(file, "Print Operand!\n");
1026
+
1027
+       /* New code entries should just be added to the switch below.  If
1028
+        * handling is finished, just return.  If handling was just a
1029
+        * modification of the operand, the modified operand should be put in
1030
+        * "operand", and then do a break to let default handling
1031
+        * (zero-modifier) output the operand.
1032
+        */
1033
+       switch(code) {
1034
+               case 0:
1035
+                       /* No code, print as usual. */
1036
+                       break;
1037
+               case 'L':
1038
+                       /* Lower of two registers, print one up */
1039
+                       rgoff = 1;
1040
+                       break;
1041
+               case 'R':
1042
+               case 'H':
1043
+                       /* Higher of a register pair, print normal */
1044
+                       break;
1045
+
1046
+               default:
1047
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
1048
+       }
1049
+
1050
+       /* Print an operand as without a modifier letter. */
1051
+       switch (GET_CODE(operand)) {
1052
+       case REG:
1053
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1054
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1055
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1056
+               return;
1057
+       case SCRATCH:
1058
+               LOSE_AND_RETURN("Need a scratch register", x);
1059
+               return;
1060
+
1061
+       case CODE_LABEL:
1062
+       case LABEL_REF:
1063
+       case SYMBOL_REF:
1064
+       case PLUS:
1065
+               PRINT_OPERAND_ADDRESS(file, operand);
1066
+               return;
1067
+       case MEM:
1068
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1069
+               return;
1070
+
1071
+       default:
1072
+               /* No need to handle all strange variants, let
1073
+                * output_addr_const do it for us.
1074
+                */
1075
+               if (CONSTANT_P(operand)) {
1076
+                       output_addr_const(file, operand);
1077
+                       return;
1078
+               }
1079
+
1080
+               LOSE_AND_RETURN("unexpected operand", x);
1081
+       }
1082
+}
1083
+
1084
+static bool
1085
+zip_frame_pointer_required(void)
1086
+{
1087
+       // This should really depend upon whether we have variable sized
1088
+       // arguments in our frame or not.  Once this fails, let's look
1089
+       // at what the problem was and then whether or not we can detect
1090
+       // it.
1091
+       //
1092
+       // Use a GCC global to determine our answer
1093 103 dgisselq
+       if (cfun->calls_alloca)
1094
+               return true;
1095 102 dgisselq
+       return (frame_pointer_needed);
1096
+/*
1097
+*/
1098
+}
1099
+
1100
+/* Determine whether or not a register needs to be saved on the stack or not.
1101
+ */
1102
+static bool
1103
+zip_save_reg(int regno) {
1104
+       if (regno == 0)
1105
+               return ((!crtl->is_leaf)
1106
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
1107
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
1108
+               return  ((df_regs_ever_live_p(regno))
1109
+                               &&(!call_used_regs[regno]));
1110
+       else if (regno == zip_FP)
1111
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
1112
+                               &&(!call_used_regs[regno])));
1113
+       else if (regno < zip_FP)
1114
+               return  ((df_regs_ever_live_p(regno))
1115
+                               &&(!call_used_regs[regno]));
1116
+       return false;
1117
+}
1118
+
1119
+/* Compute the size of the local area and the size to be adjusted by the
1120
+ * prologue and epilogue.
1121
+ *
1122
+ * Here's what we are looking at (top is the current, bottom is the last ...)
1123
+ *
1124
+ *     Stack Pointer ->
1125 124 dgisselq
+ *                     Outgoing arguments
1126 102 dgisselq
+ *                     Local variables (could be variable size)
1127
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
1128
+ *                     Saved return address, if saved
1129
+ *                     Other Saved registers
1130
+ *                     Saved frame pointer (if used)
1131
+ *                     Saved R12, if used
1132
+ *                     (Stack pointer is not saved)
1133
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
1134
+ *                     Called arguments (not passed in registers)
1135
+ *                     Return arguments (not R1, args.pretend_args_size)
1136
+ *             (Prior function's stack frame ... )
1137
+ *
1138
+ */
1139
+static void
1140
+zip_compute_frame(void) {
1141
+       int     regno;
1142
+       int     args_size;
1143 124 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1144 102 dgisselq
+
1145 124 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-COMPUTE-FRAME\n");
1146 102 dgisselq
+       // gcc_assert(crtl);
1147
+       gcc_assert(cfun);
1148
+       gcc_assert(cfun->machine);
1149
+
1150
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
1151
+
1152
+       if(crtl->args.pretend_args_size > 0) {
1153
+               args_size += crtl->args.pretend_args_size;
1154
+               // printf("%s pretend_args_size : %d\n", current_function_name(),
1155
+                       // crtl->args.pretend_args_size);
1156
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
1157
+       }
1158
+
1159
+       cfun->machine->local_vars_size = get_frame_size();
1160
+
1161
+       // Save callee-saved registers.
1162
+       cfun->machine->saved_reg_size = 0;
1163
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1164
+               if (zip_save_reg(regno))
1165
+                       cfun->machine->saved_reg_size ++;
1166
+       }
1167
+
1168
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
1169
+
1170
+       if ((cfun->machine->fp_needed)&&
1171
+                       (!df_regs_ever_live_p(zip_FP))) {
1172
+               cfun->machine->saved_reg_size ++;
1173
+       }
1174
+
1175
+       cfun->machine->sp_fp_offset = args_size + cfun->machine->local_vars_size;
1176
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
1177
+                       + cfun->machine->saved_reg_size
1178
+                       + args_size;
1179 124 dgisselq
+       if(dbg) {
1180
+               fprintf(stderr, "\tFRAME-POINTR: %s\n",
1181
+                       cfun->machine->fp_needed?"Yes":"No");
1182
+               fprintf(stderr, "\tARGS-SIZE   : %d\n",
1183
+                       args_size);
1184
+               fprintf(stderr, "\tLOCALS-SIZE : %d\n",
1185
+                       cfun->machine->local_vars_size);
1186
+               fprintf(stderr, "\tREGISTERS   : %d\n",
1187
+                       cfun->machine->saved_reg_size);
1188
+               fprintf(stderr, "\tSP_FP_OFFSET: %d\n",
1189
+                       cfun->machine->sp_fp_offset);
1190
+               fprintf(stderr, "\tSP-ADJUSTMNT: %d\n",
1191
+                       cfun->machine->size_for_adjusting_sp);
1192
+       }
1193 102 dgisselq
+}
1194
+
1195
+void
1196
+zip_expand_prologue(void) {
1197
+       rtx     insn;
1198
+
1199
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1200
+       zip_compute_frame();
1201
+
1202 124 dgisselq
+       if (dbg)  fprintf(stderr, "PROLOGUE: Computing Prologue instructions\n");
1203 127 dgisselq
+       if (dbg)  fprintf(stderr, "PROLOGUE: SP-FP offset is %d\n",
1204
+                       cfun->machine->sp_fp_offset);
1205 102 dgisselq
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1206 138 dgisselq
+               insn = emit_insn(gen_subsi3_reg_clobber(stack_pointer_rtx,
1207 102 dgisselq
+                               stack_pointer_rtx,
1208
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
1209
+                               SImode)));
1210
+                       // cfun->machine->sp_fp_offset
1211
+
1212
+               RTX_FRAME_RELATED_P(insn) = 1;
1213
+       }
1214
+
1215
+       {
1216
+               int offset = 0, regno;
1217
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1218
+                       if (zip_save_reg(regno)) {
1219 127 dgisselq
+                               if (dbg) fprintf(stderr,
1220
+                                       "PROLOGUE: Saving R%d in %d+%d(SP)\n",
1221
+                                       regno, cfun->machine->sp_fp_offset,
1222
+                                       offset);
1223 124 dgisselq
+                               insn=emit_insn(gen_movsi_sto_off(
1224
+                                       stack_pointer_rtx,
1225
+                                       GEN_INT(cfun->machine->sp_fp_offset
1226
+                                               +offset++),
1227 102 dgisselq
+                                       gen_rtx_REG(SImode, regno)));
1228
+                               RTX_FRAME_RELATED_P(insn) = 1;
1229
+                       }
1230
+               }
1231 103 dgisselq
+               if (dbg)  fprintf(stderr, "%d registers saved%s\n", offset,
1232
+                       (crtl->saves_all_registers)?", should be all of them":", less than all");
1233 102 dgisselq
+       }
1234
+
1235
+       if (cfun->machine->fp_needed) {
1236
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
1237
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
1238
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
1239 124 dgisselq
+                               stack_pointer_rtx,
1240
+                               GEN_INT(cfun->machine->sp_fp_offset)));
1241 102 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1242 103 dgisselq
+               if (dbg)  fprintf(stderr, "sp_fp_offset is %d\n", cfun->machine->sp_fp_offset);
1243 102 dgisselq
+       }
1244
+}
1245
+
1246
+bool
1247
+zip_use_return_insn(void)
1248
+{
1249
+       if ((!reload_completed)||(cfun->machine->fp_needed)
1250
+                       ||(get_frame_size()!=0)) {
1251
+               // If R0 ever gets pushed to the stack, then we cannot
1252
+               // use a master return from anywhere.  We need to clean up the
1253
+               // stack first.
1254
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
1255
+                                               &&(!call_used_regs[0]))) {
1256
+                       return false;
1257
+               }
1258
+       }
1259
+       zip_compute_frame();
1260
+       return (cfun->machine->size_for_adjusting_sp == 0);
1261
+}
1262
+
1263
+/* As per the notes in M68k.c, quote the function epilogue should not depend
1264
+ * upon the current stack pointer.  It should use the frame poitner only,
1265
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
1266
+ * take advantage of it to omit stack adjustments before returning ...
1267
+ *
1268
+ * Let's see if we can use their approach here.
1269
+ *
1270
+ * We can't.  Consider our choices:
1271
+ *     LOD (FP),R0
1272
+ *     LOD 1(FP),R4
1273
+ *     LOD 2(FP),R5
1274
+ *     LOD 3(FP),R6
1275
+ *     LOD 4(FP),FP
1276
+ *     ... Then what is the stack pointer?
1277
+ * or
1278
+ *     LOD (FP),R0
1279
+ *     LOD 1(FP),R4
1280
+ *     LOD 2(FP),R5
1281
+ *     LOD 3(FP),R6
1282
+ *     MOV FP,SP
1283
+ *     LOD 4(SP),FP
1284
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
1285
+ *     exploit our pipeline memory function
1286
+ * or
1287
+ *     MOV FP,SP
1288
+ *     LOD (SP),R0
1289
+ *     LOD 1(SP),R4
1290
+ *     LOD 2(SP),R5
1291
+ *     LOD 3(SP),R6
1292
+ *     LOD 4(SP),FP
1293
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
1294
+ *
1295
+ */
1296
+void
1297
+zip_expand_epilogue(void) {
1298
+       int     regno, offset;
1299
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1300 138 dgisselq
+       rtx     insn;
1301 102 dgisselq
+
1302
+       zip_compute_frame();
1303
+
1304
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1305
+       if (cfun->machine->fp_needed) {
1306 124 dgisselq
+               // This is done special--if you can't trust the stack pointer
1307
+               // enough so that you must have a frame pointer, then you can't
1308
+               // trust its offset enough to restore from it.  Hence, we start
1309
+               // by moving the frame pointer to the stack pointer to recover
1310
+               // the stack pointer back to a usable value.
1311 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
1312 138 dgisselq
+               insn = emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1313
+               RTX_FRAME_RELATED_P(insn) = 1;
1314 102 dgisselq
+       }
1315
+
1316
+       if (cfun->machine->saved_reg_size != 0) {
1317 124 dgisselq
+               if (cfun->machine->fp_needed)
1318
+                       offset = 0;
1319
+               else
1320
+                       offset = cfun->machine->sp_fp_offset;
1321 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1322
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1323
+                       if (zip_save_reg(regno)) {
1324
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
1325 138 dgisselq
+                               rtx reg = gen_rtx_REG(SImode, regno);
1326
+                               insn = emit_insn(gen_movsi_lod_off(
1327
+                                               reg,
1328 124 dgisselq
+                                               stack_pointer_rtx,
1329
+                                               GEN_INT(offset++)));
1330 138 dgisselq
+                               add_reg_note(insn, REG_CFA_RESTORE, reg);
1331
+                               RTX_FRAME_RELATED_P(insn) = 1;
1332 102 dgisselq
+                       }
1333
+               }
1334
+       }
1335
+
1336 124 dgisselq
+       if (cfun->machine->fp_needed) {
1337
+               // Restore the stack pointer back to the original, the
1338
+               // difference being the difference from the frame pointer
1339
+               // to the original stack
1340 138 dgisselq
+               insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
1341
+                       stack_pointer_rtx,
1342 124 dgisselq
+                       GEN_INT(cfun->machine->size_for_adjusting_sp
1343
+                               -cfun->machine->sp_fp_offset)));
1344 138 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1345 124 dgisselq
+       } else {
1346
+               // else now the difference is between the stack pointer and
1347
+               // the original stack pointer.
1348 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
1349
+                               cfun->machine->size_for_adjusting_sp);
1350 138 dgisselq
+               insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
1351
+                       stack_pointer_rtx,
1352 124 dgisselq
+                       GEN_INT(cfun->machine->size_for_adjusting_sp)));
1353 138 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1354 102 dgisselq
+       }
1355
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
1356
+
1357 138 dgisselq
+       // The return RTX is not allowed to be frame related
1358
+       insn = emit_jump_insn(ret_rtx);
1359
+       // RTX_FRAME_RELATED_P(insn) = 1;
1360 102 dgisselq
+}
1361
+
1362
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1363
+ *
1364
+ * We currently only support calculating the return address for the current
1365
+ * frame.
1366
+ */
1367
+
1368
+/*
1369
+rtx
1370
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
1371
+{
1372
+       if (count)
1373
+               return NULL_RTX;
1374
+
1375
+       zip_compute_frame();
1376
+
1377
+       // saved return address for current function is at fp - 1
1378
+       if (cfun->machine->save_ret)
1379
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
1380
+                               -UNITS_PER_WORD));
1381
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
1382
+}
1383
+*/
1384
+
1385
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
1386
+ * return the OFFSET.
1387
+ */
1388
+int
1389
+zip_initial_elimination_offset(int from, int to) {
1390
+       int     ret = 0;
1391
+       zip_compute_frame();
1392
+
1393
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1394
+               ret = cfun->machine->sp_fp_offset;
1395 117 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
1396
+               ret = cfun->machine->sp_fp_offset;
1397 102 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1398 117 dgisselq
+               // ret = cfun->machine->local_vars_size;
1399
+               ret = 0;
1400 102 dgisselq
+       } else {
1401
+               abort();
1402
+       }
1403
+
1404
+       return ret;
1405
+}
1406
+
1407
+/*
1408
+ * Code taken from m68k ...
1409
+ */
1410
+static bool
1411
+zip_can_eliminate(int from, int to)
1412
+{
1413
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
1414
+       if ((from == zip_FP)&&(to == zip_SP))
1415
+               return !cfun->machine->fp_needed;
1416
+       return true;
1417
+}
1418
+
1419
+/*
1420
+static void
1421
+zip_basic_check(void)
1422
+{
1423
+       gcc_assert(mode_base_align[SImode]==4);
1424
+       if ((BITS_PER_UNIT != 32)
1425
+                       ||(GET_MODE_SIZE(SImode)!=1)
1426
+                       ||(GET_MODE_SIZE(DImode)!=1)
1427
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
1428
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
1429
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
1430
+               gcc_assert(BITS_PER_UNIT==32);
1431
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
1432
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
1433
+       }
1434
+}
1435
+*/
1436
+
1437
+#define        zip_basic_check()
1438
+
1439
+/* Compute the number of word sized regiters needed to hold a function
1440
+ * argument of mode INT_MODE and tree type TYPE.
1441
+ */
1442
+int
1443
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
1444
+       int     size;
1445
+
1446
+       zip_basic_check();
1447
+
1448
+       if (targetm.calls.must_pass_in_stack(mode, type))
1449
+               return 0;
1450
+
1451
+       if ((type)&&(mode == BLKmode))
1452
+               size = int_size_in_bytes(type);
1453
+       else
1454
+               size = GET_MODE_SIZE(mode);
1455
+
1456
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
1457
+}
1458
+
1459
+/* pushed in function prologue */
1460
+/*
1461
+static int
1462
+zip_arg_partial_bytes(CUMULATIVE_ARGS *cum, enum machine_mode mode,
1463
+               tree type, bool name ATTRIBUTE_UNUSED) {
1464
+       int     words;
1465
+       unsigned int    regs = zip_num_arg_regs(mode, type);
1466
+
1467
+       if (*cum >= ZIP_LAST_ARG_REGNO + 1)
1468
+               words = 0;
1469
+       else if ((*cum + regs) > ZIP_LAST_ARG_REGNO + 1)
1470
+               words = (*cum + regs) - ZIP_LAST_ARG_REGNO + 1;
1471
+       else
1472
+               words = 0;
1473
+
1474
+       return words * UNITS_PER_WORD;
1475
+}
1476
+*/
1477
+
1478
+static void
1479
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
1480
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
1481
+       CUMULATIVE_ARGS *cum;
1482
+       int     nreg;
1483
+
1484
+       zip_basic_check();
1485
+
1486
+       cum = get_cumulative_args(ca);
1487
+       nreg = zip_num_arg_regs(mode, type);
1488
+       if (((*cum)+nreg) > NUM_ARG_REGS)
1489
+               (*cum) = NUM_ARG_REGS;
1490
+       else
1491
+               (*cum) += nreg;
1492
+}
1493
+
1494
+static rtx
1495
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
1496
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
1497
+       CUMULATIVE_ARGS *cum;
1498
+
1499
+       zip_basic_check();
1500
+
1501
+
1502
+       if (!named)
1503
+               return NULL_RTX;
1504
+       //if (targetm.calls.must_pass_in_stack(mode, type))
1505
+               //return NULL_RTX;
1506
+       cum = get_cumulative_args(ca);
1507
+
1508
+       if ((*cum) >= NUM_ARG_REGS)
1509
+               return NULL_RTX;
1510
+       return
1511
+               gen_rtx_REG(mode, (*cum)+1);
1512
+}
1513
+
1514 122 dgisselq
+#ifdef HAVE_cc0
1515 102 dgisselq
+/* NOTICE_UPDATE_CC sends us here
1516
+ */
1517
+void
1518
+zip_update_cc_notice(rtx exp, rtx_insn *insn)
1519
+{
1520 122 dgisselq
+#error "The CC0 code was supposed to be removed"
1521 102 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1522
+       enum    attr_ccresult  ccr;
1523
+       enum    attr_conditional  conditionally_executed;
1524
+
1525
+       // The default is that nothing has changed.
1526
+       // cc_status = cc_status_prev;
1527
+       rtx     src, dest;
1528
+
1529
+       if (dbg) fprintf(stderr, "CC-NOTICE ...\n");
1530
+       if (dbg) zip_debug_rtx_pfx("CC :", exp);
1531
+       if (dbg) debug_rtx(exp);
1532
+
1533
+       ccr = get_attr_ccresult(insn);
1534
+       if (ccr == CCRESULT_UNKNOWN) {
1535
+               CC_STATUS_INIT;
1536
+               if (dbg) fprintf(stderr, "\tINIT-CC\n");
1537
+               return;
1538
+       }
1539
+
1540
+       if ((GET_CODE(exp) == PARALLEL)&&(GET_CODE(XVECEXP(exp, 0, 0))==SET)) {
1541
+               // This works up and until we add cc0 parallel instructions
1542
+               // to our instruction set.
1543
+               dest = SET_DEST(XVECEXP(exp, 0, 0));
1544
+               src  = SET_SRC (XVECEXP(exp, 0, 0));
1545
+       } else if (GET_CODE(exp) == SET) {
1546
+               dest = SET_DEST(exp);
1547
+               src  = SET_SRC (exp);
1548
+       } else {
1549
+               // First, do nothing if we haven't touched the condition codes.
1550
+               // Condition codes can only be changed as a result of a set
1551
+               // expression ...?
1552
+               if (dbg) fprintf(stderr, "Non-set expression, doesn\'t touch condition codes\n");
1553
+               return;
1554
+       }
1555
+
1556 111 dgisselq
+
1557
+       if (ccr == CCRESULT_UNCHANGED) {
1558
+               if (dbg) fprintf(stderr, "\tUnchanged CC\n");
1559
+
1560
+               // We can't just run away here ... even though the CC result
1561
+               // hasn't changed, GCC's ability to recognize it as a valid
1562
+               // result has changed.  In other words, if we just 'set' a
1563
+               // value contained within either value1 or value2, then we'll
1564
+               // need to update those values so that they are no longer looked
1565
+               // upon as potentially containing the current CC values.
1566
+
1567
+               if (dest) {
1568
+                       if (dest == cc0_rtx)
1569
+                               CC_STATUS_INIT;
1570
+                       else if ((REG_P(dest))&&(dest != pc_rtx)) {
1571
+                               // An example here might be a load instruction
1572
+                               if (reg_mentioned_p(dest, cc_status.value1))
1573
+                                       cc_status.value1 = NULL_RTX;
1574
+                               if (reg_mentioned_p(dest, cc_status.value2))
1575
+                                       cc_status.value2 = NULL_RTX;
1576
+                       }
1577
+               }
1578
+               return;
1579
+       }
1580
+
1581 102 dgisselq
+       // Gotta wait on this test, until we know whether or not the
1582
+       // conditionally executed instruction was designed to set the
1583
+       // CC0 register.
1584
+       conditionally_executed = get_attr_conditional(insn);
1585
+       if ((conditionally_executed == CONDITIONAL_YES)&&(dest != cc0_rtx)) {
1586
+               // cc_status is unchanged
1587 111 dgisselq
+               // However, GCC's vision of it may have changed
1588
+               //
1589
+               // Initialize CC_STATUS
1590 102 dgisselq
+               if (dbg) fprintf(stderr, "\tCC -- unchanged (conditional exec)\n");
1591 111 dgisselq
+               CC_STATUS_INIT;
1592 102 dgisselq
+               return;
1593 111 dgisselq
+       } else if (GET_CODE(src)==IF_THEN_ELSE) {
1594
+               // Same thing as above
1595
+               CC_STATUS_INIT;
1596
+               return;
1597 102 dgisselq
+       }
1598
+
1599
+       if (ccr == CCRESULT_VALIDZN)
1600
+               cc_status.flags = CC_NO_OVERFLOW;
1601
+       else
1602
+               cc_status.flags = 0;
1603
+       cc_status.value1 = dest;
1604
+       if (dest == cc0_rtx)
1605
+               cc_status.value2 = src;
1606
+       else if((REG_P(dest))&&(!reg_mentioned_p(dest, src)))
1607
+               cc_status.value2 = src;
1608
+       else if((SUBREG_P(dest))&&(!reg_mentioned_p(XEXP(dest,0), src)))
1609
+               cc_status.value2 = src;
1610
+       else
1611
+               cc_status.value2 = 0;
1612
+       if (dbg) fprintf(stderr, "\tCC -- Set flags for\n");
1613
+       if (dbg) zip_debug_rtx_pfx("V1: ", dest);
1614
+       if ((dbg)&&(cc_status.value2)) zip_debug_rtx_pfx("V2: ", src);
1615
+       else if (dbg)   fprintf(stderr, "V2: (No SRC)\n");
1616
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "src refers to dest ?? %s\n",
1617
+               refers_to_regno_p(REGNO(dest),REGNO(dest),src,NULL)?"Yes":"No");
1618
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "Occurrs %d times\n",
1619
+               count_occurrences(dest,src,0));
1620
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s mentioned\n",
1621
+               reg_mentioned_p(dest,src)?"Is":"Is not");
1622
+       if ((dbg)&&(REG_P(dest))) fprintf(stderr, "%s referenced\n",
1623
+               reg_referenced_p(dest,src)?"Is":"Is not");
1624
+
1625
+//
1626
+// These results are only used in final.c, where they are used to remove
1627
+// compare instructions if the optimizer is on.  If I produce nothing, no
1628
+// compare instructions will be removed.  If I produce something, a smart
1629
+// decision may be made to remove compare instructions.
1630
+//
1631
+// cc_status will be compared  with subsequent
1632
+//     (set (cc0) (something)) (i.e. compare only) instructions
1633
+//
1634
+//     (set (cc0) (compare (x) (y)))
1635
+//     dst = cc0 -- the destination of the set is ignored, save that it must be
1636
+//             cc0
1637
+//     src1 = (compare (x) (y))
1638
+//     if (src1 == compare)&&(y == (const_int 0))
1639
+//             src2 = (x)
1640
+//     else
1641
+//             src2 = null
1642
+//
1643
+//     Four conditions:
1644
+//     1. if (val1)&&(src1 == val1)
1645
+//             This would be true if I had seen a (set (val1) (src1)) insn
1646
+//             If I have seen a (set (val1) (src1))
1647
+//                     or equivalently a (set (val1) (compare (x) (y)))
1648
+//     or
1649
+//     2. if (val2)&&(src1 == val2)
1650
+//             This would be true if I had seen a (set (val1) (src1)) insn,
1651
+//             and only if val2 was still valid.
1652
+//     or
1653
+//     3. if (src2)&&(value1)&&(src2 == value1)
1654
+//             This would be true if we are comparing against zero, and the
1655
+//             number we are comparing against zero is value 1
1656
+//     or
1657
+//     4. if (src2)&&(value2)&&(src2 == value2)
1658
+//             ... or value2.  This is the common ZipCPU case.
1659
+//
1660
+//             then delete the compare.
1661
+//
1662
+}
1663 122 dgisselq
+#else
1664 102 dgisselq
+
1665 122 dgisselq
+void   zip_canonicalize_comparison(int *code, rtx *op0, rtx *op1,
1666
+               bool preserve_op0)
1667
+{
1668
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1669 102 dgisselq
+
1670 122 dgisselq
+       if (dbg) fprintf(stderr, "CANONICALIZE ...%s\n", (preserve_op0)?"(Preserve Op0)":"");
1671
+       if (dbg) zip_debug_rtx_pfx("CODE", gen_rtx_fmt_ee((rtx_code)*code, VOIDmode, gen_rtx_REG(CCmode,zip_CC), const0_rtx));
1672
+       if (dbg) zip_debug_rtx_pfx("OP0 ", *op0);
1673
+       if (dbg) zip_debug_rtx_pfx("OP1 ", *op1);
1674
+
1675
+       if ((!preserve_op0)&&((*code == LE)||(*code == GTU)||(*code == GEU))) {
1676
+               rtx tem = *op0;
1677
+               *op0 = *op1;
1678
+               *op1 = tem;
1679
+               *code = (int)swap_condition((enum rtx_code)*code);
1680
+       }
1681
+
1682
+       if ((*code == LE)||(*code == LEU)||(*code == GTU)) {
1683
+               int offset = 1; // (*code == GTU) ? 1 : -1;
1684
+               bool    swap = false;
1685
+
1686
+               if (CONST_INT_P(*op1)) {
1687
+                       *op1 = GEN_INT(INTVAL(*op1)+offset);
1688
+                       swap = true;
1689
+               } else if (REG_P(*op1)) {
1690 138 dgisselq
+                       *op1 = plus_constant(GET_MODE(*op1), *op1, offset, true);
1691 122 dgisselq
+                       swap = true;
1692
+               } else if ((GET_CODE(*op1)==PLUS)&&(CONST_INT_P(XEXP(*op1,1)))){
1693
+                       *op1 = plus_constant(GET_MODE(*op1),XEXP(*op1,0),
1694
+                               INTVAL(XEXP(*op1,1))+offset);
1695
+                       swap = true;
1696
+               } if (swap) {
1697
+                       if (*code == LE)
1698
+                               (*code)= LT;
1699
+                       else if (*code == LEU)
1700
+                               (*code)= LTU;
1701
+                       else // (*code == GTU)
1702
+                               (*code) = GEU;
1703
+               }
1704
+       }
1705
+}
1706
+
1707
+static bool
1708
+zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b) {
1709
+       *a = zip_CC;
1710
+       *b = INVALID_REGNUM;
1711
+       return true;
1712
+}
1713
+
1714
+#endif
1715
+
1716
+
1717 102 dgisselq
+/* totally buggy - we can't return pointers to nested functions */
1718
+static void
1719
+zip_asm_trampoline_template(FILE *f) {
1720
+       // Whereas at one time I thought I wouldn't need it, now I know I
1721
+       // need this trampoline function, although it is for a completely
1722
+       // different purpose than the one I was familiar with.
1723 138 dgisselq
+       fprintf(f, "\tbrev\t0,r1\n");
1724
+       fprintf(f, "\tldilo\t0,r1\n");
1725 102 dgisselq
+       fprintf(f, "\tjmp r1\n");
1726
+}
1727
+
1728
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
1729
+static void
1730
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
1731
+       tree fndecl ATTRIBUTE_UNUSED,
1732
+       rtx chain_value ATTRIBUTE_UNUSED) {
1733
+// #warning "This needs to be filled out"
1734
+       abort();
1735
+}
1736
+
1737
+static tree
1738
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
1739
+       tree type)
1740
+{
1741
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
1742
+       zip_basic_check();
1743
+
1744
+       if(t) {
1745
+               zip_builtins[code] = t;
1746
+               zip_builtins_icode[code] = icode;
1747
+       }
1748
+
1749
+       return t;
1750
+
1751
+}
1752
+
1753
+void   zip_init_builtins(void) {
1754
+       zip_basic_check();
1755
+
1756
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
1757
+#ifdef HAVE_zip_rtu
1758
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
1759
+#endif
1760
+#ifdef HAVE_zip_halt
1761
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
1762
+#endif
1763
+#ifdef HAVE_zip_idle
1764
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
1765
+#endif
1766
+
1767
+#ifdef HAVE_zip_syscall
1768
+// Support int SYSCALL(callID, int a, int b, int c);
1769
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
1770
+                       build_function_type_list(void_type_node, NULL_TREE));
1771
+#endif
1772
+
1773
+#ifdef HAVE_zip_save_context
1774
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
1775
+               build_function_type_list(void_type_node, ptr_type_node, 0));
1776
+#endif
1777
+
1778
+#ifdef HAVE_zip_restore_context
1779
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
1780
+       build_function_type_list(void_type_node, ptr_type_node, 0));
1781
+#endif
1782
+
1783
+#ifdef HAVE_zip_bitrev
1784
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
1785
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
1786
+               NULL_TREE));
1787
+#endif
1788
+
1789
+#ifdef HAVE_zip_cc
1790
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
1791
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1792
+#endif
1793
+
1794 117 dgisselq
+#ifdef HAVE_zip_ucc
1795
+  def_builtin("zip_ucc", CODE_FOR_zip_ucc, ZIP_BUILTIN_UCC,
1796
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1797
+#endif
1798
+
1799 102 dgisselq
+}
1800
+
1801
+static tree
1802
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
1803
+{
1804
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
1805
+    return error_mark_node;
1806
+
1807
+  return zip_builtins[zip_builtin_code];
1808
+}
1809
+
1810
+static rtx
1811
+zip_expand_builtin(tree exp, rtx target,
1812
+               rtx subtarget ATTRIBUTE_UNUSED,
1813
+               machine_mode tmode ATTRIBUTE_UNUSED,
1814
+               int     ignore ATTRIBUTE_UNUSED) {
1815
+
1816
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
1817
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
1818
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
1819
+       enum    insn_code icode = zip_builtins_icode[code];
1820
+       rtx     pat, op[5];
1821
+       call_expr_arg_iterator  iter;
1822
+       tree    arg;
1823
+
1824
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
1825
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
1826
+               arg = first_call_expr_arg(exp, &iter);
1827
+               if (arg == error_mark_node)
1828
+                       return NULL_RTX;
1829
+               op[0] = expand_normal(arg);
1830
+               if (GET_CODE(op[0]) != REG)
1831
+                       op[0] = force_reg(Pmode, op[0]);
1832
+               pat = GEN_FCN(icode)(op[0]);
1833
+       } else if (code == ZIP_BUILTIN_BITREV) {
1834
+               arg = first_call_expr_arg(exp, &iter);
1835
+               if (arg == error_mark_node) {
1836
+                       return NULL_RTX;
1837
+               }
1838
+               op[0] = expand_normal(arg);
1839
+               if (!target)
1840
+                       target = gen_reg_rtx(SImode);
1841
+               pat = GEN_FCN(icode)(target, op[0]);
1842 117 dgisselq
+       } else if ((code == ZIP_BUILTIN_CC)||(code == ZIP_BUILTIN_UCC)) {
1843 102 dgisselq
+               if (!target)
1844
+                       target = gen_reg_rtx(SImode);
1845
+               pat = GEN_FCN(icode)(target);
1846
+       } else // RTU, HALT, IDLE
1847
+               pat = GEN_FCN(icode)();
1848
+       if (!pat)
1849
+               return NULL_RTX;
1850
+       emit_insn(pat);
1851
+       return (nonvoid ? target : const0_rtx);
1852
+}
1853
+
1854
+static bool
1855
+zip_scalar_mode_supported_p(enum machine_mode mode) {
1856
+       zip_basic_check();
1857
+
1858
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
1859
+}
1860
+
1861
+static bool
1862
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
1863
+       return ((mode)==SFmode)||((mode)==DFmode);
1864
+}
1865
+
1866
+static int
1867
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
1868
+       enum machine_mode mode ATTRIBUTE_UNUSED,
1869
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
1870
+       return 1;
1871
+}
1872
+
1873
+static bool
1874
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
1875
+       addr_space_t as ATTRIBUTE_UNUSED) {
1876
+       return false;
1877
+}
1878
+
1879
+/*
1880
+static void
1881
+zip_asm_output_anchor(rtx x) {
1882
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
1883
+}
1884
+*/
1885
+
1886
+static void
1887
+zip_debug_print(const char *pfx, int lvl, const char *str) {
1888
+       int     i;
1889
+       i = lvl;
1890
+       if ((true)||(lvl == 0))
1891
+               fprintf(stderr, "%s", pfx);
1892
+       else
1893
+               i += strlen(pfx);
1894
+       while(i-->0)
1895
+               fprintf(stderr, "  ");
1896
+       fprintf(stderr, "%s\n", str);
1897
+}
1898
+
1899
+static void
1900
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
1901
+       int     i;
1902
+
1903
+       i = lvl;
1904
+       if ((true)||(lvl == 0))
1905
+               fprintf(stderr, "%s", pfx);
1906
+       else
1907
+               i = lvl+strlen(pfx);
1908
+       while(i-->0)
1909
+               fprintf(stderr, "  ");
1910
+       switch(m) {
1911
+               case VOIDmode:
1912
+                       fprintf(stderr, "%s:V\n", str);
1913
+                       break;
1914
+               case BLKmode:
1915
+                       fprintf(stderr, "%s:BLK\n", str);
1916
+                       break;
1917
+               case BImode:
1918
+                       fprintf(stderr, "%s:BI\n", str);
1919
+                       break;
1920
+#ifdef HAVE_QImode
1921
+               case QImode:
1922
+                       fprintf(stderr, "%s:QI\n", str);
1923
+                       break;
1924
+#endif
1925
+#ifdef HAVE_HImode
1926
+               case HImode:
1927
+                       fprintf(stderr, "%s:HI\n", str);
1928
+                       break;
1929
+#endif
1930
+               case SImode:
1931
+                       fprintf(stderr, "%s:SI\n", str);
1932
+                       break;
1933 122 dgisselq
+               case CCmode:
1934
+                       fprintf(stderr, "%s:CC\n", str);
1935
+                       break;
1936 102 dgisselq
+               case DImode:
1937
+                       fprintf(stderr, "%s:DI\n", str);
1938
+                       break;
1939
+               default:
1940
+                       fprintf(stderr, "%s:?\n", str);
1941
+       }
1942
+}
1943
+
1944
+static void
1945
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
1946
+       if (x == NULL_RTX) {
1947
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
1948
+               return;
1949
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
1950
+               char    buf[64];
1951
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
1952
+               zip_debug_print(pfx, lvl, buf);
1953 117 dgisselq
+               gcc_assert(0 && "Bad RTX Code");
1954 102 dgisselq
+               return;
1955
+       } switch(GET_CODE(x)) { // rtl.def
1956 122 dgisselq
+       case PARALLEL:
1957
+               zip_debug_print(pfx, lvl, "(PARALLEL");
1958
+               for(int j=0; j<XVECLEN(x,0);j++)
1959
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1960
+               zip_debug_print(pfx, lvl, ")");
1961
+               debug_rtx(x);
1962
+               break;
1963 102 dgisselq
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
1964 122 dgisselq
+       case SEQUENCE:
1965
+               zip_debug_print(pfx, lvl, "(SEQUENCE");
1966
+               for(int j=0; j<XVECLEN(x,0);j++)
1967
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1968
+               zip_debug_print(pfx, lvl, ")");
1969
+               debug_rtx(x);
1970
+               break;
1971 102 dgisselq
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
1972
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
1973
+       case INSN:
1974
+               zip_debug_print(pfx, lvl, "(INSN");
1975
+               /*
1976
+               { const rtx_insn *tmp_rtx;
1977
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
1978
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
1979
+               }}
1980
+               */
1981
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1982
+               zip_debug_print(pfx, lvl, ")");
1983 117 dgisselq
+               debug_rtx(x);
1984 102 dgisselq
+               break;
1985
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
1986 111 dgisselq
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1987
+               zip_debug_print(pfx, lvl, ")");
1988
+               /*
1989 102 dgisselq
+               if (JUMP_LABEL(x)) {
1990 111 dgisselq
+                       if (GET_CODE(JUMP_LABEL(x)) == LABEL_REF) {
1991
+                               char    buf[64];
1992
+                               sprintf(buf, "(LABEL *.L%d))", CODE_LABEL_NUMBER(LABEL_REF_LABEL(JUMP_LABEL(x))));
1993
+                               zip_debug_print(pfx, lvl+1, buf);
1994
+                       } else if (GET_CODE(JUMP_LABEL(x))==CODE_LABEL) {
1995
+                               char    buf[64];
1996
+                               sprintf(buf, "(CODE_LABEL *.L%d))", CODE_LABEL_NUMBER(JUMP_LABEL(x)));
1997
+                               zip_debug_print(pfx, lvl+1, buf);
1998
+                       } else
1999
+                       zip_debug_print(pfx, lvl+1, "(w/Label))");
2000 102 dgisselq
+               } else
2001 111 dgisselq
+                       zip_debug_print(pfx, lvl+1, "(NO label))");
2002
+               debug_rtx(x);
2003
+               */
2004 102 dgisselq
+               break;
2005
+       case CALL:
2006
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
2007
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
2008
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
2009
+               zip_debug_print(pfx, lvl, ")");
2010
+               break;
2011
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
2012
+               debug_rtx(x);
2013
+               break;
2014
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
2015
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
2016
+       case NOTE:
2017
+               {       char buf[128];
2018
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
2019
+                       zip_debug_print(pfx, lvl, buf);
2020
+               }break;
2021
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
2022
+               debug_rtx(x);
2023
+               break;
2024
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
2025
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
2026
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
2027
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
2028
+       case CODE_LABEL:
2029
+               {
2030
+                       char    buf[64];
2031 111 dgisselq
+                       sprintf(buf, "(CODE_LABEL *.L%d)", CODE_LABEL_NUMBER(x));
2032 102 dgisselq
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2033
+               } break;
2034
+       case SET:
2035
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
2036 117 dgisselq
+               zip_debug_rtx_1(pfx, SET_DEST(x),lvl+1);
2037
+               zip_debug_rtx_1(pfx, SET_SRC(x),lvl+1);
2038 102 dgisselq
+               zip_debug_print(pfx, lvl, ")");
2039 117 dgisselq
+               debug_rtx(x);
2040 102 dgisselq
+               break;
2041 122 dgisselq
+       case REG: {
2042 127 dgisselq
+               char buf[25], mstr[4];
2043
+               mstr[0] = '\0';
2044
+               if (GET_MODE(x) == SImode)
2045
+                       strcpy(mstr, ":SI");
2046
+               else if (GET_MODE(x) == DImode)
2047
+                       strcpy(mstr, ":DI");
2048
+               else if (GET_MODE(x) == VOIDmode)
2049
+                       strcpy(mstr, ":V");
2050 102 dgisselq
+               if (REGNO(x) == zip_PC)
2051 127 dgisselq
+                       sprintf(buf, "(PC%s)", mstr);
2052 102 dgisselq
+               else if (REGNO(x) == zip_CC)
2053 127 dgisselq
+                       sprintf(buf, "(CC%s)", mstr);
2054 102 dgisselq
+               else if (REGNO(x) == zip_SP)
2055 127 dgisselq
+                       sprintf(buf, "(SP%s)", mstr);
2056 102 dgisselq
+               else if (REGNO(x) == zip_FP)
2057 127 dgisselq
+                       sprintf(buf, "(REG%s FP)", mstr);
2058 102 dgisselq
+               else if (REGNO(x) == zip_GOT)
2059 127 dgisselq
+                       sprintf(buf, "(REG%s GBL)", mstr);
2060 102 dgisselq
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
2061 127 dgisselq
+                       sprintf(buf, "(REG%s RTN-VL)", mstr);
2062 102 dgisselq
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
2063 127 dgisselq
+                       sprintf(buf, "(REG%s RTN-AD)", mstr);
2064 122 dgisselq
+               else
2065 127 dgisselq
+                       sprintf(buf, "(REG%s %d)", mstr, REGNO(x));
2066
+               if (mstr[0])
2067
+                       zip_debug_print(pfx, lvl, buf);
2068
+               else
2069
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2070 102 dgisselq
+               } break;
2071
+       case IF_THEN_ELSE: // 51
2072
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
2073
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2074
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2075
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
2076
+               zip_debug_print(pfx, lvl, ")");
2077
+               break;
2078
+       case PC:
2079
+               zip_debug_print(pfx, lvl, "(PC)");
2080
+               break;
2081
+       case CC0:
2082
+               zip_debug_print(pfx, lvl, "(CC0)");
2083
+               break;
2084
+       case COMPARE:
2085 127 dgisselq
+               zip_debug_print_m(pfx, lvl, "(COMPARE", GET_MODE(x));
2086 102 dgisselq
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2087
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2088
+               zip_debug_print(pfx, lvl, ")");
2089
+               break;
2090 111 dgisselq
+       case CONST:
2091
+               zip_debug_print_m(pfx, lvl, "(CONST", GET_MODE(x));
2092
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2093
+               zip_debug_print(pfx, lvl, ")");
2094
+               break;
2095 102 dgisselq
+       case CONST_INT:
2096
+               { char buf[25];
2097
+               if (GET_MODE(x)==SImode)
2098 135 dgisselq
+                       sprintf(buf, "(CONST_INT:SI %ld)", (long)INTVAL(x));
2099 102 dgisselq
+               else if (GET_MODE(x)==VOIDmode)
2100 135 dgisselq
+                       sprintf(buf, "(CONST_INT:V %ld)", (long)INTVAL(x));
2101 102 dgisselq
+               else
2102 135 dgisselq
+                       sprintf(buf, "(CONST_INT:? %ld)", (long)INTVAL(x));
2103 102 dgisselq
+               zip_debug_print(pfx, lvl, buf);
2104
+               } break;
2105
+       case LABEL_REF:
2106 122 dgisselq
+               { char buf[256];
2107 111 dgisselq
+               sprintf(buf, "(LABEL *.L%d)", CODE_LABEL_NUMBER(LABEL_REF_LABEL(x)));
2108
+               zip_debug_print(pfx, lvl, buf);
2109
+               }
2110 102 dgisselq
+               break;
2111
+       case SYMBOL_REF:
2112
+               {
2113
+                       char buf[64];
2114
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
2115
+                       // fprintf(file, "%s", XSTR(x,0));
2116
+                       zip_debug_print(pfx, lvl, buf);
2117
+               }
2118
+               break;
2119
+       case MEM:
2120
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
2121
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2122
+               zip_debug_print(pfx, lvl, ")");
2123
+               break;
2124
+       /*
2125
+       case VALUE:
2126
+               {
2127
+                       char buf[64];
2128
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
2129
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
2130
+               }
2131
+               break;
2132
+       */
2133
+       case PLUS:
2134
+               zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
2135
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2136
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2137
+               zip_debug_print(pfx, lvl, ")");
2138
+               break;
2139
+       case MINUS:
2140
+               zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
2141
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2142
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2143
+               zip_debug_print(pfx, lvl, ")");
2144
+               break;
2145
+       case AND:
2146
+               zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
2147
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2148
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2149
+               zip_debug_print(pfx, lvl, ")");
2150
+               break;
2151
+       case IOR:
2152
+               zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
2153
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2154
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2155
+               zip_debug_print(pfx, lvl, ")");
2156
+               break;
2157
+       case XOR:
2158
+               zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
2159
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2160
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2161
+               zip_debug_print(pfx, lvl, ")");
2162
+               break;
2163
+       case MULT:
2164
+               zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
2165
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2166
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2167
+               zip_debug_print(pfx, lvl, ")");
2168
+               break;
2169
+       case EQ:        //
2170
+               zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
2171
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2172
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2173
+               zip_debug_print(pfx, lvl, ")");
2174
+               break;
2175
+       case NE:        //
2176
+               zip_debug_print_m(pfx, lvl, "(NE", GET_MODE(x));
2177
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2178
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2179
+               zip_debug_print(pfx, lvl, ")");
2180
+               break;
2181
+       case GE:        //
2182
+               zip_debug_print_m(pfx, lvl, "(GE", GET_MODE(x));
2183
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2184
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2185
+               zip_debug_print(pfx, lvl, ")");
2186
+               break;
2187
+       case GT:        //
2188
+               zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
2189
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2190
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2191
+               zip_debug_print(pfx, lvl, ")");
2192
+               break;
2193
+       case LE:        //
2194
+               zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
2195
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2196
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2197
+               zip_debug_print(pfx, lvl, ")");
2198
+               break;
2199
+       case LT:        //
2200
+               zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
2201
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2202
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2203
+               zip_debug_print(pfx, lvl, ")");
2204
+               break;
2205
+       case GEU:       //
2206
+               zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
2207
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2208
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2209
+               zip_debug_print(pfx, lvl, ")");
2210
+               break;
2211
+       case GTU:       //
2212
+               zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
2213
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2214
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2215
+               zip_debug_print(pfx, lvl, ")");
2216
+               break;
2217
+       case LEU:       //
2218
+               zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
2219
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2220
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2221
+               zip_debug_print(pfx, lvl, ")");
2222
+               break;
2223
+       case LTU:       //
2224
+               zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
2225
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2226
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2227
+               zip_debug_print(pfx, lvl, ")");
2228
+               break;
2229
+       case SCRATCH:   //
2230
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
2231
+               break;
2232
+       case SUBREG:
2233
+               { char buf[25];
2234 111 dgisselq
+               if (REG_P(XEXP(x,0))) {
2235
+                       sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
2236
+                               SUBREG_BYTE(x));
2237
+                       zip_debug_print(pfx, lvl, buf);
2238
+               } else if (MEM_P(XEXP(x,0))) {
2239
+                       sprintf(buf, "(SUBREG /%d", SUBREG_BYTE(x));
2240
+                       zip_debug_print(pfx, lvl, buf);
2241
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2242
+                       zip_debug_print(pfx, lvl, ")");
2243
+               } else {
2244
+                       sprintf(buf, "(SUBREG UNK /%d", SUBREG_BYTE(x));
2245
+                       zip_debug_print(pfx, lvl, buf);
2246
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2247
+                       zip_debug_print(pfx, lvl, ")");
2248
+               }}
2249
+               break;
2250 127 dgisselq
+       case ASHIFT:
2251
+               zip_debug_print_m(pfx, lvl, "(ASHIFT", GET_MODE(x));
2252
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2253
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2254
+               zip_debug_print(pfx, lvl, ")");
2255
+               break;
2256
+       case ASHIFTRT:
2257
+               zip_debug_print_m(pfx, lvl, "(ASHIFTRT", GET_MODE(x));
2258
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2259
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2260
+               zip_debug_print(pfx, lvl, ")");
2261
+               break;
2262
+       case LSHIFTRT:
2263
+               zip_debug_print_m(pfx, lvl, "(LSHIFTRT", GET_MODE(x));
2264
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2265
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2266
+               zip_debug_print(pfx, lvl, ")");
2267
+               break;
2268 102 dgisselq
+       default:
2269 111 dgisselq
+               { char buf[128];
2270 102 dgisselq
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
2271
+               zip_debug_print(pfx, lvl, buf);
2272
+               debug_rtx(x);
2273
+               } break;
2274
+       }
2275
+}
2276
+
2277
+void
2278
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
2279
+       zip_debug_rtx_1(pfx, x, 0);
2280
+}
2281
+
2282
+void
2283
+zip_debug_rtx(const_rtx x) {
2284
+       zip_debug_rtx_pfx("", x);
2285
+}
2286
+
2287
+void
2288 142 dgisselq
+zip_debug_ccode(int ccode) {
2289
+       switch(ccode) {
2290
+       case    EQ: fprintf(stderr, "EQ"); break;
2291
+       case    NE: fprintf(stderr, "NE"); break;
2292
+       case    GT: fprintf(stderr, "GT"); break;
2293
+       case    GE: fprintf(stderr, "GE"); break;
2294
+       case    LT: fprintf(stderr, "LT"); break;
2295
+       case    LE: fprintf(stderr, "LE"); break;
2296
+       case    GTU: fprintf(stderr, "GTU"); break;
2297
+       case    GEU: fprintf(stderr, "GEU"); break;
2298
+       case    LTU: fprintf(stderr, "LTU"); break;
2299
+       case    LEU: fprintf(stderr, "LEU"); break;
2300
+       default:
2301
+               fprintf(stderr, "%d", ccode); break;
2302
+       }
2303
+}
2304
+
2305
+void
2306 102 dgisselq
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
2307
+}
2308
+
2309
+void
2310
+zip_debug_bb(basic_block bb) {
2311
+       rtx_insn        *insn;
2312
+
2313
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
2314
+       FOR_BB_INSNS(bb, insn)
2315
+       {
2316
+               zip_debug_rtx(insn);
2317
+       }
2318
+}
2319
+
2320
+
2321
+static bool
2322 122 dgisselq
+zip_legitimate_opb(rtx x, bool strict)
2323 102 dgisselq
+{
2324 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2325 102 dgisselq
+
2326 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB\n");
2327 102 dgisselq
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
2328
+
2329
+       if (NULL_RTX == x)
2330
+               return false;
2331 122 dgisselq
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
2332
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> Mode failure\n");
2333 102 dgisselq
+               return false;
2334 122 dgisselq
+       } else if ((strict)&&(REG_P(x))) {
2335
+               if (REGNO(x)<zip_CC) {
2336
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2337
+                       return true;
2338
+               } else return false;
2339
+       } else if (register_operand(x, GET_MODE(x))) {
2340
+               // This also handles subregs
2341
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2342
+               return true;
2343 111 dgisselq
+       } else if ((CONST_INT_P(x))
2344
+               &&(INTVAL(x) >= zip_min_opb_imm)
2345
+               &&(INTVAL(x) <= zip_max_opb_imm)) {
2346 136 dgisselq
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (Const) %ld <= %ld <= %ld\n", (long)zip_min_opb_imm, (long)INTVAL(x), (long)zip_max_opb_imm);
2347 111 dgisselq
+               return true;
2348 122 dgisselq
+       // } else if ((GET_CODE(x) == LABEL_REF)||(GET_CODE(x)==CODE_LABEL)) {
2349
+               // return true;
2350 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2351
+               // Is it a valid register?
2352 122 dgisselq
+               if ((!strict)&&(!register_operand((rtx)XEXP((rtx)x,0), GET_MODE(x)))) {
2353 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (No reg in +%s)\n",
2354 102 dgisselq
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2355
+                       return false;
2356 122 dgisselq
+               } else if ((strict)&&((!REG_P(XEXP(x,0)))||(REGNO(XEXP(x,0))>=zip_CC))) {
2357 102 dgisselq
+                       return false;
2358
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2359
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
2360
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
2361 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (reg+int)\n");
2362 103 dgisselq
+                       // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
2363
+                               // gcc_unreachable();
2364 102 dgisselq
+                       return true;
2365
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
2366 122 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == CODE_LABEL)
2367 102 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
2368
+                       // While we can technically support this, the problem
2369
+                       // is that the symbol address could be anywhere, and we
2370
+                       // have no way of recovering if it's outside of our
2371
+                       // 14 allowable bits.
2372 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No. (reg+lbl)\n");
2373 102 dgisselq
+                       return false;
2374
+               }
2375
+       }
2376
+
2377 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No\n");
2378 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2379
+       return false;
2380
+}
2381
+
2382
+static bool
2383
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
2384
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2385
+
2386
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
2387
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
2388
+
2389 122 dgisselq
+       if (!zip_legitimate_opb(x, strict))
2390 102 dgisselq
+               return false;
2391 122 dgisselq
+       else if ((GET_CODE(x)==PLUS)&&(CONST_INT_P(XEXP(x,1)))) {
2392
+               if ((INTVAL(XEXP(x, 1)) > zip_max_mov_offset)
2393
+                       ||(INTVAL(XEXP(x, 1)) < zip_min_mov_offset)) {
2394 135 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> NO! (reg+int), int out of bounds: %ld\n", (long)INTVAL(XEXP(x,1)));
2395 102 dgisselq
+                       return false;
2396
+               }
2397
+       }
2398
+
2399 122 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> Yes\n");
2400 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2401 122 dgisselq
+       return true;
2402 102 dgisselq
+}
2403
+
2404
+int
2405
+zip_pd_mov_operand(rtx op)
2406
+{
2407
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2408
+
2409
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
2410
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
2411
+}
2412
+
2413
+int
2414 111 dgisselq
+zip_pd_mvimm_operand(rtx op)
2415
+{
2416
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2417
+
2418
+       if (dbg) fprintf(stderr, "ZIP-VALID-MVIMM(predicate) for OPERAND\n");
2419
+       if (!CONST_INT_P(op))
2420
+               return false;
2421
+       if (INTVAL(op) > zip_max_mov_offset)
2422
+               return false;
2423
+       if (INTVAL(op) < zip_min_mov_offset)
2424
+               return false;
2425
+       return true;
2426
+}
2427
+
2428
+int
2429
+zip_pd_imm_operand(rtx op)
2430
+{
2431
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2432
+
2433
+       if (dbg) fprintf(stderr, "ZIP-VALID-IMM(predicate) for OPERAND\n");
2434
+       if (!CONST_INT_P(op))
2435
+               return false;
2436
+       if (INTVAL(op) > zip_max_anchor_offset)
2437
+               return false;
2438
+       if (INTVAL(op) < zip_min_anchor_offset)
2439
+               return false;
2440
+       return true;
2441
+}
2442
+
2443
+int
2444 102 dgisselq
+zip_address_operand(rtx op)
2445
+{
2446
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2447
+
2448
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
2449 111 dgisselq
+       if ((REG_P(op))&&(REGNO(op)==zip_CC))
2450
+               return false;
2451
+       else if ((GET_CODE(op) == PLUS)&&(REG_P(XEXP(op,0)))
2452
+                       &&(REGNO(XEXP(op,0))==zip_CC))
2453
+               return false;
2454
+       else
2455
+               return zip_legitimate_opb(op, !can_create_pseudo_p());
2456 102 dgisselq
+}
2457
+
2458
+int
2459 111 dgisselq
+zip_pd_opb_operand(rtx op)
2460 102 dgisselq
+{
2461
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2462
+
2463 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-OPB(predicate) for OPERAND\n");
2464 122 dgisselq
+       return zip_legitimate_opb(op, false); //, !can_create_pseudo_p());
2465 102 dgisselq
+}
2466
+
2467
+int
2468
+zip_ct_address_operand(rtx op)
2469
+{
2470
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2471
+
2472
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
2473 111 dgisselq
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2474 102 dgisselq
+}
2475
+
2476
+int
2477
+zip_const_address_operand(rtx x) {
2478
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2479
+
2480
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
2481
+       if (dbg) zip_debug_rtx(x);
2482 127 dgisselq
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
2483
+               fprintf(stderr, "is ZIP-CONST-ADDRESS? -> NO, BAD MODE\n");
2484 102 dgisselq
+               return false;
2485 127 dgisselq
+       }
2486 102 dgisselq
+       if ((GET_CODE(x) == LABEL_REF)
2487
+                       ||(GET_CODE(x) == CODE_LABEL)
2488
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
2489 127 dgisselq
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES! (LBL)\n");
2490 102 dgisselq
+               return true;
2491
+       } else if (CONST_INT_P(x)) {
2492 127 dgisselq
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES! (INT)\n");
2493 102 dgisselq
+               return true;
2494
+       } else if (GET_CODE(x) == PLUS) {
2495
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
2496
+               return ((zip_const_address_operand(XEXP(x,0)))
2497
+                       &&(CONST_INT_P(XEXP(x,1))));
2498
+       } else if (GET_CODE(x) == MINUS) {
2499
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
2500
+               return ((zip_const_address_operand(XEXP(x,0)))
2501
+                       &&(zip_const_address_operand(XEXP(x,1))));
2502
+       }
2503
+
2504
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
2505
+       if (dbg) zip_debug_rtx(x);
2506
+       return false;
2507
+}
2508
+
2509
+int
2510
+zip_ct_const_address_operand(rtx x) {
2511
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2512
+
2513
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
2514
+       return zip_const_address_operand(x);
2515
+}
2516
+
2517
+int
2518
+zip_pd_const_address_operand(rtx x) {
2519
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2520
+
2521
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
2522
+       return zip_const_address_operand(x);
2523
+}
2524
+
2525
+
2526
+static bool
2527
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
2528
+{
2529
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2530
+
2531
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
2532
+       if (dbg) zip_debug_rtx(x);
2533
+
2534
+       // Only insist the register be a valid register if strict is true
2535 111 dgisselq
+       if (zip_legitimate_opb(x, strict))
2536 102 dgisselq
+               return true;
2537 111 dgisselq
+       // else if (zip_const_address_operand(x))
2538
+               // return true;
2539 102 dgisselq
+
2540
+       return false;
2541
+}
2542
+
2543 111 dgisselq
+static rtx
2544
+zip_legitimize_address(rtx x, rtx oldx ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED) {
2545
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2546
+
2547
+       if (dbg) zip_debug_rtx_pfx("LEGITIMIZE: ", x);
2548
+       if (zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2549
+               return x;
2550
+
2551
+       if (GET_CODE(x)==PLUS) {
2552
+               if (!REG_P(XEXP(x,0)))
2553
+                       XEXP(x,0) = force_reg(GET_MODE(x),XEXP(x,0));
2554
+               if ((!zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2555
+                       &&(!CONST_INT_P(XEXP(x,1))))
2556
+                       x = force_reg(GET_MODE(x),x);
2557
+       } else if (MEM_P(x))
2558
+               x = force_reg(GET_MODE(x),x);
2559
+
2560
+       if (dbg) zip_debug_rtx_pfx("LEGITIMATE: ", x);
2561
+       return x;
2562
+}
2563
+
2564 102 dgisselq
+void
2565
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
2566
+{
2567
+       assemble_name(stream, name);
2568
+       fprintf(stream, "\t.equ ");
2569
+       assemble_name(stream, value);
2570
+       fputc('\n', stream);
2571
+}
2572
+
2573 111 dgisselq
+#define        USE_SUBREG
2574
+#ifdef USE_SUBREG
2575
+#define        SREG_P(RTX) ((SUBREG_P(RTX))&&(REG_P(XEXP(RTX,0))))
2576
+#define        SMEM_P(RTX) ((SUBREG_P(RTX))&&(MEM_P(XEXP(RTX,0))))
2577
+#else
2578
+#define        SREG_P(RTX)     false
2579
+#define        SMEM_P(RTX)     false
2580
+#endif
2581 102 dgisselq
+
2582
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
2583 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2584 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
2585
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2586
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
2587
+       switch(GET_CODE(condition)) {
2588
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
2589
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
2590
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
2591
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
2592
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
2593
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
2594
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
2595
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
2596
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
2597
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
2598
+       default:
2599
+               zip_debug_rtx(condition);
2600
+               internal_error("CSTORE Unsupported condition");
2601
+               return NULL;
2602
+       }
2603
+}
2604
+
2605 127 dgisselq
+/*
2606 102 dgisselq
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
2607
+       static char     result[64] = "";
2608
+       switch(condition) {
2609
+               //
2610
+               // Result already exists in the iffalse register
2611
+               // Can't change it.  Therefore, on the
2612
+               // condition ... move true register to the
2613
+               // destination
2614
+               //
2615
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
2616
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
2617
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
2618
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
2619
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
2620
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2621
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
2622
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
2623
+               //
2624
+               // .GTU doesn't exist on the Zip CPU either. We also note that
2625
+               // .C will never be set on an equal condition.  Therefore, we
2626
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
2627
+               // as long as .Z wasn't true.  We then undo this when we're
2628
+               // done.  This is possible since none of these instructions
2629
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
2630
+               // the condition codes.
2631
+               //
2632
+               // This is obviously not very optimal.  Avoid this by all means
2633
+               // if you can
2634
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
2635
+               // .LEU doesn't exist on Zip CPU either--turn this into another
2636
+               // two instructions
2637
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2638
+               //
2639
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
2640
+               // painful.  We can change the condition codes to make it so,
2641
+               // but the instruction requires the condition codes not be
2642
+               // changed.  Hence, we must change them back if we do so.
2643
+               //
2644
+               // .C will be set on less than but not equal.  Hence !.C will
2645
+               // be true on greater than or equal.
2646
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
2647
+               default:
2648
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
2649
+                       return NULL;
2650
+       } return result;
2651
+}
2652 127 dgisselq
+*/
2653 102 dgisselq
+
2654 127 dgisselq
+bool
2655
+zip_supported_condition(int c) {
2656
+       switch(c) {
2657
+       case NE: case LT: case EQ: case GT: case GE: case LTU:
2658
+               return true;
2659
+               break;
2660
+       default:
2661
+               break;
2662
+       } return false;
2663 102 dgisselq
+}
2664
+
2665 127 dgisselq
+bool
2666
+zip_signed_comparison(int c) {
2667
+       switch(c) {
2668
+       case NE: case LT: case EQ: case GT: case GE:
2669
+               return true;
2670
+       default:
2671
+               break;
2672
+       } return false;
2673
+}
2674
+
2675 142 dgisselq
+bool
2676 127 dgisselq
+zip_expand_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
2677 142 dgisselq
+       rtx_insn *insn;
2678 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2679 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
2680
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
2681
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2682
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
2683
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
2684 127 dgisselq
+
2685
+       // Start with the condition
2686
+       rtx     cmpa = XEXP(condition,0), cmpb=XEXP(condition,1);
2687
+       enum rtx_code   cmpcode = GET_CODE(condition);
2688
+
2689 142 dgisselq
+       // Want to always do the false expression, and only sometimes the
2690
+       // true expression.  If, however, the false is a constant and the
2691
+       // true and destination are the same thing, this doesn't work.
2692
+       if (rtx_equal_p(dst, iftrue)) {
2693
+               // If the true value is the same as the destination already,
2694
+               // then swap so we only do the condition on true
2695
+               rtx tem = iffalse;
2696
+               iffalse = iftrue;
2697
+               iftrue  = tem;
2698
+               cmpcode = reverse_condition(cmpcode);
2699
+       }
2700
+
2701 127 dgisselq
+       //; Do we need to swap or adjust the condition?
2702
+       if (zip_supported_condition((int)cmpcode)) {
2703
+               // Keep everything as is
2704 142 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- Condition is supported\n");
2705 127 dgisselq
+       } else if ((zip_supported_condition(reverse_condition(cmpcode)))
2706 142 dgisselq
+                       &&(!MEM_P(iffalse))
2707
+                       &&(!rtx_equal_p(dst,iffalse))) {
2708 127 dgisselq
+               rtx tem = iffalse;
2709
+               iffalse = iftrue;
2710
+               iftrue = tem;
2711
+
2712
+               cmpcode = reverse_condition(cmpcode);
2713
+       } else if ((zip_supported_condition((int)swap_condition(cmpcode)))
2714
+               &&((REG_P(cmpb))||(can_create_pseudo_p()))) {
2715
+               rtx tem = cmpa;
2716
+               cmpa = cmpb;
2717
+               cmpa = tem;
2718
+               cmpcode = swap_condition(cmpcode);
2719
+
2720
+               if ((GET_CODE(cmpa)==PLUS)&&(zip_signed_comparison((int)cmpcode))
2721
+                       &&(REG_P(XEXP(cmpa,0)))
2722
+                       &&(CONST_INT_P(XEXP(cmpa,1)))
2723
+                       &&(abs(INTVAL(XEXP(cmpa,1)))<(1<<17))) {
2724
+
2725
+                       // If we were doing CMP x(Rb),Ra
2726
+                       // and we just changed it to CMP Ra,x(Rb)
2727
+                       // adjust it to CMP -x(Ra),Rb
2728
+                       cmpb = plus_constant(SImode, cmpb, -INTVAL(XEXP(cmpa,1)));
2729
+                       cmpa = XEXP(cmpa,0);
2730
+               } else if (!REG_P(cmpa)) {
2731
+                       // Otherwise, if we had anything else in Rb other than
2732
+                       // a register ... such as a constant, then load it into
2733
+                       // a register before comparing it.  So
2734
+                       //      CMP x,Ra
2735
+                       // became
2736
+                       //      CMP Ra,x
2737
+                       // now becomes
2738
+                       //      LDI x,Rt
2739
+                       //      CMP Ra,Rt
2740
+                       // (We already tested for can_create_pseudo_p() above..)
2741
+                       tem = gen_reg_rtx(SImode);
2742
+                       emit_move_insn(tem, cmpa);
2743
+                       cmpa = tem;
2744 102 dgisselq
+               }
2745 127 dgisselq
+       } else {
2746
+               // Here's our last chance.
2747
+               // This will adjust for less than equal types of stuff
2748
+               int     cod = (int)cmpcode;
2749
+               zip_canonicalize_comparison(&cod, &cmpa, &cmpb, false);
2750
+               cmpcode = (enum rtx_code)cod;
2751 102 dgisselq
+       }
2752
+
2753 142 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC -- Post-Modes\n");
2754
+       if (dbg) zip_debug_rtx_pfx("DST-P: ", dst);
2755
+       if (dbg) zip_debug_rtx_pfx("CND-P: ", condition);
2756
+       if (dbg) zip_debug_rtx_pfx("TRU-P: ", iftrue);
2757
+       if (dbg) zip_debug_rtx_pfx("FAL-P: ", iffalse);
2758
+
2759
+       if (!zip_supported_condition((int)cmpcode)) {
2760
+               if (dbg) {
2761
+               fprintf(stderr, "ZIP::MOVSICC -- Unsupported condition: ");
2762
+                       zip_debug_ccode(cmpcode);
2763
+                       fprintf(stderr, "\n");
2764
+               }
2765
+               return false;
2766
+       }
2767 127 dgisselq
+       gcc_assert(zip_supported_condition((int)cmpcode));
2768
+
2769
+       //; Always do the default move
2770 142 dgisselq
+       bool    conditionally_do_false = false;
2771
+       conditionally_do_false = (MEM_P(iffalse))
2772
+               &&(!rtx_equal_p(dst,iffalse))
2773
+               &&(zip_supported_condition(reverse_condition(cmpcode)));
2774
+       conditionally_do_false = conditionally_do_false || (rtx_equal_p(dst,iftrue));
2775
+       if ((conditionally_do_false)&&(!zip_supported_condition(reverse_condition(cmpcode)))) {
2776
+               if (dbg) {
2777
+                       fprintf(stderr, "ZIP::MOVSICC -- Cant support the reverse condition: ");
2778
+                       zip_debug_ccode(cmpcode);
2779
+                       fprintf(stderr, "\n");
2780
+               }
2781
+               return false;
2782
+       }
2783 127 dgisselq
+
2784 142 dgisselq
+       if ((!rtx_equal_p(dst, iffalse))&&(!conditionally_do_false)) {
2785
+               if (dbg)
2786
+               fprintf(stderr, "ZIP::MOVSICC -- EMITTING MOVE FALSE->DST\n");
2787
+               insn = emit_move_insn(dst, iffalse);
2788
+               if (dbg) zip_debug_rtx_pfx("BARE-U: ", insn);
2789
+       }
2790
+
2791 127 dgisselq
+       rtx     cc_rtx = gen_rtx_REG(CCmode, zip_CC);
2792
+
2793
+       //; Now let's get our comparison right
2794 142 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC -- EMITTING COMPARISON\n");
2795
+       insn = emit_insn(gen_rtx_SET(VOIDmode, cc_rtx,
2796 127 dgisselq
+               gen_rtx_COMPARE(CCmode, cmpa, cmpb)));
2797 142 dgisselq
+       if (dbg) zip_debug_rtx_pfx("BARE-C: ", insn);
2798 127 dgisselq
+
2799
+       //; Finally, let's load the value on true
2800 142 dgisselq
+       if (!rtx_equal_p(dst, iftrue)) {
2801
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- EMITTING BARE\n");
2802
+               insn=emit_insn(gen_movsicc_bare(dst,
2803 127 dgisselq
+                       gen_rtx_fmt_ee(cmpcode, SImode, NULL_RTX, NULL_RTX),
2804
+                       iftrue, dst));
2805 142 dgisselq
+               if (dbg) zip_debug_rtx_pfx("BARE-T: ", insn);
2806
+       }
2807
+
2808
+       if (conditionally_do_false) {
2809
+               gcc_assert(zip_supported_condition(reverse_condition(cmpcode)));
2810
+               insn=emit_insn(gen_movsicc_bare(dst,
2811
+                       gen_rtx_fmt_ee(reverse_condition(cmpcode), SImode,
2812
+                       NULL_RTX, NULL_RTX), iffalse, dst));
2813
+               if (dbg) zip_debug_rtx_pfx("BARE-F: ", insn);
2814
+       }
2815
+
2816
+       // Return true on success
2817
+       return true;
2818 102 dgisselq
+}
2819
+
2820
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
2821
+       // We know upon entry that REG_P(dst) must be true
2822
+       if (!REG_P(dst))
2823
+               internal_error("%s","ADDSICC into something other than register");
2824
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
2825
+               switch (GET_CODE(condition)) {
2826
+               case EQ: return "ADD.Z\t%3,%0";
2827
+               case NE: return "ADD.NZ\t%3,%0";
2828
+               case LT: return "ADD.LT\t%3,%0";
2829
+               case GT: return "ADD.GT\t%3,%0";
2830
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
2831
+               case GE: return "ADD.GE\t%3,%0";
2832
+               case LTU: return "ADD.C\t%3,%0";
2833
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
2834
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
2835
+               // Can do a GEU comparison, and then undo on the Zero condition
2836
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
2837
+               default:
2838
+                       internal_error("%s", "Zip/No usable addsi expansion");
2839
+                       break;
2840
+               }
2841
+       } else {
2842
+               // MOV A+REG,REG
2843
+               switch (GET_CODE(condition)) {
2844
+               case EQ: return "MOV.Z\t%3+%2,%0";
2845
+               case NE: return "MOV.NZ\t%3+%2,%0";
2846
+               case LT: return "MOV.LT\t%3+%2,%0";
2847
+               case GT: return "MOV.GT\t%3+%2,%0";
2848
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2849
+               case GE: return "MOV.GE\t%3+%2,%0";
2850
+               case LTU: return "MOV.C\t%3+%2,%0";
2851
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2852
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
2853
+               // Can do a GEU comparison, and then undo on the Zero condition
2854
+               // EXCEPT: with a move instruction, what's there to undo?  We
2855
+               // just clobbered our register!
2856
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
2857
+               default:
2858
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
2859
+                       break;
2860
+               }
2861
+       }
2862
+
2863
+       return "BREAK";
2864
+}
2865
+
2866 103 dgisselq
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
2867 102 dgisselq
+       int     rv = 14;
2868
+       if ((mode == DImode)||(mode == DFmode))
2869
+               rv += 2;
2870
+       return rv;
2871
+}
2872
+
2873 103 dgisselq
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
2874 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void) {
2875
+       // Let's try their suggested approach, keeping us from modifying jumps
2876
+       // after reload.  This should also allow our peephole2 optimizations
2877
+       // to adjust things back to what they need to be if necessary.
2878
+       return (reload_completed || reload_in_progress);
2879
+}
2880 122 dgisselq
+
2881
+rtx_insn       *zip_ifcvt_info;
2882
+
2883
+void
2884
+zip_ifcvt_modify_tests(ce_if_block *ce_info ATTRIBUTE_UNUSED, rtx *true_expr, rtx *false_expr) {
2885
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2886
+       if (dbg) fprintf(stderr, "IFCVT-MODIFY-TESTS\n");
2887
+       if (*true_expr) switch(GET_CODE(*true_expr)) {
2888
+               case LE:
2889
+               case GTU:
2890
+               case GEU:
2891
+               case LEU:
2892
+                       if (dbg) fprintf(stderr, "TRUE, missing expr\n");
2893
+                       if (dbg) zip_debug_rtx(*true_expr);
2894
+                       *true_expr = NULL_RTX;
2895
+                       break;
2896
+               default: // LT, GT, GTE, LTU, NE, EQ
2897
+                       break;
2898
+       }
2899
+
2900
+       if (*false_expr) switch(GET_CODE(*false_expr)) {
2901
+               case LE:
2902
+               case GTU:
2903
+               case GEU:
2904
+               case LEU:
2905
+                       if (dbg) fprintf(stderr, "FALSE, missing expr\n");
2906
+                       if (dbg) zip_debug_rtx(*false_expr);
2907
+                       *false_expr = NULL_RTX;
2908
+               default:
2909
+                       break;
2910
+       }
2911
+       if ((dbg)&&((!*true_expr)||(!*false_expr)))
2912
+               fprintf(stderr, "IFCVT-MODIFY-TESTS -- FAIL\n");
2913
+}
2914
+
2915
+void
2916 142 dgisselq
+zip_ifcvt_machdep_init(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2917 122 dgisselq
+/*
2918 142 dgisselq
+if (!ceinfo->then_bb)
2919
+       return;
2920
+rtx_insn *insn;
2921
+FOR_BB_INSNS(ceinfo->then_bb, insn) {
2922
+       fprintf(stderr, "IFCVT -- INIT\n");
2923
+       zip_debug_rtx_pfx("INIT-BB", insn);
2924 122 dgisselq
+}
2925
+*/
2926
+/*
2927
+       zip_ifcvt_info = NULL;
2928
+       rtx_insn *insn, *ifinsn = NULL;
2929
+       FOR_BB_INSNS(ceinfo->test_bb, insn) {
2930
+               rtx     p;
2931
+               p = single_set(insn);
2932
+               if (!p) continue;
2933
+               if (SET_DEST(p)==pc_rtx) {
2934
+                       ifinsn = insn;
2935
+               }
2936
+               if (!REG_P(SET_DEST(p)))
2937
+                       continue;
2938
+               if (GET_MODE(SET_DEST(p))!=CCmode)
2939
+                       continue;
2940
+               if (REGNO(SET_DEST(p))!=zip_CC)
2941
+                       continue;
2942
+               zip_ifcvt_info = insn;
2943
+       }
2944
+
2945
+       if (zip_ifcvt_info)
2946
+               zip_debug_rtx_pfx("PUTATIVE-CMP",zip_ifcvt_info);
2947
+       if (ifinsn)
2948
+               zip_debug_rtx_pfx("PRIOR-JMP",ifinsn);
2949
+*/
2950
+}
2951
+
2952 142 dgisselq
+void
2953
+zip_ifcvt_modify_insn(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED,
2954
+               rtx pattern ATTRIBUTE_UNUSED,
2955
+               rtx_insn *insn ATTRIBUTE_UNUSED) {
2956
+       // zip_debug_rtx_pfx("MODIFY-INSN: ", insn);
2957
+}
2958
+
2959
+void
2960
+zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2961
+/*
2962
+       fprintf(stderr, "IFCVT -- CANCEL\n");
2963
+       zip_ifcvt_info = NULL;
2964
+*/
2965
+}
2966
+
2967
+void
2968
+zip_ifcvt_modify_final(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2969
+/*
2970
+rtx_insn *insn;
2971
+FOR_BB_INSNS(ceinfo->test_bb, insn) {
2972
+       fprintf(stderr, "IFCVT -- FINAL\n");
2973
+       zip_debug_rtx_pfx("FINAL-TEST-BB", insn);
2974
+}
2975
+       zip_ifcvt_info = NULL;
2976
+*/
2977
+}
2978
+
2979
+
2980 127 dgisselq
+int    zip_insn_sets_cc(rtx_insn *insn) {
2981
+       return (get_attr_ccresult(insn)==CCRESULT_SET);
2982
+}
2983
+
2984
+int    zip_is_conditional(rtx_insn *insn) {
2985
+       return (get_attr_conditional(insn)==CONDITIONAL_YES);
2986
+}
2987 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
2988
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
2989 142 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-05-08 21:38:59.271655207 -0400
2990 138 dgisselq
@@ -0,0 +1,4060 @@
2991 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
2992
+//
2993
+// Filename:   gcc/config/zip/zip.h
2994
+//
2995
+// Project:    Zip CPU backend for the GNU Compiler Collection
2996
+//
2997
+// Purpose:
2998
+//
2999
+// Creator:    Dan Gisselquist, Ph.D.
3000
+//             Gisselquist Technology, LLC
3001
+//
3002
+////////////////////////////////////////////////////////////////////////////////
3003
+//
3004
+// Copyright (C) 2016, Gisselquist Technology, LLC
3005
+//
3006
+// This program is free software (firmware): you can redistribute it and/or
3007
+// modify it under the terms of  the GNU General Public License as published
3008
+// by the Free Software Foundation, either version 3 of the License, or (at
3009
+// your option) any later version.
3010
+//
3011
+// This program is distributed in the hope that it will be useful, but WITHOUT
3012
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
3013
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3014
+// for more details.
3015
+//
3016
+// You should have received a copy of the GNU General Public License along
3017
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
3018
+// target there if the PDF file isn't present.)  If not, see
3019
+// <http://www.gnu.org/licenses/> for a copy.
3020
+//
3021
+// License:    GPL, v3, as defined and found on www.gnu.org,
3022
+//             http://www.gnu.org/licenses/gpl.html
3023
+//
3024
+//
3025
+////////////////////////////////////////////////////////////////////////////////
3026
+#ifndef        GCC_ZIP_H
3027
+#define        GCC_ZIP_H
3028
+
3029
+
3030
+//
3031
+//
3032 127 dgisselq
+// Zip CPU configuration defines
3033 102 dgisselq
+//
3034
+//
3035
+#define        ZIP_USER        0        // Assume we are in supervisor mode
3036
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
3037
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
3038
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
3039
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
3040
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
3041
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
3042
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
3043
+#define        ZIP_HAS_DI      1
3044 127 dgisselq
+// Should we use the peephole optimizations?
3045
+#define        ZIP_PEEPHOLE    1       // 0 means no peephole optimizations.
3046 138 dgisselq
+// How about the new long multiply instruction set?
3047
+#define        ZIP_LONGMPY     1       // 0 means use the old instruction set
3048 102 dgisselq
+
3049
+// Zip has 16 registers in each user mode.
3050
+//     Register 15 is the program counter (PC)
3051
+//     Register 14 is the condition codes (CC)
3052
+//     Register 13 is the stack pointer   (SP)
3053
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
3054
+//     Register  0 (may be) the return address pointer
3055
+// Registers 16-31 may only be used in supervisor mode.
3056
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
3057
+#define        is_ZIP_REG(REGNO)               ((REGNO)<16)
3058
+
3059 103 dgisselq
+// #define     zip_FP_PSEUDO   16
3060
+#define        zip_PC          15
3061
+#define        zip_CC          14
3062
+#define        zip_SP          13
3063
+#define        zip_FP          12
3064
+#define        zip_GOT         11
3065
+#define        zip_AP          10
3066
+#define        zip_R1          1
3067
+#define        zip_R0          0
3068 102 dgisselq
+
3069
+#define        ZIP_FIRST_ARG_REGNO     1
3070
+#define        ZIP_LAST_ARG_REGNO      5
3071 111 dgisselq
+#define        NUM_ARG_REGS            (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
3072
+#define        MAX_PARM_REGS           (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
3073 102 dgisselq
+
3074
+/* The overall framework of an assembler file */
3075
+
3076
+#define        ASM_COMMENT_START       ";"
3077
+#define        ASM_APP_ON              ""
3078
+#define        ASM_APP_OFF             ""
3079
+
3080
+#define        FILE_ASM_OP             "\t.file\n"
3081
+
3082
+/* Output and Generation of Labels */
3083
+#define        GLOBAL_ASM_OP           "\t.global\t"
3084
+
3085
+#undef BITS_PER_UNIT
3086
+#define        BITS_PER_UNIT   (32)
3087
+
3088
+/* Assembler Commands for Alignment */
3089
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
3090 127 dgisselq
+       { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
3091 102 dgisselq
+
3092
+
3093
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
3094
+ * for an instruction operand X. */
3095
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
3096
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
3097
+
3098
+/* Passing arguments in registers */
3099
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
3100
+
3101
+/* Define how to find the value returned by a function.  VALTYPE is the data
3102
+ * type of the value (as a tree).  If the precise function being called is known
3103
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
3104
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
3105
+
3106
+/* Define how to find the value returned by a library function assuming the
3107
+ * value has mode MODE.
3108
+ */
3109
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
3110
+
3111
+
3112
+/* STACK AND CALLING */
3113
+
3114
+
3115
+/* Define this macro as a C expression that is nonzero for registers that are
3116
+ * used by the epilogue or the return pattern.  The stack and frame pointer
3117
+ * registers are already assumed to be used as needed.
3118
+ */
3119
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
3120
+
3121
+
3122
+/* The best alignment to use in cases where we have a choice. */
3123 127 dgisselq
+#define        FASTEST_ALIGNMENT       BITS_PER_WORD
3124 102 dgisselq
+
3125
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
3126
+ * largest integer machine mode that should actually be used.  All integer
3127
+ * machine modes of this size and smaller can be used for structures and unions
3128
+ * with the appropriate sizes.  If this macro is undefined,
3129
+ * GET_MODE_BITSIZE(DImode) is assumed.
3130
+ *
3131
+ * ZipCPU -- The default looks good enough for us.
3132
+ */
3133
+
3134
+/* Generate Code for Profiling
3135
+ */
3136
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
3137
+
3138
+
3139
+/* A C expression which is nonzero if register number NUM is suitable for use
3140
+ * as an index register in operand addresses.
3141
+ */
3142
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3143
+
3144
+
3145
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3146
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3147
+ * operand of mode MODE.
3148
+ */
3149 111 dgisselq
+/* 17.03 Controlling the Compilation Driver, 'gcc' */
3150
+// DRIVER_SELF_SPECS
3151
+// OPTION_DEFAULT_SPECS
3152
+// CPP_SPEC
3153
+// CPLUSPLUS_CPP_SPEC
3154
+// CC1_SPEC
3155
+// CC1PLUS_SPEC
3156
+/* ASM_SPEC ... A C string constant that tells the GCC driver program options
3157
+ * to pass to the assembler.  It can also specify how to translate options you
3158
+ * give to GCC into options for GCC to pass to the assembler.  See the file
3159
+ * 'sun3.h' for an example of this.
3160
+ *
3161
+ * Do not define thismacro if it does not need to do anything.
3162
+ */
3163
+// #undef      ASM_SPEC
3164
+// ASM_FINAL_SPEC
3165
+// ASM_NEEDS_DASH_FOR_PIPED_INPUT
3166
+
3167
+/* LINK_SPEC ... A C string constant that tells the GCC driver program options
3168
+ * to pass to the linker.  It can also specify how to translate options you give
3169
+ * to GCC into options for GCC to pass to the linker.
3170
+ *
3171
+ * Do not define this macro if it does not need to do anything.
3172
+ */
3173
+
3174
+/* LIB_SPEC ... Another C string constant very much like LINK_SPEC.  The
3175
+ * difference between the two is that LIB_SPEC is used at the end of the
3176
+ * command given to the linker.
3177
+ *
3178
+ * If this macro is not defined, a default is provided that loads the standard
3179
+ * C library from the usual place.  See 'gcc.c'.
3180
+ */
3181
+#undef LIB_SPEC
3182
+// #define     LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
3183
+#define        LIB_SPEC        ""
3184
+
3185
+/* LIBGCC_SPEC ... Another C string constant that tells the GCC driver program
3186
+ * hoow and when to place a reference to 'libgcc.a' into the linker command
3187
+ * line.  This constant is placed both before and after the value of LIB_SPEC.
3188
+ *
3189
+ * If this macro is not defined, the GCC driver provides a default that passes
3190
+ * the string '-lgcc' to the linker.
3191
+ */
3192
+#undef LIBGCC_SPEC
3193
+#define        LIBGCC_SPEC     ""
3194
+
3195
+/* REAL_LIBGCC_SPEC ... By default, if ENABLE_SHARED_LIBGCC is defined, the
3196
+ * LIBGCC_SPEC is not directly used by the driver program but is instead
3197
+ * modified to refer to different versions of 'libgcc.a' depending on the
3198
+ * values of the command line flags '-static', '-shared', '-static-libgcc',
3199
+ * and '-shared-libgcc'.  On targets where these modifications are
3200
+ * inappropriate, define REAL_LIBGCC_SPEC instead.  REAL_LIBGCC_SPEC tells the
3201
+ * driver how to place a reference to 'libgcc' on the link command line, but
3202
+ * unlike LIBGCC_SPEC, it is used unmodified.
3203
+ */
3204
+#define        REAL_LIBGCC_SPEC        ""
3205
+
3206
+// USE_LD_AS_NEEDED
3207
+// LINK_EH_SPEC
3208
+
3209
+/* STARTFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3210
+ * difference between the two is that STARTFILE_SPEC is used at the very
3211
+ * beginning of the command given to the linker.
3212
+ *
3213
+ * If this macro is not defined, a default is provided that loads the standard
3214
+ * C startup file from the usual place.  See 'gcc.c'
3215
+ */
3216
+#undef STARTFILE_SPEC
3217
+#define        STARTFILE_SPEC  ""
3218
+
3219
+/* ENDFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3220
+ * difference between the two is that ENDFILE_SPEC is used at the very end
3221
+ * of the command given to the linker.
3222
+ *
3223
+ * Do not define this macro if it does not do anything.
3224
+ */
3225
+// #undef      ENDFILE_SPEC
3226
+// #define     ENDFILE_SPEC    ""
3227
+
3228
+// THREAD_MODEL_SPEC
3229
+// SYSROOT_SUFFIX_SPEC
3230
+// SYSROOT_HEADERS_SUFFIX_SPEC
3231
+// EXTRA_SPECS
3232
+// LINK_LIBGCC_SPECIAL_1
3233
+// LINK_GCC_C_SEQUENCE_SPEC
3234
+// LINK_COMMAND_SPEC
3235
+// TARGET_ALWAYS_STRIP_DOTDOT
3236
+// MULTILIB_DEFAULTS
3237
+// RELATIVE_PREFIX_NOT_LINKDIR
3238
+// MD_EXEC_PREFIX
3239
+// STANDARD_STARTFILE_PREFIX
3240
+// STANDARD_STARTFILE_PREFIX_1
3241
+// STANDARD_STARTFILE_PREFIX_2
3242
+// MD_STARTFILE_PREFIX
3243
+// MD_STARTFILE_PREFIX_1
3244
+// INIT_ENVIRONMENT
3245
+// LOCAL_INCLUDE_DIR
3246
+#undef LOCAL_INCLUDE_DIR
3247
+
3248
+// NATIVE_SYSTEM_HEADER_COMPONENT
3249
+// INCLUDE_DEFAULTS
3250
+
3251 102 dgisselq
+/* 17.03 Run-time Target Specification */
3252
+
3253
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3254
+ * code that defines built-in preprocessor macros and assertions for the target
3255
+ * CPU, using the functions builtin_define, builtin_define_std, and
3256
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3257
+ * semicolon, and since it has finished command line option proccessing your
3258
+ * code can use those results freely.
3259
+ *
3260
+ * ZipCPU --- We should probably capture in this macro what capabilities the
3261
+ * command line parameters we've been given indicate that our CPU has.  That
3262
+ * way, code can be adjusted depending upon the CPU's capabilities.
3263
+ */
3264
+#define        TARGET_CPU_CPP_BUILTINS()                       \
3265
+       { builtin_define("__ZIPCPU__");                 \
3266
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
3267
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
3268
+       }
3269
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
3270
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
3271
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
3272
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
3273
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
3274
+       // If (we support int64s) builtin_define("___int64_t_defined");
3275
+
3276
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
3277
+ * macro is optional and is used for the target operating system instead.
3278
+ */
3279
+
3280
+/* Option macros: (we need to define these eventually ... )
3281
+ *
3282
+ *     TARGET_HANDLE_OPTION
3283
+ *     TARGET_HANDLE_C_OPTION
3284
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
3285
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
3286
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
3287
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
3288
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
3289
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
3290
+ *     C_COMMON_OVERRIDE_OTPTIONS
3291
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
3292
+ *     TARGET_OPTION_INIT_STRUCT
3293
+ *     TARGET_OPTION_DEFAULT_PARAMS
3294
+ */
3295
+
3296
+/* SWITCHABLE_TARGET
3297
+ *
3298
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
3299
+ * here.
3300
+ */
3301
+
3302
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
3303
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
3304
+ * otherwise.  This is intended to relate to the float and double types, but not
3305
+ * necessarily "long double".  By default, returns true if the adddf3
3306
+ * instruction pattern is available and false otherwise, on the assumption that
3307
+ * hardware floating point supports exceptions and rounding modes but software
3308
+ * floating point does not.
3309
+ *
3310
+ * ZipCPU floating point is barely going to be functional, I doubt it will
3311
+ * support all of these bells and whistles when full functionality is even
3312
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
3313
+ * set this to zero, so let's come back to this.
3314
+ */
3315
+// #warning "Wrong answer encoded to date"
3316 103 dgisselq
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
3317 102 dgisselq
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
3318
+
3319
+/* 17.04 Defining data structures for per-function information */
3320
+
3321
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
3322
+ * information.  This macro is called once per function, before generation of
3323
+ * any RTL has begun.  The intention is to allow the initialization of the
3324
+ * function pointer init_machine_status.
3325
+ */
3326
+// #warning "I may need to define this to handle function return addresses ..."
3327
+
3328
+/* 17.05 Storage Layout */
3329
+
3330
+/* Storage Layout */
3331
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
3332
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
3333
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
3334
+#define        FLOAT_WORDS_BIG_ENDIAN  1
3335
+#define        BITS_PER_WORD           32
3336
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
3337
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
3338
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
3339
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
3340
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
3341
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
3342
+ * default is BITS_PER_WORD.
3343
+ *
3344
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
3345
+ */
3346
+#define        POINTER_SIZE            32      // Ptr width in bits
3347
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
3348
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
3349
+ * than zero if pointers should be zero-extended, zero if they should be sign
3350
+ * extended, and negative if some other conversion is needed.  In the last case,
3351
+ * the extension is done by the target's ptr_extend instruction.
3352
+ *
3353
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
3354
+ * the same width.
3355
+ *
3356
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
3357
+ * number of bits as SImode.  Therefore, one might wish to convert between the
3358
+ * two.  Hence, we specify how we would do that here.
3359
+ */
3360 127 dgisselq
+#define        POINTERS_EXTEND_UNSIGNED        1
3361 102 dgisselq
+
3362
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
3363
+ * object whose type is type and which has he specified mode and signedness is
3364
+ * to be stored in a register.  This macro is only called when type is a scalar
3365
+ * type.
3366
+ *
3367
+ * On most RISC machines, which only have operations that operate on a full
3368
+ * register, define this macro to set m to word_mode if m is an integer mode
3369
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
3370
+ * widened because wider precision floating-point operations are usually more
3371
+ * expensive than their narrower counterparts.
3372
+ *
3373
+ * For most machines, the macro definition does not change unsigndep.  However,
3374
+ * some machines, have instructions that preferentially handle either signed or
3375
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
3376
+ * loads from memory and 32-bit add instructions sign-extend the result to
3377
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
3378
+ * is more efficient.
3379
+ *
3380
+ * Do not define this macro if it would never modify m.
3381
+ *
3382
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
3383
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
3384
+ */
3385
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
3386
+
3387
+// TARGET_PROMOTE_FUNCTION_MODE
3388
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
3389
+ * stack, in bits.  All stack parameters receive at least this much alignment
3390
+ * regardless of data type.  On most machines, this is the same as the size of
3391
+ * an integer.
3392
+ */
3393
+#define        PARM_BOUNDARY   32
3394
+
3395
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
3396
+ * hardware for the stack pointer on this machine.  The definition is a C
3397
+ * expression for the desired alignment (measured in bits).  This value is used
3398
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
3399
+ * this should be the same as PARM_BOUNDARY.
3400
+ */
3401
+#define        STACK_BOUNDARY  PARM_BOUNDARY
3402
+
3403
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
3404 127 dgisselq
+#define        PREFERRED_STACK_BOUNDARY        STACK_BOUNDARY
3405 102 dgisselq
+
3406 127 dgisselq
+/* INCOMING_STACK_BOUNDARY ... Define this macro if the incoming stack boundary
3407
+ * may be different from PREFERRED_STACK_BOUNDARY.  This macro must evaluate
3408
+ * to a value equal to or larger than STACK_BOUNDARY.
3409 102 dgisselq
+ */
3410 127 dgisselq
+#define        INCOMING_STACK_BOUNDARY STACK_BOUNDARY
3411 102 dgisselq
+
3412
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
3413
+ */
3414
+#define        FUNCTION_BOUNDARY       32
3415
+
3416
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
3417
+ * this machine, in bits.  Note that this is not the biggest alignment that is
3418
+ * supported, just the biggest alignment that, when violated, may cause a fault.
3419
+ */
3420
+#define BIGGEST_ALIGNMENT      32
3421
+
3422 127 dgisselq
+/* MALLOC_ABI_ALIGNMENT
3423
+ */
3424
+
3425
+/* ATTRIBUTE_ALIGNED_VALUE
3426
+ */
3427
+
3428 102 dgisselq
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
3429
+ * given to an object that can be referenced in one operation, without
3430
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
3431
+ * larger on machines that don't have byte or halfword store operations.
3432
+ */
3433
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
3434
+
3435 127 dgisselq
+/* BIGGEST_FIELD_ALIGNMENT ... Biggest alignment that any structure or union
3436
+ * field can require on this machine, in bits.  If defined, this overrides
3437
+ * BIGGEST_ALIGNMENT for structure and union fields only, unless the field
3438
+ * alignment has been set by the __attribute__((aligned(n))) construct.
3439
+ */
3440
+#define        BIGGEST_FIELD_ALIGNMENT BITS_PER_UNIT
3441
+
3442
+/* ADJUST_FIELD_ALIGN
3443
+ */
3444
+#define        ADJUST_FIELD_ALIGN(A,B) BITS_PER_WORD
3445
+
3446
+/* MAX_STACK_ALIGNMENT
3447
+ */
3448
+#define        MAX_STACK_ALIGNMENT     BITS_PER_WORD
3449
+
3450
+/* MAX_OFILE_ALIGNMENT
3451
+ */
3452
+
3453
+/* DATA_ALIGNMENT(TYPE, BASIC-ALIGN) ... If defined, a C expression to compute
3454
+ * the alignment for a variable in the static store.  TYPE is the data type, and
3455
+ * BASIC-ALIGN is the alignment that the object would ordinarily have.  The
3456
+ * value of this macro is used instead of that alignment to align the object.
3457
+ *
3458
+ * If this macro is not defined, then BASIC-ALIGN is used.
3459
+ *
3460
+ * ZipCPU -- in hindsight, if this macro is not defined then the compiler is
3461
+ * broken.  So we define it to be our fastest alignment, or 32-bits.
3462
+ */
3463
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     BITS_PER_WORD
3464
+
3465
+
3466
+/* DATA_ABI_ALIGNMENT(TYPE,BASIC-ALIGN)
3467
+ */
3468
+
3469
+/* CONSTANT_ALIGNMENT(CONST, BASIC-ALIGN) ... If defined, a C expression to
3470
+ * compute the alignment given to a constant that is being placed in memory.
3471
+ * CONST is the constant and BASIC-ALIGN is the alignment that the object
3472
+ * would ordinarily have.  The value of this macro is used instead of that
3473
+ * alignment to align the object.
3474
+ *
3475
+ * If this macro is not defined, then BASIC-ALIGN is used.
3476
+ *
3477
+ * ZipCPU -- in hindsiht, if this macro is not defined then the compiler is
3478
+ * broken.  We'll define it as above.
3479
+ *
3480
+ */
3481
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  BITS_PER_WORD
3482
+
3483
+/* LOCAL_ALIGNMENT(TYPE,BASIC-ALIGN) ... If defined ...
3484
+ */
3485
+#define        LOCAL_ALIGNMENT(TYP,ALIGN)      BITS_PER_WORD
3486
+
3487
+/* TARGET_VECTOR_ALIGNMENT
3488
+ */
3489
+
3490
+/* STACK_SLOT_ALIGNMENT
3491
+ */
3492
+#define        STACK_SLOT_ALIGNMENT(T,M,B)     BITS_PER_WORD
3493
+
3494
+/* LOCAL_DECL_ALIGNMEN(DECL)
3495
+ */
3496
+#define        LOCAL_DECL_ALIGNMENT(DECL)      BITS_PER_WORD
3497
+
3498
+/* MINIMUM_ALIGNMENT
3499
+ */
3500
+#define        MINIMUM_ALIGNMENT(EXP,MOD,ALIGN)        BITS_PER_WORD
3501
+
3502
+/* EMPTY_FIELD_BOUNDARY
3503
+ * Alignment of field after 'int : 0' in a structure.
3504
+ */
3505
+#define        EMPTY_FIELD_BOUNDARY    BITS_PER_WORD
3506
+
3507
+/* STRUCTURE_SIE_BOUNDARY
3508
+ * ZipCPU -- Every structures size must be a multiple of 32-bits.
3509
+ */
3510
+#define        STRUCTURE_SIZE_BOUNDARY BITS_PER_WORD
3511
+
3512 102 dgisselq
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
3513
+ * fail to work when given unaligned data.  If instructions will merely go
3514
+ * slower in that case, define this macro as 0.
3515 125 dgisselq
+ *
3516
+ * ZipCPU -- Since we have defined our smallest addressable unit to be a 32-bit
3517
+ * word (one byte, on our machine), and since reading any amount of 32-bit words
3518
+ * is easy, then there really are no instructions that will ever fail.
3519 102 dgisselq
+ */
3520 125 dgisselq
+#define        STRICT_ALIGNMENT        0
3521 102 dgisselq
+
3522 127 dgisselq
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
3523
+ * other C compilers handle alignment of bit-fields and the structures that
3524
+ * contain them.
3525
+ *
3526
+ * The behavior is that the type written for a named bit-field (int, short, or
3527
+ * other integer type) imposes an alignment for the entire structure, as if the
3528
+ * structure really did contain an ordinary field of that type.  In addition,
3529
+ * the bit-field is placed within the structure so that it would fit within
3530
+ * such a field, not crossing a boundary for it.
3531
+ *
3532
+ * Thus, no most machines, a named bit-field whose type is written as int would
3533
+ * not cross a four-byte boundary, and would force four-byte alignment for the
3534
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
3535
+ * by other alignment parameters.)
3536
+ *
3537
+ * An unnamed bit-field will not affect the alignment of the containing
3538
+ * structure.
3539
+ *
3540
+ * If the macro is defined, its definition should be a C expression, a non
3541
+ * zero value for the expression enables this behavior.
3542
+ * Look at the fundamental type that is used for a bit-field and use that to
3543
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
3544
+ * have the same alignment as 'int', not 'char'.
3545
+ */
3546
+#undef PCC_BITFIELD_TYPE_MATTERS
3547
+#define        PCC_BITFIELD_TYPE_MATTERS       0
3548
+
3549 102 dgisselq
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
3550
+ * largest integer machine mode that should actually be used.  All integer
3551
+ * machine modes of this size or smaller can be used for structures and unions
3552
+ * with the appropriate sizes.  If this macro is undefined,
3553
+ * GET_MODE_BITSIZE(DImode) is assumed.
3554
+ *
3555
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
3556
+ * size on bits of the largest integer machine mode.  However, that's the case
3557
+ * with most DI implementations: A long is two words, spliced together.  We'd
3558
+ * like to support that eventually, but we need to get there.  Hence, let's use
3559
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
3560
+ */
3561
+#if (ZIP_HAS_DI != 0)
3562
+#define        MAX_FIXED_MODE_SIZE     64
3563
+#else
3564
+#define        MAX_FIXED_MODE_SIZE     32
3565
+#endif
3566
+
3567
+
3568
+/* 17.06 Layout of Source Language Data Types */
3569
+
3570
+#undef CHAR_TYPE_SIZE
3571
+#undef SHORT_TYPE_SIZE
3572
+#undef INT_TYPE_SIZE
3573
+#undef LONG_TYPE_SIZE
3574
+#undef LONG_LONG_TYPE_SIZE
3575
+//
3576
+#define        CHAR_TYPE_SIZE  32
3577
+#define        SHORT_TYPE_SIZE 32
3578
+#define        INT_TYPE_SIZE   32
3579
+#define        LONG_TYPE_SIZE  32
3580
+#define        LONG_LONG_TYPE_SIZE     64
3581
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
3582
+#undef FLOAT_TYPE_SIZE
3583
+#undef DOUBLE_TYPE_SIZE
3584
+#undef LONG_DOUBLE_TYPE_SIZE
3585
+#define        FLOAT_TYPE_SIZE         32
3586
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
3587
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
3588
+// SHORT_FRAC_TYPE_SIZE
3589
+// LONG_FFRACT_TYPE_SIZE
3590
+// LONG_LONG_FRACT_TIME_SIZE
3591
+#undef SHORT_ACCUM_TYPE_SIZE
3592
+#undef ACCUM_TYPE_SIZE
3593
+#undef LONG_ACCUM_TYPE_SIZE
3594
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
3595
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
3596
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
3597
+
3598
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
3599
+ * hook and should be defined if that hook is overriden to be true.  It causes
3600
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
3601
+ * rather than the default __.  A port which uses this macro should also arrange
3602
+ * to use t-gnu-prefix in the libgcc config.host.
3603
+ *
3604
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
3605
+ */
3606
+
3607
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
3608
+ * in float.h,, assuming, if applicable, that the floating-point control word
3609
+ * is in its default state.  If you do not define this macro the value of
3610
+ * FLT_EVAL_METHOD will be zero.
3611
+ *
3612
+ * ZipCPU --- ???
3613
+ */
3614
+
3615
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
3616
+ * floating-point format supported by the hardware.  If you define this macro,
3617
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
3618
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
3619
+ * default.
3620
+ *
3621
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
3622
+ * really needs to be determined, then, based upon a compile time parameter
3623
+ * where the one compiling the code states whether or not the H/W even has
3624
+ * floating point support.
3625
+ *
3626
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
3627
+ * need to change this.
3628
+ */
3629
+#undef WIDEST_HARDWARE_FP_SIZE
3630
+// #warning "Definition needs to change if no FPU present"
3631
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
3632
+
3633
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
3634
+ * whether the type char should be signed or unsigned by default.  The user
3635
+ * can always override this default with the options -fsigned-char and
3636
+ * -funsigned-char.
3637
+ *
3638
+ * ZipCPU--let's go with the default behavior.
3639
+ */
3640
+#define        DEFAULT_SIGNED_CHAR     1
3641
+
3642
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
3643 103 dgisselq
+ * the compiler should give an enum type only as many bytes as it takes to
3644 102 dgisselq
+ * represent the range of possible values of that type.  It should return
3645
+ * false if all enum types should be allocated like int.
3646
+ *
3647
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
3648
+ * override it.
3649
+ */
3650
+
3651
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
3652
+ * type to use for size values.  The typedef name size_t is defined using the
3653
+ * contents of the string.
3654
+ *
3655
+ * If you don't define this macro, the default is "long unsigned int".  Since
3656
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
3657
+ * the default seems perfect for us.
3658
+ */
3659
+#define        SIZE_TYPE       "unsigned int"
3660
+
3661
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
3662
+ * This macro is a C expression for a string describing the name of the data
3663
+ * type from which the precision of sizetype is extracted.  The string has the
3664
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
3665
+ * default is SIZE_TYPE --- which seems good enough for us.
3666
+ */
3667
+
3668
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
3669 127 dgisselq
+ * type to use for the result of subtracting two pointers.  The typedef name
3670 102 dgisselq
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
3671
+ * more information.
3672
+ *
3673
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
3674
+ * for us.
3675
+ */
3676
+#define        PTRDIFF_TYPE    "int"
3677
+
3678
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
3679
+ * type to use for wide characters.  The typedef name wchar_t is defined using
3680
+ * the contents of  the string.  If you don't define this macro, the default is
3681
+ * 'int'--good enough for ZipCPU.
3682
+ */
3683
+
3684
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
3685
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
3686
+ */
3687
+#undef WCHAR_TYPE_SIZE
3688
+#define        WCHAR_TYPE_SIZE 32
3689
+
3690
+/* WINT_TYPE ... A C expression for a string describing the name of the data
3691
+ * type to use for wide characters passed to printf and returned from getwc.
3692
+ * The typedef name wint_t is defined using the contents of the string.  See
3693
+ *
3694 103 dgisselq
+ * ZipCPU -- If you don't define this macro, the default is "unsigned int"--also
3695
+ * best for us again.
3696 102 dgisselq
+ */
3697
+
3698
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
3699
+ * data type that can represent any value of any standard or extended signed
3700
+ * integer type.  The typedef name intmax_t is defined using the contents of
3701
+ * the string.
3702
+ *
3703
+ * If you don't define this macro, the default is the first of "int", "long int"
3704
+ * or "long long int" that has as much precision as "long long int".
3705
+ */
3706
+
3707
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
3708
+ */
3709
+
3710
+#undef SIG_ATOMIC_TYPE
3711
+#if (ZIP_ATOMIC != 0)
3712
+#define        SIG_ATOMIC_TYPE "int"
3713
+#else
3714
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
3715
+#endif
3716
+#undef INT8_TYPE
3717
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
3718
+#undef INT16_TYPE
3719
+#define        INT16_TYPE              NULL
3720
+#undef INT32_TYPE
3721
+#define        INT32_TYPE              "int"
3722
+#undef UINT8_TYPE
3723
+#define        UINT8_TYPE              NULL
3724
+#undef UINT16_TYPE
3725
+#define        UINT16_TYPE             NULL
3726
+#undef UINT32_TYPE
3727
+#define        UINT32_TYPE             "unsigned int"
3728
+#undef INT_LEAST8_TYPE
3729
+#define        INT_LEAST8_TYPE         "int"
3730
+#undef INT_LEAST16_TYPE
3731
+#define        INT_LEAST16_TYPE        "int"
3732
+#undef INT_LEAST32_TYPE
3733
+#define        INT_LEAST32_TYPE        "int"
3734
+#undef UINT_LEAST8_TYPE
3735
+#define        UINT_LEAST8_TYPE        "unsigned int"
3736
+#undef UINT_LEAST16_TYPE
3737
+#define        UINT_LEAST16_TYPE       "unsigned int"
3738
+#undef UINT_LEAST32_TYPE
3739
+#define        UINT_LEAST32_TYPE       "unsigned int"
3740
+#undef INT_FAST8_TYPE
3741
+#define        INT_FAST8_TYPE          "int"
3742
+#undef INT_FAST16_TYPE
3743
+#define        INT_FAST16_TYPE         "int"
3744
+#undef INT_FAST32_TYPE
3745
+#define        INT_FAST32_TYPE         "int"
3746
+#undef UINT_FAST8_TYPE
3747
+#define        UINT_FAST8_TYPE         "unsigned int"
3748
+#undef UINT_FAST16_TYPE
3749
+#define        UINT_FAST16_TYPE        "unsigned int"
3750
+#undef UINT_FAST32_TYPE
3751
+#define        UINT_FAST32_TYPE        "unsigned int"
3752
+#undef INTPTR_TYPE
3753
+#define        INTPTR_TYPE             "unsigned int"
3754
+#undef UINTPTR_TYPE
3755
+#define        UINTPTR_TYPE            "unsigned int"
3756
+
3757
+#undef INT64_TYPE
3758
+#undef UINT64_TYPE
3759
+#undef INT_LEAST64_TYPE
3760
+#undef UINT_LEAST64_TYPE
3761
+#undef INT_FAST64_TYPE
3762
+#undef UINT_FAST64_TYPE
3763
+
3764
+#if (ZIP_HAS_DI != 0)
3765
+#define        INT64_TYPE              "long int"
3766
+#define        UINT64_TYPE             "long unsigned int"
3767
+#define        INT_LEAST64_TYPE        "long int"
3768
+#define        UINT_LEAST64_TYPE       "long unsigned int"
3769
+#define        INT_FAST64_TYPE         "long int"
3770
+#define        UINT_FAST64_TYPE        "long unsigned int"
3771
+#else
3772
+#define        INT64_TYPE              NULL
3773
+#define        UINT64_TYPE             NULL
3774
+#define        INT_LEAST64_TYPE        NULL
3775
+#define        UINT_LEAST64_TYPE       NULL
3776
+#define        INT_FAST64_TYPE         NULL
3777
+#define        UINT_FAST64_TYPE        NULL
3778
+#endif
3779
+
3780
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
3781
+
3782
+
3783
+/* 17.07 Register Usage / Register definitions */
3784
+
3785
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
3786
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
3787
+ * pseudo register's numbrer really is assigned the number
3788
+ * FIRST_PSEUDO_REGISTER.
3789
+ *
3790
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
3791
+ * and PC register being numbered 14 and 15 respectively.  Therefore, the
3792
+ * compiler can take register number 16 and above and do whatever it wants
3793
+ * with it.
3794
+ */
3795
+#ifdef DEFINE_USER_REGS
3796 103 dgisselq
+#  define      FIRST_PSEUDO_REGISTER   32
3797 102 dgisselq
+#else
3798 103 dgisselq
+#  ifdef       zip_FP_PSEUDO
3799
+#    define    FIRST_PSEUDO_REGISTER   (zip_FP_PSEUDO+1)
3800
+#  else
3801
+#    define    FIRST_PSEUDO_REGISTER   16
3802
+#  endif
3803 102 dgisselq
+#endif
3804
+
3805
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
3806
+ * fixed purposes all throughout the compiled code and are therefore not
3807
+ * available for general allocation.  These would include the stack pointer, the
3808
+ * frame pointer (except on machines where that can be used as a general
3809
+ * register when no frame pointer is needed), the program counter on machines
3810
+ * where that is considered one of the addressable registers, and any other
3811
+ * numbered register with a standard use.
3812
+ *
3813
+ * This information is expressed as a sequence of numbers, separated by commas,
3814
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
3815
+ * otherwise.
3816
+ *
3817
+ * For the Zip CPU, we have three fixed registers that are not available for
3818
+ * general allocation:
3819
+ *
3820
+ *     SP      The stack pointer
3821
+ *     CC      The condition codes and CPU state register
3822
+ *     PC      The program counter
3823
+ *
3824
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
3825
+ * table pointer) are registers that we hope will not be so fixed.
3826
+ */
3827 127 dgisselq
+#ifdef DEFINE_USER_REGS
3828
+#  define      FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,   1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }
3829 103 dgisselq
+#else
3830 127 dgisselq
+#  ifdef       zip_FP_PSEUDO
3831
+#    define    FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1 }
3832
+#  else
3833
+#    define    FIXED_REGISTERS         { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 }
3834
+#  endif
3835 103 dgisselq
+#endif
3836 102 dgisselq
+
3837
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
3838
+ * that is clobbered (in general) by function calls as well as for fixed
3839
+ * registers.  This macro therefore identifies the registers that are not
3840
+ * available for general allocation of values that must live across function
3841
+ * calls.
3842
+ *
3843
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
3844
+ * it on function entry and restores it on function exit, if the register is
3845
+ * used within the function.
3846
+ *
3847
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
3848
+ * register above R5.
3849
+ */
3850 127 dgisselq
+#ifdef DEFINE_USER_REGS
3851
+#  define      CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }
3852 103 dgisselq
+#else
3853 127 dgisselq
+#  ifdef       zip_FP_PSEUDO
3854
+#    define    CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1 }
3855
+#  else
3856
+#    define    CALL_USED_REGISTERS     { 0,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1 }
3857
+#  endif
3858 103 dgisselq
+#endif
3859 102 dgisselq
+
3860
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
3861
+ * to the value of CALL_USED_REGISTERS.
3862
+ */
3863
+
3864
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
3865
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
3866
+ * across a call without some part of it being clobbbered.  For most machines,
3867
+ * this macro need not be defined.  It is only required for machines that do
3868 103 dgisselq
+ * not preserve the entire contents of a register across a call.
3869 102 dgisselq
+ *
3870 127 dgisselq
+ * ZipCPU--Always preserves the entire contents of those registers that are
3871
+ * preserved across calls, so this shouldnt need to be defined.
3872 102 dgisselq
+ */
3873 127 dgisselq
+// #define     HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
3874 102 dgisselq
+
3875
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
3876
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
3877
+ * reg_class_contents, to take into account any dependence of these register
3878
+ * sets on target flags.  The first three of these are of type char[]
3879
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
3880
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
3881
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
3882
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
3883
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
3884
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
3885
+ * applied.
3886
+ *
3887
+ * ZipCPU -- I may need to return and define this depending upon how FP and
3888
+ * GBL register allocation go.  But for now, we'll leave this at its default
3889
+ * value.
3890
+ */
3891
+// #warning "Revisit me after FP and GBL allocation"
3892
+
3893
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
3894
+ * windows. ...
3895
+ *
3896
+ * Zip CPU has no register windows.
3897
+ */
3898
+
3899
+/* OUTGOING_REGNO ... same thing.
3900
+ */
3901
+
3902
+/* LOCAL_REGNO ... same thing.
3903
+ */
3904
+
3905
+/* PC_REGNUM ... If the program counter has a register number, define this as
3906
+ * that register number.  Otherwise do not define it.
3907
+ */
3908
+#define        PC_REGNUM       zip_PC
3909
+
3910
+
3911
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
3912
+ * containing the number of hard registers in the order in which GCC should
3913
+ * prefer to use them (from most preferred to least.
3914
+ *
3915 103 dgisselq
+ * If this macro is not defined, registers are used lowest numbered first (all
3916 102 dgisselq
+ * else being equal).
3917
+ *
3918
+ * Since the default is the ZipCPU desired case, we won't define this here.
3919
+ */
3920
+
3921
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3922
+ * this macro, so we won't either.
3923
+ */
3924
+
3925
+/* HONOR_REG_ALLOC_ORDER ...
3926
+ */
3927
+
3928
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3929
+ * this macro, so we won't either.
3930
+ */
3931
+
3932
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
3933
+ * consecutive hard registers, starting at register number REGNO, required to
3934
+ * hold a value of mode MODE.
3935
+ *
3936
+ * On a machine where all registers are exactly one word, a suitable definition
3937
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
3938
+ *
3939
+ * On ZipCPU, we might do
3940
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
3941
+ * but I think the default (above) code should work as well.  Hence, let's stick
3942
+ * with the default, lest someone try to create larger modes (TImode, OImode,
3943
+ * XImode) and expect us to follow them properly some how.
3944
+ *
3945
+ * Okay, now in hind sight, we know that the default doesn't work for our
3946
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
3947
+ * this expression to work in bits rather than in bytes and we'll know more
3948
+ * of what we are doing.
3949
+ */
3950
+#undef HARD_REGNO_NREGS
3951
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
3952
+               / (UNITS_PER_WORD))
3953
+
3954
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
3955
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
3956
+ * to take up more space than in registers starting at register number REGNO
3957
+ * (as determined by multiplying GCC's notion of the size of the register when
3958
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
3959
+ * By default this is zero.
3960
+ *
3961
+ * Zip CPU --- The default looks good enough to me.
3962
+ */
3963
+
3964
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
3965
+ *
3966
+ * ZipCPU ---
3967
+ */
3968
+
3969
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
3970
+ * registers that hold values of mode mode is not the word size.  It is a C
3971
+ * expression that should give the natural size in bytes for the specified mode.
3972
+ * It is used by the register allocator to try to optimize its results.
3973
+ *
3974
+ * ZipCPU ---
3975
+ */
3976
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
3977
+
3978
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
3979 103 dgisselq
+ * to store a value of mode MODE in a hard register number REGNO (or in several
3980 102 dgisselq
+ * registers starting with that one).  For a machine where all registers are
3981
+ * equivalent, a suitable definition is '1'.  You need not include code to check
3982
+ * for the numbers of fixed registers, because the allocation mechanism
3983
+ * considered them to be always occupied.
3984
+ *
3985
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
3986
+ * suitable default definition mentioned above should be sufficient.
3987
+ */
3988
+#undef HARD_REGNO_MODE_OK
3989 103 dgisselq
+#define        HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
3990 102 dgisselq
+
3991
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
3992
+ * okay to rename a hard register FROM to another hard register TO.  One common
3993
+ * use of this macro is to prevernt renaming of a register to another register
3994
+ * that is not saved by a prologue in an interrupt handler.  The default is
3995
+ * always nonzero.
3996
+ *
3997
+ * ZipCPU --- The default looks good enough to us.
3998
+ */
3999
+#undef HARD_REGNO_RENAME_OK
4000
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
4001
+
4002
+
4003
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
4004
+ * M1 is accessible in mode M2 without copying.
4005
+ *
4006
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
4007
+ * so lets' set to one.
4008
+ */
4009
+#define        MODES_TIEABLE_P(M1,M2)  1
4010
+
4011
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
4012
+ * This target hook should return true if it is OK to use a hard register
4013
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
4014
+ * to prevent using of a register that is not saved by a prologue in an
4015
+ * interrupt handler.  The default version of this hook always returns true.
4016
+ *
4017
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
4018
+ * context, you have an entirely new set of registers (the supervisor set), so
4019
+ * this is a non-issue.
4020
+ */
4021
+
4022
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
4023
+ * copies to/from CCmode register(s).  You should only define this macro if
4024
+ * support for copying to/from CCmode is incomplete.
4025
+ *
4026
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
4027
+ * default definition.
4028
+ */
4029
+
4030
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
4031
+ *
4032
+ * Zip CPU has no stack-like registers, as their definition is different from
4033
+ * the ZipCPU stack pointer register.
4034
+ */
4035
+
4036 127 dgisselq
+// #define     ZIP_REG_BYTE_SIZE       1
4037 102 dgisselq
+
4038
+/* 17.08 Register Classes */
4039
+
4040
+/* enum reg_class ... An enumerate type that must be defined with all the
4041
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
4042
+ * must be the last register class, followed by one more enumerated value,
4043
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
4044
+ * classes there are.
4045
+ *
4046
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
4047
+ * all_regs, and go from there.
4048
+ */
4049
+enum   reg_class {
4050
+       NO_REGS, GENERAL_REGS,
4051
+#ifdef DEFINE_USER_REGS
4052
+       USER_REGS,
4053
+#endif
4054
+       ALL_REGS, LIM_REG_CLASSES
4055
+};
4056
+
4057
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
4058
+ */
4059
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
4060
+
4061
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
4062
+ * classes as C string constants.  These names are used in writing some of the
4063
+ * debugging dumps.
4064
+ */
4065 127 dgisselq
+#ifdef DEFINE_USER_REGS
4066
+#  define      REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
4067
+#else
4068
+#  define      REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
4069
+#endif
4070 102 dgisselq
+
4071
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
4072 127 dgisselq
+ * classes, as integers which are bit masks.  The nth integer specifies the
4073 102 dgisselq
+ * contents of class n.  That way the integer mask is interpreted as that
4074
+ * register r is in the class if (mask&(1<<r)) is 1.
4075
+ *
4076
+ * When the machine has more than 32 registers ... that's not us.
4077
+ *
4078
+ * ZipCPU --- This is straight forward, three register classes, etc.
4079
+ */
4080 127 dgisselq
+#ifdef DEFINE_USER_REGS
4081
+#    define    REG_CLASS_CONTENTS { { 0x000000000}, {0x00003fff}, {0x0ffff0000l}, {0x0ffffffffl} }
4082 103 dgisselq
+#else
4083 127 dgisselq
+#  ifdef       zip_FP_PSEUDO
4084
+#    define    REG_CLASS_CONTENTS { { 0x00000}, {0x13fff}, {0x1ffff} }
4085
+#  else
4086
+#    define    REG_CLASS_CONTENTS { { 0x00000}, {0x03fff}, {0x0ffff} }
4087
+#  endif
4088 103 dgisselq
+#endif
4089 102 dgisselq
+
4090
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
4091
+ * containing hard register REGNO.  In general there is more than one such
4092
+ * class;  Choose a class which is minimal, meaning that no smaller class also
4093
+ * contains the register.
4094
+ */
4095
+#undef REGNO_REG_CLASS
4096 103 dgisselq
+#ifdef zip_FP_PSEUDO
4097
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((((R)<=13)||((R)==zip_FP_PSEUDO))?GENERAL_REGS:ALL_REGS):NO_REGS)
4098
+#else
4099 102 dgisselq
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?((R<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
4100 103 dgisselq
+#endif
4101 102 dgisselq
+
4102
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
4103
+ * a valid base register must belong.  A base register is one used in an address
4104
+ * which is the register value plus a displacement.
4105
+ */
4106
+#undef BASE_REG_CLASS
4107
+#define        BASE_REG_CLASS  GENERAL_REGS
4108
+
4109
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
4110
+ * which allows the selection of a bse register in a mode dependent manner.  If
4111
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
4112
+ */
4113
+#undef MODE_BASE_CLASS
4114
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
4115
+
4116
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
4117
+ * class to which a valid base register must belong in order to be used in a
4118
+ * base plus index register address.  You should define this macro if base plus
4119
+ * index addresses have different requirements than other base register uses.
4120
+ *
4121
+ * Zip CPU does not support the base plus index addressing mode, thus ...
4122
+ */
4123 111 dgisselq
+// #undef      MODE_BASE_REG_REG_CLASS
4124
+// #define     MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
4125 102 dgisselq
+
4126
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
4127
+ * which a valid index register must belong.  An index register is one used in
4128
+ * an address where its value is either multiplied by a scale factor or added
4129
+ * to another register (as well as added to a displacement).
4130
+ *
4131
+ * ZipCPU -- Has no index registers.
4132
+ */
4133
+#undef INDEX_REG_CLASS
4134
+#define        INDEX_REG_CLASS NO_REGS
4135
+
4136
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
4137
+ * number num is suitable for use as a base register in operand addresses.
4138
+ */
4139
+#undef REGNO_OK_FOR_BASE_P
4140 127 dgisselq
+# define REGNO_OK_FOR_BASE_P(NUM)      ((NUM>=FIRST_PSEUDO_REGISTER)||(NUM != zip_CC))
4141 102 dgisselq
+
4142
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
4143
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
4144 111 dgisselq
+ * memory reference in MODE.  You should define this macro if the mode of the
4145 102 dgisselq
+ * memory reference affects whether a register may be used as a base register.
4146
+ *
4147
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
4148
+ */
4149
+
4150
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
4151
+ * addresses, accessing memory in mode mode.
4152
+ *
4153
+ * Use of this macro is deprecated.
4154
+ */
4155
+
4156 111 dgisselq
+/* REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) ... A C expression which is
4157 102 dgisselq
+ * nonzero if a register number N is suitable for use as a base register in
4158
+ * operand addresses, accessing memory in mode M in address space AS.  This is
4159
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
4160
+ * the context in which the register appears in the memory reference.
4161
+ *
4162
+ * ZipCPU---We aren't specific in how we use our registers.
4163
+ */
4164
+#define        REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
4165
+
4166
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
4167
+ * num is suitable for use as an index register in opernad addressess.  It may
4168
+ * be either a suitable hard register or a pseudo register that has been
4169 111 dgisselq
+ * allocated such as a hard register.
4170 102 dgisselq
+ *
4171
+ * ZipCPU has no index registers, therefore we declare this to be zero.
4172
+ */
4173
+#undef REGNO_OK_FOR_INDEX_P
4174
+#define        REGNO_OK_FOR_INDEX_P(REGNO)     0
4175
+
4176
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
4177
+ * additional preference on the register class to use when it is necessary to
4178
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
4179
+ * preferred register class is found or hook preferred_rename_class is not
4180
+ * implemented.  SOmething returning a more restrictive class makes better code.
4181
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
4182
+ * instructions using GENERIC_REGS.  By returning LO_REGS from
4183
+ * preferred_rename_class, code size can be reduced.
4184
+ */
4185
+// #undef TARGET_PREFERRED_RENAME_CLASS
4186
+// #define     TARGET_PREFERRED_RENAME_CLASS(RCLASS)   RCLASS
4187
+
4188
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
4189
+ * restri tions on the register class to use when it is necessary to copy value
4190
+ * X into a register in class RC.  The value is a register class; rehaps RC, or
4191
+ * perhaps a smaller class.
4192
+ *
4193
+ * The default fversion of this hook always returns value of RC argument, which
4194
+ * sounds quite appropriate for the ZipCPU.
4195
+ */
4196
+
4197
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
4198
+ * restrictions on the register class to use when it is necessary to copy
4199
+ * value X into a register in class CLASS.  On many machines, the following
4200
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
4201
+ * Sometimes returning a more restrictive class makes better code.  For example,
4202
+ * on the 68k, when x is an integer constant that is in range for a moveq
4203
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
4204 111 dgisselq
+ * includes the data registers.  Requiring a data register guarantees that a
4205 102 dgisselq
+ * 'moveq' will be used.
4206
+ *
4207
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS.  For
4208
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
4209
+ * Hence, we only allow loads into the GENERAL_REG class.
4210
+ */
4211
+#define        PREFERRED_RELOAD_CLASS(X, CLASS)        GENERAL_REGS
4212
+
4213
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
4214
+ * RELOAD_CLASS, but for output instead of input reloads.
4215
+ *
4216
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
4217
+ */
4218
+
4219
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
4220
+ *
4221
+ * Don't define this macro unless the target machine has limitations which
4222
+ * require the macro to do something nontrivial.  ZipCPU doesn't, so we won't.
4223
+ */
4224
+
4225
+/* TARGET_SECONDARY_RELOAD
4226
+ * SECONDARY_ ...
4227
+ * Don't think we need these ...
4228
+ */
4229
+
4230
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
4231
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
4232
+ *
4233
+ * This is closely related to the macro HARD_REGNO_NREGS.  In fact, the value
4234
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
4235
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
4236
+ *
4237
+ * This macro helps control the handling of multiple word values in the reload
4238
+ * pass.
4239
+ *
4240
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
4241
+ * us.  We'll also choose register R0, since ... well, since it simply doesn't
4242
+ * matter.  (HARD_REGNO_NREGS ignores this anyway)
4243
+ */
4244
+#define        CLASS_MAX_NREGS(CLASS, MODE)    HARD_REGNO_NREGS(0,MODE)
4245
+
4246
+/* CANNOT_CHANGE_MODE_CLASS
4247
+ * ???
4248
+ */
4249
+
4250
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
4251
+ */
4252
+
4253
+/* TARRGET_LRA_P
4254
+ * Default looks good.
4255
+ */
4256
+
4257
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
4258 111 dgisselq
+ * priority number to which the register HARD_REGNO belongs to.  The bigger the
4259 102 dgisselq
+ * number
4260
+ *
4261
+ * The default version of this target hook returns always zero---good enough for
4262
+ * the ZipCPU.
4263
+ */
4264
+
4265
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
4266
+ * if we need register usage leveling.  That means if a few hard registers are
4267
+ * equally good for the assignment, we choose the least used hard register.  The
4268
+ * register usage leveling may be profitable for some targets.  Don't use usage
4269
+ * leveling for targets with conditional execution or targets with big register
4270
+ * files as it hurts if-conversion and cross-jumping optimizations.  The default
4271
+ * version of this target hook returns always false.
4272
+ *
4273
+ * ZipCPU --- Default is the right answer.
4274
+ */
4275
+
4276
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
4277
+ * Default looks good.
4278
+ */
4279
+
4280
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
4281
+ * Default looks good.
4282
+ */
4283
+
4284
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
4285
+ */
4286
+
4287
+/* TARGET_SPILL_CLASS
4288
+ *
4289
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
4290
+ * user set of registers.  However, we're not building for that mode (now),
4291
+ * so we'll leave this at the default of NO_REGS.
4292
+ */
4293
+
4294
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
4295
+ * boolean result of conditional store patterns.  The OCIDE argument is the
4296
+ * instruction code for the cstore being performed.  Not defining this hook is
4297
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
4298
+ * patterns.
4299
+ *
4300
+ * ??? ZipCPU --- I don't follow this documentation.  We'll leave this at the
4301
+ * default therefore.
4302
+ */
4303
+
4304
+/* 17.09 Stack Layout and Calling Conventions */
4305
+
4306
+
4307
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
4308
+ * moves the stack pointer to a smaller address, and false otherwise.
4309
+ *
4310
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
4311
+ * magically.  We have to move the stack pointer ourselves.  However, since this
4312
+ * is our convention, we'll define it as such.
4313
+ */
4314
+#undef STACK_GROWS_DOWNWARD
4315
+#define        STACK_GROWS_DOWNWARD    1
4316
+
4317
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
4318
+ * pushed on the stack.  In RTL, a push operation will be
4319
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
4320
+ * PRE_INC, and POST_INC.  Which of these is correct depends on the stack
4321
+ * direction and on whether the stack pointer points to the last item on the
4322
+ * stack or whether it points to the space for the next item on the stack.
4323
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
4324
+ * always right, and PRE_INC otherwise, which is often wrong.
4325
+ *
4326
+ * ZipCPU --- None of these is right, so let's leave this at the default and
4327
+ * see how badly we get mangled.  In particular, ZipCPU doesn't have any of the
4328
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
4329
+ */
4330
+
4331
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
4332
+ * local variable slots are at negative offsets from the frame pointer.
4333
+ *
4334
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
4335 103 dgisselq
+ * start of function execution, and that stack pointer grows downward, then
4336 102 dgisselq
+ * this should be the case as well.
4337
+ */
4338
+#undef FRAME_GROWS_DOWNWARD
4339
+#define        FRAME_GROWS_DOWNWARD    1
4340
+// #define     FRAME_GROWS_DOWNWARD    0        // This was ECO32's value
4341
+
4342
+
4343
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
4344
+ * function occupy decreasing addresses on the stack.
4345
+ *
4346
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
4347
+ * it is of no consequence to the hardware.
4348
+ */
4349
+
4350
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
4351
+ * variable slot to be allocated.  If FRAME_GROWS_DOWNWARD, find the next slot's
4352
+ * offset by subtracting the firstt slot's length from STARTING_FRAME_OFFSET.
4353
+ * Otherwise it is found by adding the length of the first slot to the value
4354
+ * START_FRAME_OFFSET.
4355
+ *
4356
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
4357
+ * the code is getting generated.  However, the ECO32 code I am copying from
4358
+ * suggests that 0 is the right value, so we'll use that here.
4359
+ */
4360
+// #warning "Re-evaluate me"
4361
+#define        STARTING_FRAME_OFFSET   0
4362
+
4363
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
4364
+ * stack during reload.  The nonzero default for this macro is suitable for most
4365
+ * ports.
4366
+ *
4367
+ * ZipCPU --- we'll leave this at the default, although if any alignment code
4368
+ * shows up on the stack we may need to adjust it.
4369
+ */
4370
+
4371
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
4372
+ * which outgoing arguments are placed.  If not specified, the default value
4373
+ * of zero is used.  This is the proper value for most machines.
4374
+ */
4375
+#define        STACK_POINTER_OFFSET    0
4376
+
4377
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
4378
+ * argument's address.  On some machines it may depend on the data type of the
4379
+ * function.
4380
+ */
4381
+#define        FIRST_PARM_OFFSET(F)    0
4382
+
4383
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
4384
+ * dynamically allocated on the stack, e.g., by alloca.  The default value for
4385
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
4386
+ * The default is correct for most machines, ...
4387
+ *
4388
+ * ZipCPU --- so we'll use it for the ZipCPU.
4389
+ */
4390
+
4391
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
4392
+ * the address of the initial stack frame.  This address is passed to
4393
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS.  If you don't define this macro,
4394
+ * a reasonable default value will be used.  Define this macro in order to make
4395
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
4396
+ * and __builtin_return_address(C) for (C) not equal to zero.
4397
+ *
4398
+ * ZipCPU --- Let's try the reasonable default and see what happens.
4399
+ */
4400
+
4401
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
4402
+ * code to setup the stack so that arbitrary frames can be accessed.  For
4403
+ * example, on the SPARC, we must flush all of the register windows to the stack
4404
+ * before we can access arbitrary stack frames.  You will seldom need to define
4405
+ * this macro.  The default is to do nothing.
4406
+ *
4407
+ * ZipCPU --- which is what we shall do here.
4408
+ */
4409
+
4410
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
4411
+ * an RTX that is used to store the address of the current frame into the
4412
+ * builtin setjmp buffer.  The default value, virtual_stack_vars_rtx, is correct
4413
+ * for most machines.  One reason you may need to define this target hook is if
4414
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
4415
+ *
4416
+ * ZipCPU --- leave this undefined, since the default value should be correct
4417
+ * for "most" machines.
4418
+ */
4419
+
4420
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
4421
+ */
4422
+
4423
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
4424
+ * representing the value of the return address for the frame COUNT steps up
4425
+ * from the current frame, after the prologue.  FRAMEADDR is the frame pointer
4426
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
4427
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero.  The value of the expression must
4428
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
4429
+ * there is no way to determine the return address of other frames.
4430
+ *
4431
+ * ZipCPU --- I have no idea how we'd do this, so let's just return NULL_RTX.
4432
+ */
4433
+#undef RETURN_ADDR_RTX
4434
+#define        RETURN_ADDR_RTX(COUNT,FRAMEADDR)        NULL_RTX
4435
+
4436
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
4437
+ * return address of a particular stack frame is accessed from the frame pointer
4438
+ * of the previous stack frame.  The zero default for this macro is suitable
4439
+ * for most ports.
4440
+ *
4441
+ * ZipCPU---Default works here as well.
4442
+ */
4443
+
4444
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
4445
+ * the location of the incoming return address at the beginning of any function,
4446
+ * before the prologue.  This RTL is either a REG, indicating that the return
4447
+ * value is saved in 'REG', or a MEM representing the location in the stack.
4448
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
4449
+ * DWARF_FRAME_REGNUM(REGNO).
4450
+ *
4451
+ * ZipCPU --- While our incoming return address could theoretically be in any
4452
+ * register, our machine description file is going to place it into register
4453
+ * R0, so that's what we return here.
4454
+ */
4455
+#undef INCOMING_RETURN_ADDR_RTX
4456
+#define        INCOMING_RETURN_ADDR_RTX        gen_rtx_REG(SImode, zip_R0)
4457
+
4458
+
4459
+/* DWARF_ALT_FRAME_RETURN_COLUMN
4460
+ */
4461
+
4462
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
4463
+ * register number that is considered to always have the value zero.  This
4464
+ * should only be defined if the target has an architected zero register (ZipCPU
4465
+ * does not), and someone decided it was a good idea to use that register number
4466
+ * to terminate the stack backtrace.  New ports should avoid this (so the
4467
+ * ZipCPU port will avoid it as well).
4468
+ *
4469
+ */
4470
+
4471
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
4472
+ */
4473
+
4474
+/* INCOMING_FRAME_SP_OFFSET
4475
+ */
4476
+#define        INCOMING_FRAME_SP_OFFSET        0
4477
+
4478
+/* ARG_POINTER_CFA_OFFSET
4479
+ */
4480
+
4481
+/* FRAME_POINTER_CFA_OFFSET
4482
+ */
4483
+
4484
+/* CFA_FRAME_BASE_OFFSET
4485
+ */
4486
+
4487
+/* 17.09.02 Exception handling support */
4488
+
4489
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
4490
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
4491
+ * N registers are usable.  The exception handling library routines communicate
4492
+ * with the exception handlers via a set of agreed upon registers.  Ideally
4493
+ * these registers should be call clobbered; it is possible to use call-saved
4494
+ * registers, but may negatively impact code size.  The target must support at
4495
+ * least 2 data registers, but should define 4 if their are enough free
4496
+ * registers.
4497
+ *
4498
+ * You must define this macro if you want to support call frame exception
4499
+ * handling like that provided by DWARF 2.
4500
+ */
4501
+#define        EH_RETURN_DATA_REGNO(N) (((N<ZIP_FIRST_ARG_REGNO)||(N>ZIP_LAST_ARG_REGNO))?(N-1):INVALID_REGNUM)
4502
+
4503
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
4504
+ * a location in which to store a stack adjustment to be applied before function
4505
+ * return.  This is used to unwind the stack to an exception handler's call
4506
+ * frame.  It will be assigned zero on code paths that return normally.
4507
+ *
4508
+ * Do not define this macro if the stack pointer is saved and restored by the
4509
+ * regular prolog and epilog code in the call frame itself (which it is for the
4510
+ * ZipCPU); in this case, the exception handling library routines will update
4511
+ * the stack location to be restored in place.  Otherwise, you must define this
4512
+ * macro if you want to support call frame exception handling like that provided
4513
+ * by DWARF 2.
4514
+ *
4515
+ */
4516
+
4517
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
4518
+ * location in which to store the address of an exception handler to which we
4519
+ * should return.  It will not be assigned on code paths that return normally.
4520
+ *
4521
+ * Typcally this is the location in the call frame at which the normal return
4522
+ * address is stored.  For targets that return by popping an address of the
4523
+ * stack, this might be a memory address just below the target callf rame
4524
+ * rather than inside the current call frame.  If defined,
4525
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
4526
+ * to calculate the location of the target call frame.
4527
+ *
4528
+ * If you want to support call frame exception handling, you must define either
4529
+ * this macro or the eh_return instruction pattern.
4530
+ */
4531
+// #warning "I don't know what to do here."
4532
+
4533
+/*
4534
+ *
4535
+ *
4536
+ *
4537
+ *   REST OF SECTION SKIPPED ...
4538
+ *
4539
+ *
4540
+ *
4541
+ */
4542
+
4543
+/* 17.09.03 Specifying how stack checking is done */
4544
+
4545
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
4546
+ * configuration files in a machine-dependent manner.  You should define this
4547
+ * macro if stack checking is required by the ABI of your machine or if you
4548
+ * would like to do stack checking in some more efficient way than the generic
4549
+ * appraoch.  The default value of this macro is zero.
4550
+ *
4551
+ * ZipCPU --- The default makes sense for us.
4552
+ */
4553
+// #define STACK_CHECK_BUILTIN 0
4554
+
4555
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
4556
+ * done by the configuration files in a machine-dependent manner.  You should
4557
+ * define this macro if you would like to do static stack checking in some more
4558
+ * efficient way than the generic approach.  The default value of this macro
4559
+ * is zero.
4560
+ *
4561
+ * ZipCPU --- The default makes sense for us.
4562
+ */
4563
+
4564
+/* STACK_CHECK_PROBE_INTERVAL_EXP ...  An integer specifying the interval at
4565
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
4566
+ * interval.  You will normally define this macro so that the interval is no
4567
+ * larger than the size of the "guard pages" at the end of a stack area.  The
4568
+ * default value of 12 (4096-byte interval) is suitable for most systems.
4569
+ *
4570
+ * ZipCPU --- Default.
4571
+ */
4572
+
4573
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
4574
+ * the stack pointer page by page when doing probes.  This can be necessary
4575
+ * on systems where the stack pointer contains the bottom address of the memory
4576
+ * area accessible to the executing thread at any point in time.  In this
4577
+ * situation, an alternate signal stack is required in order to be able to
4578
+ * recover from a stack overflow.  The default value of this macro is zero.
4579
+ *
4580
+ * ZipCPU -- Default.
4581
+ */
4582
+
4583
+/* STACK_CHECK_PROTECT
4584
+ */
4585
+/* STACK_CHECK_MAX_FRAME_SIZE
4586
+ * ... you should normally not change the default value of this macro.
4587
+ */
4588
+/* STACK_CHECK_FIXED_FRAME_SIZE
4589
+ * ... you ... will normally use the default of four words.
4590
+ */
4591
+
4592
+/* STACK_CHECK_MAX_VAR_SIZE
4593
+ * ... you will normally not need to override that default.
4594
+ */
4595
+
4596
+/* 17.09.04 Registers that Address the Stack Frame*/
4597
+
4598
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
4599
+ * which must also be a fixed register according to FIXED_REGISTERS.  On most
4600
+ * machines, the hardware determines which register this is.
4601
+ */
4602
+#undef STACK_POINTER_REGNUM
4603
+#define        STACK_POINTER_REGNUM    zip_SP
4604
+
4605
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
4606
+ * which is used to access certain automatic variables in the stack frame.  On
4607
+ * some machines, the hardware determines which register this is.  On other
4608
+ * machines you can choose any register you wish for this purpose.
4609
+ *
4610
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
4611
+ * a need for it, alloca() requires it.  Therefore let's assine a register to
4612
+ * this purpose and watch what the compiler does with it.
4613
+ */
4614 103 dgisselq
+#ifdef zip_FP_PSEUDO
4615
+#define        FRAME_POINTER_REGNUM    zip_FP_PSEUDO
4616
+#else
4617 102 dgisselq
+#define        FRAME_POINTER_REGNUM    zip_FP
4618 103 dgisselq
+#endif
4619 102 dgisselq
+
4620
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
4621
+ * pointer and starting offset of the automatic variables is not known until
4622
+ * after register allocation has been done (for example, because the saved
4623
+ * registers are between these two locations).  On those machines, define
4624
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
4625
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
4626
+ * to be the actual hard register number used for the frame pointer.
4627
+ *
4628
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
4629
+ *
4630
+ * ZipCPU --- we do not define this macro.
4631
+ */
4632 103 dgisselq
+#if (zip_FP == FRAME_POINTER_REGNUM)
4633
+#define HARD_FRAME_POINTER_REGNUM      zip_FP
4634
+#endif
4635 102 dgisselq
+
4636
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
4637
+ * is used to access the function's argument list.  On some machines, this is
4638
+ * the same as the frame pointer register.  On some machines, the hardware
4639
+ * determines which register this is.  On other machines, you can choose any
4640
+ * register you wish for this purpose.  If this is not the same register as the
4641
+ * frame pointer register, then you must mark it as a fixed register according
4642
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
4643
+ *
4644
+ * ZipCPU --- We really don't want to lose another register to something
4645
+ * pointless, so let's set this to be the frame pointer register.  Especially
4646
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
4647
+ * should work for a rather large stack frame.
4648
+ */
4649 103 dgisselq
+#define ARG_POINTER_REGNUM     FRAME_POINTER_REGNUM
4650 102 dgisselq
+
4651
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
4652
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
4653
+ * should be the same.  The default definition is sufficient for us.
4654
+ */
4655
+
4656
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
4657
+ * ZipCPU doesn't need this macro
4658
+ */
4659
+
4660
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
4661
+ * pointer register, which is used to access the current function's return
4662
+ * address from the stack.  On some machines, the return address is not at a
4663
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
4664
+ * This register can be defined to point to the return address on the stack, and
4665
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
4666
+ * stack pointer.
4667
+ *
4668
+ * Do not define this macro unless there is no other way to get the return
4669
+ * address from the stack.
4670
+ *
4671
+ * ZipCPU---we need this.
4672
+ */
4673
+#define        RETURN_ADDRESS_REGNUM   zip_R0
4674
+
4675
+
4676
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
4677
+ * static chain pointer.  If register windows are used, the register number as
4678
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
4679
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM.  If
4680
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
4681
+ * defined.
4682
+ *
4683
+ * ZipCPU doesn't have register windows, so we don't need to define this.
4684
+ */
4685
+// #warning "I have no reason to believe this will even work"
4686
+#define        STATIC_CHAIN_REGNUM     zip_GOT
4687
+
4688
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
4689
+ * al for targets that may use different static chain locations for different
4690
+ * nested functions.  This may be required if the target has function attributes
4691
+ * that affect the calling conventions of the function and those calling
4692
+ * conventions use different static chain locations.
4693
+ *
4694
+ * ZipCPU --- don't need this.
4695
+ */
4696
+// #define     STATIC_CHAIN_REGNUM     zip_R11
4697
+
4698
+
4699
+/* DWARF_FRAME_REGISTERS ... This macro specifies  the maximum number of hard
4700
+ * registers that can be saved in a call frame.  This is used to size data
4701
+ * structures used in DWARF2 exception handling.
4702
+ *
4703
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
4704
+ * exception handling ABI in the face of adding new hard registers for ISA
4705
+ * extensions.  In GCC 3.0 and later, the EH ABI is insulated from changes in
4706
+ * the number of hard registers.  Nevertheless, this macro can still be used to
4707
+ * reduce the runtime memory requirements of the exception handling routines,
4708
+ * which can be substantial if the ISA contains a lot of registers that are not
4709
+ * call-saved.
4710
+ *
4711
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
4712
+ *
4713
+ * ZipCPU --- The default is not sufficient.  The CC and PC registers need to
4714
+ * be saved and examined as well in any debug/exception context.  Hence, we
4715
+ * define this to be all of our registers.
4716
+ */
4717
+#undef DWARF_FRAME_REGISTERS
4718
+#define        DWARF_FRAME_REGISTERS   16
4719
+
4720
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
4721
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
4722
+ *
4723
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
4724
+ * the ZipCPU.
4725
+ */
4726
+
4727
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
4728
+ * representation for dwarf registers is different than the internal
4729
+ * representation for unwind column.  Given a dwarf register, this macro should
4730
+ * return the unwind column number to use instead.
4731
+ *
4732
+ * ... ???
4733
+ */
4734
+
4735
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
4736
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
4737
+ * different from that used in other debug info sections.  Given a GCC hard
4738
+ * register number, this macro should return the .eh_frame register number.
4739
+ * The default is DBX_REGISTER_NUMBER(REGNO).
4740
+ *
4741
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
4742
+ * should still work for us.
4743
+ */
4744
+
4745
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
4746
+ * numbers held in the call frame info that GCC has collected using
4747
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
4748
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
4749
+ *
4750
+ * ZipCPU --- Default is good enough.
4751
+ */
4752
+
4753
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
4754
+ * register values as _Unwind_Word type in unwind context.  It should be defined
4755
+ * if target register size is larger than the size of void *.  The default
4756
+ * is to store register values as void *type.
4757
+ *
4758
+ * ZipCPU --- Default is what we need.
4759
+ */
4760
+
4761
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
4762
+ * always uses extended unwind context with version, args_size, and by_value
4763
+ * fields.  If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
4764
+ *
4765
+ */
4766
+
4767
+
4768
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
4769
+
4770
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
4771
+ * if a function must have and use a frame pointer.  This target hook is
4772
+ * called in the reload pass.  If its return value is true, the function will
4773
+ * have a frame pointer.
4774
+ *
4775
+ * This target hook can in principle examine the current function and decide
4776
+ * according to the facts, but on most machines the constant false or the
4777
+ * constant true suffices.  Use false when the machine allows code to be
4778
+ * generated with no frame pointer, and doing so saves some time or space.
4779
+ * Use true when there is no possible advantage to avoiding a frame pointer.
4780
+ *
4781
+ * ZipCPU---if we add in a frame pointer, we become register starved.  Hence,
4782
+ * we'll treat this as a constant false--which is also the default value.
4783
+ */
4784
+#define        target_frame_pointer_required   zip_frame_pointer_required
4785
+
4786
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
4787
+ * depth-var the difference between the frame pointer and the stack pointer
4788
+ * values immediately after the function prologue.  The value would be computed
4789
+ * from information such as the result of get_frame_size() and the tables of
4790
+ * registers regs_ever_live and call_used_regs.
4791
+ *
4792
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
4793
+ * defined.  Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
4794
+ * always returns true; in that case you may set depth-var to anything.
4795
+ *
4796
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
4797
+ */
4798
+// #define     INITIAL_FRAME_POINTER_OFFSET(DEPTH)     (DEPTH) = 0
4799
+
4800
+
4801
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
4802
+ * pairs used to eliminate unneeded registers that point into the stack frame.
4803
+ * If it is not defined, the only elimination attempted by the compiler is to
4804
+ * replace references to the frame pointer with references to the stack pointer.
4805
+ *
4806
+ * On some machines, the position of the argument pointer is not known until
4807
+ * the compilation is completed.  In such a case, a separate hard register
4808
+ * must be used for the argument pointer.  This register can be eliminated by
4809
+ * replacing it with either the frame pointer or the argument pointer,
4810
+ * depending on whether or not the frame pointer has been eliminated.
4811
+ *
4812
+ * ZipCPU we'll take their suggestion and define this as:
4813
+ */
4814
+#undef ELIMINABLE_REGS
4815 103 dgisselq
+#ifdef zip_FP_PSEUDO
4816 102 dgisselq
+#define        ELIMINABLE_REGS \
4817 103 dgisselq
+        {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},          \
4818
+         { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},     \
4819
+         { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},        \
4820
+         { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
4821
+#else
4822
+# if (ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)
4823
+#  define      ELIMINABLE_REGS \
4824
+        {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4825
+# else
4826
+#  define      ELIMINABLE_REGS \
4827 102 dgisselq
+       {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },  \
4828
+        { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },  \
4829
+        { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4830 103 dgisselq
+# endif
4831
+#endif
4832 102 dgisselq
+
4833
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
4834
+ * true if the compiler is allowed to try to replace register number FROM with
4835
+ * register number TO.  This target hook need only be defined if ELIMINABLE_REGS
4836
+ * is defined, and will usually return true since most of the cases preventing
4837
+ * register elimination are things that the compiler  already knows about.
4838
+ *
4839
+ * ZipCPU ... does the compiler  know about my decision as to whether or not
4840 117 dgisselq
+ * the frame pointer was needed?  Yes it does, but it's kept separately.  We'll
4841
+ * just say everything can be eliminated.
4842 102 dgisselq
+ */
4843
+#define TARGET_CAN_ELIMINATE   zip_can_eliminate
4844
+
4845
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
4846
+ * INITIAL_FRAME_POINTER_OFFSET.  It specifies the initial difference between
4847
+ * the specified pair of registers.  This macro must be defined if
4848
+ * ELIMINABLE_REGS is defined.
4849
+ *
4850 117 dgisselq
+ * ZipCPU---We had at one time set this to a default offset of 0.  This didn't
4851
+ * work.  It turns out that this is not only the *initial* elimination offset,
4852
+ * but also the offset along the way.  Hence, when a variable needs to be
4853
+ * spilled to the stack, this offset must change.  Reload goes and checks for
4854
+ * this, and adjusts registers if the offset has changed.  Hence, without this,
4855
+ * we get negative (i.e. illegal) stack offsets.
4856 102 dgisselq
+ */
4857
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
4858
+       do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
4859
+       while(0)                                        \
4860
+
4861
+/* 17.09.06 Passing function arguments on the stack */
4862
+
4863
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
4864
+ * prototype as an integral type smaller than int should actually be
4865
+ * passed as an int.  In addition to avoiding errors in certain cases of
4866
+ * mismatch, it also makes for better code on certain machines.  The default is
4867
+ * to not promote prototypes.
4868
+ *
4869
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
4870
+ * (which should still be an int) up to an int anyway.
4871
+ */
4872
+#undef TARGET_PROMOTE_PROTOTYPES
4873
+#define        TARGET_PROMOTE_PROTOTYPES       hook_bool_const_tree_true
4874
+
4875
+/* PUSH_ARGS ... A C expression.  If nonzero, push instructions will be used to
4876
+ * pass outgoing arguments.  If the target machine does not have a push
4877
+ * instruction, set it to zero.  That directs GCC to use an alternate strategy:
4878
+ * to allocate the entire argument block and then store the arguments into it.
4879
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
4880
+ *
4881
+ * ZipCPU does not have a push instruction, so we set this to zero.
4882
+ */
4883
+#undef PUSH_ARGS
4884
+#define        PUSH_ARGS       0
4885
+
4886
+/* PUSH_ARGS_REVERSED ... A C expression.  If nonzero, function arguments will
4887
+ * be evaluated last to first, rather than first to last.  If this macro is
4888
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
4889
+ * grow in opposite directions, and zero otherwise.
4890
+ *
4891
+ * ZipCPU---Let's evaluate our arguments first to last.
4892
+ */
4893
+#define        PUSH_ARGS_REVERSED      1
4894
+
4895
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
4896
+ * actually pushed onto the stack when an instruction attempts to push
4897
+ * (NPUSHED) bytes.
4898
+ *
4899
+ * ZipCPU---We cannot push bytes.  Let's leave this undefined and see what
4900
+ * happens.
4901
+ */
4902
+// #warning "No appropriate definition seemed right."
4903
+
4904
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression.  If non-zero, the maximum amount
4905
+ * of space required for outgoing arguments will be computed and placed into
4906
+ * 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
4907
+ * amount.
4908
+ *
4909
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
4910
+ * each time we try to call a function/routine.  Yes, we want and *need* this
4911
+ * for good performance.  I mean, think of it, free performance increase?  Who
4912
+ * could argue with that?
4913
+ */
4914
+#undef ACCUMULATE_OUTGOING_ARGS
4915
+#define        ACCUMULATE_OUTGOING_ARGS        1
4916
+
4917
+
4918
+/* REG_PARM_STACK_SPACCE(FN) ... Define this macro if functions should assume
4919
+ * that stack space has been allocated for arguments even when their values
4920
+ * are passed in registers.  The value of this macro is the size, in bytes, of
4921
+ * the area reserved for arguments passed in registers for the function
4922
+ * represented by FN, which can be zero if GCC is calling a library function.
4923
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
4924
+ *
4925
+ * This space can be allocated by the caller, or be part of the machine
4926
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
4927
+ *
4928
+ * ZipCPU --- Why allocate space you won't use?  Let's leave this undefined
4929
+ * therefore.
4930
+ */
4931
+// #undef      REG_PARM_STACK_SPACE
4932
+
4933
+
4934
+
4935
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
4936
+ * incoming register arguments.  Define this macro if space guaranteed when
4937
+ * compiling a function body is different to space required when making a call,
4938
+ * a situation that can arise with K&R style function definitions.
4939
+ *
4940
+ */
4941
+
4942
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
4943
+ * is the responsibility of the caller to allocate the area reserved for
4944
+ * arguments passed in registers when calling a function of FN.  FN may be NULL
4945
+ * if the function called is a library function.
4946
+ *
4947
+ * ZipCPU---Why allocate space you don't need?
4948
+ */
4949
+#define        OUTGOING_REG_PARM_STACK_SPACE(FNTYPE)   0
4950
+
4951
+
4952
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
4953
+ * is defined, buyt the stack parameters don't skip the area specified by it.
4954
+ *
4955
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
4956
+ */
4957
+
4958
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
4959
+ * number of bytes of its own arguments that a function pops on returning, or 0
4960
+ * if the function pops no arguments and the caller must therefore pop them all
4961
+ * after the function returns.
4962
+ *
4963
+ * ZipCPU --- If we define this, we'll lose our gain from
4964
+ * ACCUMULATE_OUTOING_ARGS.  Thus, we leave this undefined.
4965
+ */
4966
+
4967
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
4968
+ * bytes a call sequence pops off of the stack.  It is added to the value of
4969
+ * RETURN_POPS_ARGS when compiling a function call.  CUM is the variable in
4970
+ * which all arguments to the function have been accumulated.
4971
+ *
4972
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack.  Therefore
4973
+ * this is zero.
4974
+ */
4975
+#undef CALL_POPS_ARGS
4976
+#define        CALL_POPS_ARGS(CUM)     0
4977
+
4978
+
4979
+/* 17.09.07 Passing arguments in registers */
4980
+
4981
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
4982
+ * is passed in a register, and if so, which register.
4983
+ */
4984
+/*
4985
+ * This has been poisoned ... so let's not define it anymore and look for
4986
+ * a better way to do this ...
4987
+ *
4988
+ * #define     FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
4989
+ *     : targetm.calls.must_pass_in_stack(MODE, TYPE)  ? NULL_RTX
4990
+ *     : (CUM) > ZIP_LAST_ARG_REGNO                    ? NULL_RTX
4991
+ *     : gen_rtx_REG(MODE, CUM))
4992
+ */
4993
+#define        TARGET_FUNCTION_ARG     zip_function_arg
4994
+
4995
+
4996
+/* TARGET_MUST_PASS_IN_STACK ...
4997
+ */
4998
+// #undef      TARGET_MUST_PASS_IN_STACK
4999
+// #define     TARGET_MUST_PASS_IN_STACK       zip_must_pass_in_stack
5000
+
5001
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
5002
+ * has register windows, ... which ZipCPU does not have.
5003
+ */
5004
+
5005
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
5006
+ * pseudo register should be created for pic_offset_table_rtx during function
5007
+ * expand.
5008
+ *
5009
+ * This should be defined by global parameters, isn't it?
5010
+ */
5011
+
5012
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
5013
+ * pic_offset_table_rtx.  This hook is called at the start of register
5014
+ * allocation.
5015
+ *
5016
+ * ZipCPU---Let's revisit this.
5017
+ */
5018
+// #warning "Come back and relook at relocations"
5019
+
5020
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
5021
+ * at the beginning of an argument that must be put in registers.  The value
5022
+ * must be zero for arguments that are passed entirely in registers or that
5023
+ * are entirely pushed on the stack.
5024
+ */
5025
+// #undef      TARGET_ARG_PARTIAL_BYTES
5026
+// #define     TARGET_ARG_PARTIAL_BYTES        zip_arg_partial_bytes
5027
+
5028
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
5029
+ * return true if an argument at the position indicated by CUM should be passed
5030
+ * by reference.  This predicate is queried after target independent reasons
5031
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
5032
+ *
5033
+ */
5034
+// #undef      TARGET_PASS_BY_REFERENCE
5035
+// #define     TARGET_PASS_BY_REFERENCE        zip_pass_by_reference
5036
+
5037
+/* CUMULATIVE ARGS ...  A C type for declaring a variable that is used as the
5038
+ * first argument of 'FUNCTION_ARG' and other related values.
5039
+ *
5040
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
5041
+ */
5042
+#define        CUMULATIVE_ARGS int
5043
+
5044
+/*
5045
+ * OVERRIDE_ABI_FORMAT
5046
+ */
5047
+
5048
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
5049
+ * variable CUM for the state at the beginning of the argument list.
5050
+ *
5051
+ *
5052
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
5053
+ * R1 (unless it has been redefined above ...)
5054
+ */
5055
+#define        INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
5056
+
5057
+/* INIT_CUMULATIVE_LIBCALL_ARGS
5058
+ * INIT_CUMULATIVE_INCOMING_ARGS
5059
+ *
5060
+ * These default to the last INIT_CUM_ARGS value above.
5061
+ */
5062
+
5063
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
5064
+ * the summarizer variable pointed to by CUM to advance past an argument in
5065
+ * the argument list.  The values MODE, TYPE, and NAMED describe that
5066
+ * argument.  Once this is done, the variable CUM is suitable for analyzing the
5067
+ * following argument with TARGET_FUNCTION_ARG, etc.  This hook need not do
5068
+ * anything if the argument in question was passed on the stack.  The compiler
5069
+ * knows how to track the amount of stack space used for arguments without
5070
+ * any special help.
5071
+ *
5072
+ * ZipCPU---Here we simply copy from ECO32.
5073
+ */
5074
+#define        TARGET_FUNCTION_ARG_ADVANCE     zip_function_arg_advance
5075
+
5076
+/*
5077
+ * TARGET_ARG_OFFSET --- not necessary
5078
+ * FUNCTION_ARG_PADDING        --- not necessary, since we shouldn't be padding
5079
+ * PAD_VARARGS_DOWN    --- not necessary, since we shouldn't be padding
5080
+ * BLOCK_REG_PADDING
5081
+ * TARGET_FUNCTION_ARG_BOUNDARY
5082
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
5083
+ */
5084
+
5085
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
5086
+ * the number of a hard register in which function arguments are sometimes
5087
+ * passed.  This does not include implicit arguments such as the static chain
5088
+ * and the structure-value address.  On many machines, no registers can be used
5089
+ * for this purpose since all function arguments are pushed on the stack.
5090
+ */
5091
+#define        FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
5092
+
5093
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
5094
+ * of type TYPE are passed as two scalar parameters.  By default, GCC will
5095
+ * attempt to pack complex arguments into the target's word size.  Some ABI's
5096
+ * require complex arguments to be split and treated as their individual
5097
+ * components.
5098
+ *
5099
+ * The default value of this hook is NULL, which is treated as always false,
5100
+ * and which should be good enough for ZipCPU--which can go either way.
5101
+ */
5102
+
5103
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
5104
+ * for the target.  The default version of the hook returns void*.
5105
+ *
5106
+ */
5107
+
5108
+/* TARGET_ENUM_VA_LIST_P
5109
+ */
5110
+
5111
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
5112
+ * convention specified by FN.  The default version of this returns va_list_type_node.
5113
+ */
5114
+
5115
+/* TARGET_FN_ABI_VA_LIST
5116
+ */
5117
+
5118
+/* TARGET_CANONICAL_VA_LIST_TYPE
5119
+ */
5120
+
5121
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
5122
+ */
5123
+
5124
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
5125
+ * port can handle pointers with machine mode MODE.  The default version of this
5126
+ * hook returns true for both ptr_mode and Pmode.
5127
+ *
5128
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
5129
+ * default behavior is quite appropriate.
5130
+ */
5131
+
5132
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
5133
+ * memory reference REF may alias with the system C library errno location.
5134
+ * The default version of this hook assumes the system C library errno location
5135
+ * is either a declaration of type int or accessed by dereferencing a pointer
5136
+ * to int.
5137
+ *
5138
+ * ZipCPU --- Default sounds good to me.
5139
+ */
5140
+
5141
+
5142
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
5143
+ * the port is prepared to handl instructions involving scalar mode MODE.  For
5144
+ * a scalar mode to be considered supported, all the basic arithmetic and
5145
+ * comparisons must work.
5146
+ *
5147
+ * The default version of this hook returns true for any mode required to
5148
+ * handle the basic C types (as defined by the port).  Included here are the
5149
+ * double-word arithmetic supported by the code in optabs.c.
5150
+ */
5151
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
5152
+#define        TARGET_SCALAR_MODE_SUPPORTED_P  zip_scalar_mode_supported_p
5153
+
5154
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
5155
+ * port is prepared to handle instructions involving vector mode MODE.  At the
5156
+ * very least, it must have move patterns for this mode.
5157
+ *
5158
+ * ZipCPU---does not support any vector modes.
5159
+ */
5160
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
5161
+#define        TARGET_VECTOR_MODE_SUPPORTED_P  hook_bool_mode_false
5162
+
5163
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
5164
+ * try to use a scalar mode to store an array of NELEMS elements, given that
5165
+ * each element has mode MODE.  Returning true here overrides the usual MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
5166
+ *
5167
+ * ZipCPU---Sounds good.
5168
+ */
5169
+// #undef      TARGET_ARRAY_MODE_SUPPORTED_P
5170
+// #define     TARGET_ARRAY_MODE_SUPPORTED_P   zip_array_mode_supported_p
5171
+
5172
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
5173
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
5174
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P.  The default version of this
5175
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
5176
+ * modes exist.
5177
+ *
5178
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
5179
+ * (if we can).  Let's allow both of those and see how far we get.
5180
+ */
5181
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
5182
+#define        TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
5183
+
5184
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
5185
+ * nonzero for machine modes for which the port has small register classes.  If
5186
+ * target hook returns nonzero for a given MODE, the compiler will try to
5187
+ * minimize the lifetime of registers in MODE.  The hook may be called with
5188
+ * VOIDmode as an argument.  In this case, the hook is expected to return
5189
+ * nonzero if it returns nonzero for any mode.
5190
+ *
5191
+ * The default version of this hook returns false for any mode.
5192
+ *
5193
+ * ZipCPU---Default sounds good.
5194
+ */
5195
+
5196
+/* 17.09.08 How scalar function values are returned */
5197
+
5198
+/* TARGET_FUNCTION_VALUE
5199
+ */
5200
+
5201
+/* LIBCALL_VALUE
5202
+ */
5203
+
5204
+
5205
+/* 17.09.09 How large values are returned */
5206
+
5207
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
5208
+ * nonzero value to say to return the function value in memory, just as large
5209
+ * structures are always returned.  Here type will be the data type of the value
5210
+ * and FNTYP will be the type of the function doing the returning, or NULL
5211
+ * for libcalls.
5212
+ *
5213
+ */
5214
+#undef TARGET_RETURN_IN_MEMORY
5215
+#define        TARGET_RETURN_IN_MEMORY zip_return_in_memory
5216
+
5217
+/* DEFAULT_PCC_STRUCT_RETURN
5218
+ * TARGET_STRUCT_VALUE_RTX
5219
+ * PCC_STATIC_STRUCT_RETURN
5220
+ * TARGET_GET_RAW_RESULT_MODE
5221
+ * TARGET_GET_RAW_ARG_MODE
5222
+ */
5223
+
5224
+
5225
+/* 17.09.10 Caller-Saves Register Allocation */
5226
+/* 17.09.11 Function Entry and Exit */
5227 111 dgisselq
+// TARGET_ASM_FUNCTION_PROLOGUE
5228
+// TARGET_ASM_FUNCTION_END_PROLOGUE
5229
+// TARGET_ASM_FUNCCTION_BEGIN_EPILOGUE
5230
+// TARGET_ASM_FUNCTION_EPILOGUE
5231
+/* EXIT_IGNORE_STACK ... Define this macro as a C expression that is nonzero
5232
+ * if the return instruction or the function epilogue ignores the value of the
5233
+ * stack pointer; in other words, if it is safe to delete an instruction to
5234
+ * adjust the stack pointer before a return from the function.
5235
+ *
5236
+ * The default is 0.
5237
+ *
5238
+ * Note that this macro's value is relevant only for functions for which frame
5239
+ * pointers are maintained.  It is never safe to delete a final stack adjustment
5240
+ * in a function that has no frame pointer, and the compiler knows this
5241
+ * regardless of EXIT_IGNORE_STACK.
5242
+ *
5243
+ * ZipCPU -- Thanks to the example of the m68k, and a careful selection of what
5244
+ * our options otherwise could have been, our epilogue code does not use the
5245
+ * stack register at all, but rather starts by moving the frame register into
5246
+ * the stack register.
5247
+ */
5248
+#define EXIT_IGNORE_STACK      1
5249
+// EPILOGUE_USES(regno)
5250
+// EH_USES(regno)
5251
+// TARGET_ASM_OUTPUT_MI_THUNK
5252
+// TARGET_ASM_CAN_OUTPUT_MI_THUNK
5253
+
5254 102 dgisselq
+/* 17.09.12 Generating code for profiling */
5255 111 dgisselq
+// FUNCTION_PROFILER
5256
+// PROFILE_HOOK
5257
+// NO_PROFILE_COUNTERS
5258
+// PROFILE_BEFORE_PROLOGUE
5259
+// TARGET_KEEP_LEAF_WHEN_PROFILED
5260
+
5261 102 dgisselq
+/* 17.09.13 Permitting tail calls*/
5262 111 dgisselq
+
5263
+/* TARGET_FUNCTION_OK_FOR_SIBCALL(DECL,EXP) ... True if it is OK to do sibling
5264
+ * call optimizations for the specified call expression EXP.  DECL will be the
5265
+ * called function, or NULL if this is an indirect call.
5266
+ *
5267
+ * It is not uncommon for limitations of calling conventions to prevent tail
5268
+ * calls to functions outside the current unit of translation, or during PIC
5269
+ * compilation.  The hook is used to enforce these restrictions, as the sibcall
5270
+ * md pattern can not fail, or fall over to a 'normal' call.  The criteria for
5271
+ * successful sibling call optimization may vary greatly between different
5272
+ * architectures.
5273
+ *
5274
+ * ?? What's a sibling call?
5275
+ */
5276
+
5277
+// TARGET_EXTRA_LIVE_ON_ENTRY
5278
+// TARGET_SET_UP_BY_PROLOGUE
5279
+// TARGET_WARN_FUNC_RETURN
5280
+
5281 102 dgisselq
+/* 17.09.14 Stack smashing protection */
5282 111 dgisselq
+// TARGET_STACK_PROTECT_GUARD
5283
+// TARGET_STACK_PROTECT_FAIL
5284
+// TARGET_SUPPORTS_SPLIT_STACK
5285
+
5286 102 dgisselq
+/* 17.09.15 Miscellaneous register hooks */
5287
+
5288 111 dgisselq
+// TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5289
+
5290 102 dgisselq
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5291
+ * ZipCPU --- default is good enough for us.
5292
+ */
5293
+
5294
+/* 17.10 Implementing VARARGS MACROS */
5295
+
5296
+/* ...
5297
+ */
5298
+
5299
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
5300
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
5301
+ * _BUILTIN_SAVEREGS.  Use it to store the anonymous register arguments into the
5302
+ * stack so that all the arguments appear to have been passed consecutively
5303
+ * on the stack.  Once this is done, you can use the standard implementation
5304
+ * of varargs that works for machines that pass all their arguments on the
5305
+ * stack.
5306
+ */
5307
+// #undef      TARGET_SETUP_INCOMING_VARARGS
5308
+// #define     TARGET_SETUP_INCOMING_VARARGS   zip_setup_incoming_varargs
5309
+
5310
+/* ...
5311
+ */
5312
+
5313
+/* 17.11 Trampolines for Nested Functions */
5314
+
5315
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
5316
+ * assemble_trampoline_template to output, on the stream f, assembler code for
5317
+ * a block of data that contains the constant parts of a trampoline.  This code
5318
+ * should not include a label--the label is taken care of automatically.
5319
+ *
5320
+ * ZipCPU -- looks like we need to do this.
5321
+ */
5322
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
5323
+#define        TARGET_ASM_TRAMPOLINE_TEMPLATE  zip_asm_trampoline_template
5324
+
5325
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
5326
+ * is to be placed.  The default value is readonly_data_section.
5327
+ *
5328
+ * ZipCPU--default should be good enough.
5329
+ */
5330
+
5331
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
5332
+ * as an integer.
5333
+ *
5334
+ * ZipCPU--it's three instructions, or 96 bits.  However, 32-bits is our minimal
5335
+ * addressible unit, so what size do we offer here?  We'll stick with the number
5336
+ * of bytes, but we may need to change this later.
5337
+ *
5338
+ */
5339
+// #warning "May need to redefine trampoline_size in words, not bytes"
5340
+#undef TRAMPOLINE_SIZE
5341
+#define        TRAMPOLINE_SIZE 3
5342
+
5343
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
5344
+ *
5345
+ * Well that's well known in ZipCPU --- 32-bits.
5346
+ */
5347
+#undef TRAMPOLINE_ALIGNMENT
5348
+#define        TRAMPOLINE_ALIGNMENT    32
5349
+
5350
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
5351
+ * initialize a trampoline.  m_tramp is an RTX for the memory block for the
5352
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion;  CH is an
5353
+ * rtx for the static chain value that should be passed to the function when
5354
+ * it is called.
5355
+ *
5356
+ * ZipCPU ... Can we get by without this?
5357
+ */
5358
+#undef TARGET_TRAMPOLINE_INIT
5359
+#define        TARGET_TRAMPOLINE_INIT  zip_trampoline_init
5360
+
5361
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
5362
+ * machine-specific adjustment in the address of the trampoline.  Its argument
5363
+ * contains the address of the memory block that was passed to
5364
+ * TARGET_TRAMPOLINE_INIT.  In case the address to be used for a function call
5365
+ * should be different from the address at which the template was stored, the
5366
+ * different address should be returned; otherwise addr should be returned
5367
+ * unchanged.  If the hook is not defined, RTX (addr) will be used for function
5368
+ * calls.
5369
+ *
5370
+ * ZipCPU--works for us!
5371
+ */
5372
+
5373
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
5374
+ * the instruction cache in the specified interval.  The definition of this
5375
+ * macro would typically be a series of asm statements.   Both BEG and END are
5376
+ * pointer expressions.
5377
+ *
5378
+ * ZipCPU --- Ouch!  We have no way to do this (yet)!
5379
+ */
5380
+
5381
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
5382 111 dgisselq
+ * subroutine to do their work.  The macro should expand to a series of asm
5383 102 dgisselq
+ * statements which will be compiled with GCC.  They go in a library function
5384
+ * named __transfer_from_trampoline.
5385
+ *
5386
+ * We may need to rethink trampolines on ZipCPU.
5387
+ */
5388
+
5389
+
5390
+/* 17.12 Implicit Calls to Library Routines */
5391
+
5392
+/* DECLARE_LIBRARY_RENAMES
5393
+ *
5394
+ * ZipCPU: Don't need it.
5395
+ */
5396
+
5397
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
5398
+ * routines or rename existing ones, using the functions set_optab_libfunc and
5399
+ * init_one_libfunc defined in optabs.c.  init_optabs calls this macro after
5400
+ * initializing all the normal library routines.
5401
+ *
5402
+ * Most ports don't need to define this hook, so we won't either.
5403
+ */
5404
+
5405
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
5406
+ * routines start with two underscores.  If set to true, these routines start
5407
+ * with __gnu_ instead.
5408
+ *
5409
+ * ZipCPU: No change necessary.
5410
+ */
5411
+
5412
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
5413
+ * true if the library routine that implements the floating point comparison
5414
+ * operator comparison in mode mode will return a boolean and false if it will
5415
+ * return a tristate.
5416
+ *
5417
+ * Most ports don't need to define this macro, so Zip CPU won't either.
5418
+ */
5419
+
5420
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
5421
+ * hardware divide instructions.  If this macro is defined, GCC will use an
5422
+ * algorithm which makes use of simple logical and arithmetic operations for
5423
+ * 64-bit division.  If the macro is not defined, GCC will use an algorithm
5424
+ * which makes use of a 64-bit by 32-bit divide primitive.
5425
+ *
5426
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
5427
+ * we have no HW DIVIDE (for now).
5428
+ */
5429
+#define        TARGET_HAS_NO_HW_DIVIDE
5430
+
5431
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
5432
+ * expression.  If you don't define this macro, GCC does not attempt to deposit
5433
+ * the value of EDOM into errno directly.  Look in /usr/include/errno.h to find
5434
+ * the value of EDOM on your system.
5435
+ *
5436
+ * EDOM is the error created when a math argument is out of the domain of the
5437
+ * function.
5438
+ *
5439
+ * ZipCPU: Don't need it---I don't think.
5440
+ */
5441
+
5442
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
5443
+ * expression that refers to the global "variable" errno.  (On certain
5444
+ * systems, errno may not actually be a variable.)  If you don't define this
5445
+ * macro, a reasonable default is used.
5446
+ *
5447
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
5448
+ * I doubt we'll be using errno for a while.
5449
+ */
5450
+
5451
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
5452
+ * message sending conventions by default.  This calling convention involves
5453
+ * passing the object, the selector and the method arguments all at once to the
5454
+ * method-lookup library function.  This is the usual setting when targetting
5455
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
5456
+ *
5457
+ * If the macro is set to 0, ...
5458
+ *
5459
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
5460
+ * an O/S yet.
5461
+ */
5462
+
5463
+
5464
+
5465
+/* 17.13 Addressing Modes */
5466
+
5467
+/* C expressions that are nonzero if the machine supports pre-increment,
5468
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
5469
+ */
5470
+#define        HAVE_PRE_INCREMENT      (0)
5471
+#define        HAVE_PRE_DECREMENT      (0)
5472
+#define        HAVE_POST_INCREMENT     (0)
5473
+#define        HAVE_POST_DECREMENT     (0)
5474
+
5475
+/* C expression that is nonzero if the machine supports pre- or post- address
5476
+ * side-effect generation involving constants other than the size of the memory
5477
+ * operand.
5478
+ */
5479
+#define        HAVE_PRE_MODIFY_DISP    (0)
5480
+#define        HAVE_POST_MODIFY_DISP   (0)
5481
+
5482
+/* C expression that is non-zero if the machine supports pre- or post-address
5483
+ * side-effect generation involving a register displacement.
5484
+ */
5485
+#define        HAVE_PRE_MODIFY_REG     (0)
5486
+#define        HAVE_POST_MODIFY_REG    (0)
5487
+
5488
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
5489
+ * which is a valid address.  On most machines the default definition ... is
5490
+ * acceptable, but a few machines are more restrictive as to which constant
5491
+ * addresses are supported.
5492
+ *
5493
+ * Zip CPU is designed for offset addresses, not constant addresses.  Although
5494
+ * the CPU will support 18-bit signed constant addresses, the assembler and
5495
+ * general programming model do not.  Further, without knowing where the final
5496
+ * address will be located, this is an unusable model.  Therefore we will
5497
+ * define this as not supported.
5498
+ *
5499
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
5500
+ * they are also constant addresses.  Hence, we leave this at its default.
5501
+ */
5502
+// #undef      CONSTANT_ADDRESS_P
5503
+// #define     CONSTANT_ADDRESS_P(X)   (0)
5504
+
5505 111 dgisselq
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code,
5506
+ * accepts integer values expressions whose values are not explicitly known,
5507
+ * such as symbol_ref, label_ref, and high expressions and const arithmetic
5508
+ * expressions, in addition to const_int and const_double expressions.
5509 102 dgisselq
+ *
5510
+ * Huh???
5511
+ */
5512
+// #define CONSTANT_P(X) ???
5513
+
5514 111 dgisselq
+/* MAX_REGS_PER_ADDRESS ... A number, the maximum number of registers that can
5515
+ * appear in a valid memory address.  Note that it is up to you to specify a
5516
+ * value equal to the maximum number that TARGET_LEGITIMATE_ADDRESS_P would
5517
+ * ever accept.
5518 102 dgisselq
+ */
5519
+#define        MAX_REGS_PER_ADDRESS    1
5520
+
5521
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
5522
+ * whether RTX is a legitimate memory address on the target machine for a
5523
+ * memory operation of mode MODE.
5524
+ */
5525
+#undef TARGET_LEGITIMATE_ADDRESS_P
5526
+#define TARGET_LEGITIMATE_ADDRESS_P    zip_legitimate_address_p
5527
+
5528
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
5529
+ * default 'm' character for general memory addresses.  This defines the
5530
+ * constraint letter which matches the memory addresses accepted by
5531
+ * TARGET_LEGITIMATE_ADDRESS_P.  Define this macro if you want to support new
5532
+ * address format in your back end without changing the semantics of the 'm'
5533
+ * constraint.  This is necessary in order to preserve functionality of inline
5534
+ * assembly constructs using the 'm' constraint.
5535
+ *
5536
+ * ZipCPU--doesn't look like we need to define this at all.
5537
+ */
5538
+
5539
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
5540
+ * X or to provide a simplified version of X from which alias.c can easily find
5541
+ * the base term.  This macro is used in only two places: find_base_value and
5542
+ * find_base_term in alias.c.
5543
+ *
5544
+ * It is always safe for this macro  to not be defined.  It exists so that
5545
+ * alias analysis can understand machine-dependent addresses.
5546
+ *
5547
+ * ZipCPU: We'll skip this then.
5548
+ */
5549
+
5550
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
5551
+ * memory address RTX for an operand of mode MODE and should try to return a
5552
+ * valid memory address.  RTX will always be the result of a call to
5553
+ * break_out_memory_refs, and OLD will be the operand that was given to that
5554
+ * function to produce RTX.
5555
+ *
5556 111 dgisselq
+ * ZipCPU --
5557 102 dgisselq
+ */
5558 111 dgisselq
+#undef TARGET_LEGITIMIZE_ADDRESS
5559
+#define        TARGET_LEGITIMIZE_ADDRESS       zip_legitimize_address
5560 102 dgisselq
+
5561
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
5562
+ * that attempts to replace X, which is an address that needs reloading, with
5563
+ * a valid memory address for an operand of mode MODE.  WIN will be a C
5564
+ * statement label elsewhere in the code.  It is not necessary to define this
5565
+ * macro, but it might be useful for performance reasons.
5566
+ *
5567
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
5568
+ * may also be a difficult macro to use.  Look at other implementations before
5569
+ * we dive into this.
5570
+ */
5571
+// #undef LEGITIMIZE_RELOAD_ADDRESS
5572
+// #define LEGITIMIZE_RELOAD_ADDRESS
5573
+
5574
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
5575
+ * if memory address addr in address space addrspace can have different meanings
5576
+ * depending on the machine mode of the memory reference it is used for or if
5577
+ * the address is valid for some modes but not others.
5578
+ */
5579
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
5580
+#define        TARGET_MODE_DEPENDENT_ADDRESS_P         zip_mode_dependent_address_p
5581
+
5582 111 dgisselq
+/* TARGET_LEGITIMATE_CONSTANT_P(MODE,RTX) ... This hook returns true if x is a
5583
+ * legitimate constant for a MODE-mode immediate operand on the target machine.
5584
+ * You can assume the RTX satisfies CONSTANT_P, so you need not check this.
5585
+ *
5586
+ * The default definition returns true.
5587 102 dgisselq
+ */
5588
+
5589
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
5590
+ */
5591
+
5592
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
5593
+ * should not be emitted into debug sections.
5594
+ */
5595
+
5596
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
5597
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
5598
+ * MODE is the mode of X.  The default version returns false.
5599
+ */
5600 111 dgisselq
+// #define     TARGET_CANNOT_FORCE_CONST_MEM   hook_bool_mode_rtx_false
5601 102 dgisselq
+
5602
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
5603
+ * if pool entries for constant RTX can be placed in an object_block structure.
5604
+ * MODE is the mode of X.  The default version returns false for all constants.
5605
+ *
5606
+ *????
5607
+ */
5608
+// #warning "Huh?"
5609
+
5610
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
5611
+ * entries for DECL should be placed in an object_block structure.  The default
5612
+ * version returns true for all DECL's.
5613
+ *
5614
+ * Sounds good.
5615
+ */
5616
+
5617
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
5618
+ * function that implements the reciprocal of the machine specific builtin
5619
+ * function fndecl, or NULL_TREE if such a function is not available.
5620
+ */
5621
+
5622
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
5623
+ * DECL of a function f that given an address addr as an argument returns a mask
5624
+ * m that can be used to extrract from two vectors the relevant data that
5625
+ * resides in addr in case addr is not properly aligned.
5626
+ *
5627
+ * Zip CPU does not support vectorization.
5628
+ */
5629
+
5630
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
5631
+ * such data accesses and manipulation.
5632
+ */
5633
+
5634
+/* 17.14 Anchored Addresses */
5635
+
5636
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
5637
+ * a section anchor.  On most targets, it should be the smallest offset that
5638
+ * can be applied to a base register while still giving a legitimate address for
5639
+ * every mode.  The default value is 0.
5640
+ *
5641
+ * On the Zip CPU, this is the minimum operand B offset to a LOD or STO
5642
+ * operation, which would be a signed 14 bit number.
5643
+ */
5644
+#undef TARGET_MIN_ANCHOR_OFFSET
5645
+#define TARGET_MIN_ANCHOR_OFFSET       zip_min_anchor_offset
5646
+
5647
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
5648
+ * (inclusive) offset that should be applied to section anchors.  The default
5649
+ * value is 0.
5650
+ */
5651
+#undef TARGET_MAX_ANCHOR_OFFSET
5652
+#define TARGET_MAX_ANCHOR_OFFSET       zip_max_anchor_offset
5653
+
5654
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
5655
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
5656
+ * true.  The hook is called with the assembly output position set to the
5657
+ * beginning of SYMBOL_REF_BLOCK(X).
5658
+ *
5659
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
5660
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'.  If ASM_OUTPUT_DEF
5661
+ * is not available, the hook's default definition is NULL, which disables the
5662
+ * use of section anchors altogether.
5663
+ *
5664
+ * Section anchors will be very valuable in Zip CPU assembly, therefore we
5665
+ * must define this hook.
5666
+ */
5667
+// #undef      TARGET_ASM_OUTPUT_ANCHOR
5668
+// #define     TARGET_ASM_OUTPUT_ANCHOR        zip_asm_output_anchor
5669
+
5670
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
5671
+ * to use anchors to access SYMBOL_REF X.  You can assume SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
5672
+ *
5673
+ * 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.
5674
+ *
5675
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
5676
+ */
5677
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
5678
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P     zip_use_anchors_for_symbol_p
5679
+
5680
+/* 17.15 Condition Code Status */
5681
+
5682
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
5683
+
5684
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
5685
+ * the mdep component of cc_status.  It defaults to int.
5686
+ *
5687
+ * ZipCPU---Int is good for us.
5688
+ */
5689
+
5690
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
5691
+ * "empty".  The default definition does nothing, since most machines don't
5692
+ * use the field anyway.  If you want to use the field, you should probably
5693
+ * define  this macro to initialize it.
5694
+ */
5695
+
5696
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
5697
+ * of cc_status appropriately for an insn insn whose body is exp.  It is this
5698
+ * macro's responsibility to recognize insns that set the condition code as
5699
+ * a byproduct of other activity as well as those that explicitly set (cc0).
5700
+ *
5701
+ * ZipCPU --- We need this, as not all expressions set (cc0).
5702
+ *
5703
+ */
5704 122 dgisselq
+#ifdef HAVE_cc0
5705 102 dgisselq
+#define        NOTICE_UPDATE_CC(EXP, INSN)     zip_update_cc_notice(EXP, INSN)
5706 122 dgisselq
+#endif
5707 102 dgisselq
+
5708
+
5709
+/* 17.15.2 Representation of condition codes using registers */
5710
+/* ... which the ZipCPU doesn't have.  The ZipCPU has a CC0 register, and hence
5711
+ * this section isn't supposed to apply.
5712
+ */
5713
+
5714 122 dgisselq
+/* SELECT_CC_MODE(op, x, y) ... On many machines, the condition code may be
5715
+ * produced by other instructions than compares, for example the branch can use
5716
+ * directyl the condition code set by a subtract instruction.  However, on some
5717
+ * machines when the condition code is set this way some bits (such as the
5718
+ * overflow bit) are not set in the same way as a test instruction, so that a
5719
+ * different branch instruction must be used for some conditional branches.
5720
+ * When this happens, use the machinemode of the condition code register to
5721
+ * record different formats of the condition code register.  Modes can also be
5722
+ * used to reccord which compare instruction (e.g. a signed or an unsigned
5723
+ * comparison) produced the condition codes.
5724
+ *
5725
+ * If other modes than CCmode are required, add them to 'machine-modes.def' and
5726
+ * define SELECT_CC_MODE to choose a mode given an operand of a compare.  This
5727
+ * is needed because the modes have to be chosen not only during RTL generation
5728
+ * but also, for example, by instruction combination.  The result of
5729
+ * SELECT_CC_MODE should be consistent with the mode used in the patterns; ...
5730
+ *
5731
+ * ZipCPU ... We have only one CC Mode, so we'll use the CCmode defined in
5732
+ * machine-modes.def and should be fine with it.  Hence, this doesn't need
5733
+ * to be defined.
5734 102 dgisselq
+ */
5735
+
5736
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
5737
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
5738
+ * convert an invalid comparison into a valid one.  For example, the Alpha
5739
+ * does not have a GT comparison, but you can use an LT comparison instead and
5740
+ * swap the order of the operands.
5741
+ *
5742
+ * On such machines, implement this hook to do any required conversions:  code
5743
+ * is the initial comparison code and op0 and op1 are the left and right
5744
+ * operands of the comparison, respectively.  If op0_preserve_value is true the
5745
+ * implementation is not allowed to change the value of op0 since the value
5746
+ * might be used in RTXs which aren't comparisons.  E.g. the implementation is
5747
+ * not allowed to swap operands in that case.
5748
+ *
5749
+ * GCC will not assume that the comparison resulting from this macro is valid
5750
+ * but will see if the resulting insn matches a pattern in the 'md' file.
5751
+ *
5752
+ * You need not implement this hook if it would never change the comparison
5753
+ * code or operands.
5754
+ *
5755
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
5756
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
5757
+ * painful.  Therefore, we *need* this capability to make certain we can use
5758
+ * our comparisons successfully.
5759
+ *
5760
+ * The only problem is ... this hook appears to only be called on non-CC0
5761
+ * machines.  Hence, defining it hasn't done anything for us.
5762
+ */
5763 122 dgisselq
+#define        TARGET_CANONICALIZE_COMPARISON  zip_canonicalize_comparison
5764 102 dgisselq
+
5765 122 dgisselq
+/* REVERSIBLE_CC_MODE(MODE) ... A C expression whose value is one if it is
5766
+ * always safe to reverse a comparison whose mode is MODE.  If SELECT_CC_MODE
5767
+ * can ever return MODE for a floating-point inequality comparison, than
5768
+ * REVERSIBLE_CC_MODE(MODE) must be zero.
5769
+ *
5770
+ * You need not define this macro if it would always return zero or if the
5771
+ * floating-point format is anything other than IEEE_FLOAT_FORMAT.  For example,
5772
+ * here ...
5773
+ *
5774
+ * ZipCPU -- We'll always return zero, so this need not be defined.
5775
+ */
5776
+
5777
+/* REVERSE_CONDITION(CODE,MODE) ... A C expression whose value is reversed
5778
+ * condition code of thecode for comparison done in CC_MODE MODE.  This macro
5779
+ * is used only in case REVERSIBLE_CC_MODE(MODE) is nonzero. ...
5780
+ *
5781
+ * ZipCPU ... Since REVERSIBLE_CC_MODE(MODE) will always be zero, we'll leave
5782
+ * this undefined.
5783
+ */
5784
+
5785
+/* bool TARGET_FIXED_CONDITION_CODE_REGS(int *, int *) ... On targets which do
5786
+ * not use (cc0), and which use a hard register rather than a pseudo-register
5787
+ * to hold condition codes, the regular CSE passes are often not able to
5788
+ * identify cases in which the hard register is set to a common value.  Use this
5789
+ * hook to enable a small pass which optimizes such cases.  This hook should
5790
+ * return true to enable this pass, and it should set the integers to which its
5791
+ * arguments point to the hard register numbers used for condition codes.  When
5792
+ * there is only one such register, as is true on most systems, the integer
5793
+ * pointed to by p2 should  be set to INVALID_REGNUM.
5794
+ *
5795
+ * The default version of this hook returns false.
5796
+ *
5797
+ * ZipCPU --- I like the idea of enabling optimizations.  Let's return
5798
+ * something other than false.
5799
+ */
5800
+#define        TARGET_FIXED_CONDITION_CODE_REGS        zip_fixed_condition_code_regs
5801
+
5802
+/* machine_mode TARGET_CC_MODES_COMPATIBLE(M1,M2) .. On targets which use
5803
+ * multiple condition code modes in class MODE_CC, it is sometimes the case
5804
+ * that a comparison can be validly done in more than one mode.  On such a
5805
+ * system, define this target hook to take two mode arguments and to return a
5806
+ * mode in which both comparisons may be validly done.  If there is no such
5807
+ * mode, return VOIDmode.
5808
+ *
5809
+ * The default version of this hook checks whether the modes are the same.  If
5810
+ * they are, it returns that mode.  If they are different, it returns VOIDmode.
5811
+ *
5812
+ * ZipCPU--Given that we only have the one CCmode, the default definition works
5813
+ * well enough for us.
5814
+ */
5815
+
5816
+/* unsigned int TARGET_FLAGS_REGNUM ... If the target has a dedicated flags
5817
+ * register, and it needs to use the post-reload comparison elimination pass,
5818
+ * then this value should be set appropriately.
5819
+ *
5820
+ * ZipCPU---Looks like we can set this easily enough without any problems.
5821
+ */
5822
+#undef TARGET_FLAGS_REGNUM
5823
+#define        TARGET_FLAGS_REGNUM     zip_CC
5824
+
5825 102 dgisselq
+/* 17.16 Relative costs of operations */
5826
+
5827
+
5828
+// #define     REGISTER_MOVE_COST(MODE,FROM,TO)        ((MODE==DImode)||(MODE==DFmode))?4:2
5829
+// #define     TARGET_REGISTER_MOVE_COST
5830
+// #define     MEMORY_MOVE_COST(MODE, CLASS, IN)       ((MODE==DImode)||(MODE==DFmode))?8:7
5831
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
5832
+ * cost of moving data of mode M from a register in class FRM to one in class
5833
+ * TO.  The classes are expressed using the enumeration values such as
5834
+ * GENERAL_REGS.  A value of 2 is the default; other values are interpreted
5835
+ * relative to that.
5836
+ *
5837
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
5838
+ * on some machines it is expensive to move between registers if they are not
5839
+ * general registers.
5840
+ *
5841
+ * If reload sees ...
5842
+ *
5843
+ * ZipCPU ... We can leave this at its default value of 2.
5844
+ */
5845
+
5846
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
5847
+ * cost of moving data of mode MOD between a register of class CL and memory.
5848
+ * IN is false if the value is to be written to memory, true if it is to be
5849
+ * read in.  This cost is relative to those in TARGET_REGISTER_MOVE_COST.
5850
+ * If moving between registers and memory is more expensive that between two
5851
+ * registers, you should add this target hook to express the relative cost.
5852
+ *
5853
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
5854
+ * cost of copying via a secondary reload register, if one is needed.  If your
5855
+ * machine requires a secondary reload register to copy between memory and a
5856
+ * register of CL but the reload mechanism is more complex than copying via
5857
+ * an intermediate, use this target hook to reflect the actual cost of the
5858
+ * move.
5859
+ *
5860
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
5861
+ * moves, so let's make certain this is defined.
5862
+ */
5863
+#define        TARGET_MEMORY_MOVE_COST zip_memory_move_cost
5864
+
5865
+// #warning "This needs to be double checked, and annotated"
5866 111 dgisselq
+#define        BRANCH_COST(SPEED,PREDICTABLE)          ((PREDICTABLE)?2:5)
5867 102 dgisselq
+
5868
+/* Define this macro as a C expression which is nonzero if accessing less than
5869
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
5870
+ * a word of memory.
5871
+ */
5872
+#define        SLOW_BYTE_ACCESS        1
5873
+
5874
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
5875
+ * instructions, below which a sequence of instructions should be generated
5876
+ * instead of a string move instruction or a library call.  Increasing the
5877
+ * value will always make code faster, but eventually incurs high cost in
5878
+ * increased code size.
5879
+ */
5880
+#define        MOVE_RATIO(SPD) 5
5881
+
5882
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
5883
+ */
5884
+// #undef      TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
5885
+// #define     TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
5886
+
5887
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
5888
+ * which a sequence of instructions should be generated to clear memory instead
5889
+ * of a string clear instruction or a library call.  Increasing the value will
5890
+ * always make the code faster, but eventually incurs high cost in increased
5891
+ * code size.
5892
+ */
5893
+#define        CLEAR_RATIO(SPD)        MOVE_RATIO(SPD)
5894
+
5895
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
5896
+ * to call a constant function address than to call an address kept in a
5897
+ * register.
5898
+ *
5899
+ * On the Zip CPU, constant function addresses--especially relative ones,
5900
+ * can be optimized into a single cycle delay.  Register jumps will always
5901
+ * stall the whole (5-stage) pipeline.
5902
+ */
5903
+#define        NO_FUNCTION_CSE
5904
+
5905 111 dgisselq
+/* TARGET_RTX_COSTS(X,CODE,OUTER,OPNO,TOTAL,SPD) ... This target hook describes
5906
+ * the relative costs of RTL expressions.
5907
+ *
5908
+ * The cost may depend on the precise form of the expression, which is avaialble
5909
+ * for examination in X, and the fact that X appears as operand OPNO of an
5910
+ * expression with rtx code OUTER.  That is, the hook can assume that there is
5911
+ * some RTX Y such that GET_CODE(Y)==OUTER and such that either (a) XEXP(Y,OPNO)
5912
+ * == X or (b) XVEC(Y,OPNO) contains X.
5913
+ *
5914
+ * ...
5915
+ * The hook returns true when all subexpressions of x have been processed and
5916
+ * false when rtx_cost should recurse.
5917 102 dgisselq
+ */
5918 111 dgisselq
+
5919 102 dgisselq
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
5920
+ * addressing mode that contains ADDR.  If not defined, the cost is computed
5921
+ * from the ADDR expression and the TARGET_RTX_COST hook.  In cases where more
5922
+ * than one form of an address is known, the form with the lowest cost will be
5923
+ * used.  If multiple forms have the same, lowest, cost, the one that is the
5924
+ * most complex will be used.
5925
+ *
5926
+ * ZipCPU really has only one address cost, the only type of address it
5927
+ * supports.  Sure, index addressing would cost us more, but we don't support
5928
+ * that so ... I think we're okay defining this as a constant.  Indeed, the
5929
+ * docs state that, "On RISC amchines, all instructions normally have the same
5930
+ * length and execution time.  Hence all addresses will have equal costs."
5931
+ */
5932
+#undef TARGET_ADDRESS_COST
5933
+#define        TARGET_ADDRESS_COST     zip_address_cost
5934
+
5935
+
5936
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
5937
+ * of the eager delay slot filler to disallow speculatively executed
5938
+ * instructions being placed in delay slots.  Targets such as certain MIPS
5939
+ * architectures posess both branches with and without delay slots.  As the
5940
+ * eager delay slot filler can decrease performance, disabling it is beneficial
5941
+ * when ordinary branches are available.  Use of delay slot branches filled
5942
+ * using basic filler is often still desirable as the delay slot can hide a
5943
+ * pipeline bubble.
5944
+ */
5945
+// How should Zip CPU define this--we have no delay slots.
5946
+
5947
+
5948
+/* 17.17 Instruction Scheduler */
5949
+
5950
+#define        TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
5951
+
5952
+/* 17.18 Dividing the Output into Sections */
5953
+
5954
+/* Switch to the text or data segment. */
5955
+#define        TEXT_SECTION_ASM_OP     "\t.text"
5956
+#define        DATA_SECTION_ASM_OP     "\t.data"
5957
+
5958
+// #undef      TARGET_LIBGCC_SDATA_SECTION
5959
+// #define     TARGET_LIBGCC_SDATA_SECTION     ".sdata"
5960
+
5961
+
5962
+/* 17.19 Position Independent Code */
5963
+
5964
+#define        PIC_OFFSET_TABLE_REGNUM                 zip_GOT
5965
+#define        PIC_OFFSET_TABLE_REG_CALL_CLOBBERED     0
5966
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
5967
+
5968
+/* 17.20 Defining the Output Assembler Language */
5969
+
5970
+/* 17.20.4 Output and Generation of Labels */
5971
+
5972
+/* ASM_OUTPUT_LABEL
5973
+ * ... A default definition of this macro is provided which is correct for
5974
+ * most systems.
5975
+ */
5976
+
5977
+/* ASM_OUTPUT_FUNCTION_LABEL
5978
+ * ... if not defined, then the function name is defined in the usual manner
5979
+ * as a label.
5980
+ */
5981
+
5982
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
5983
+ * is known to refer to a compiler-generated label.  The default definition
5984
+ * uses assemble_name_raw, which is like assemble_name except that it is more
5985
+ * efficient.
5986
+ */
5987
+
5988
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
5989
+ * to specify the size of a symbol, without any arguments.  ON systems that
5990
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
5991
+ * define this macro.
5992
+ *
5993
+ * Define this amcro only if it is correct to use the default definitions of
5994
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
5995
+ * If you need your own custom definitions of those macros, or if you do not
5996
+ * need explicit symbol sizes at all, do not define this macro.
5997
+ */
5998
+
5999
+/* ASM_OUTPUT_SIZE_DIRECTIVE
6000
+ * ASM_OUTPUT_MEASURED_SIZE
6001
+ */
6002
+
6003
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
6004
+ * the character '$' in label names.  By default constructors and destructors
6005
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
6006
+ * used instead.
6007
+ */
6008
+
6009
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
6010
+ * character '.' in label names.  By default constructors and destructors in
6011
+ * G++ have names that use '.'.  If this macro is defined, these names are
6012
+ * rewritten to avoid '.'.
6013
+ */
6014
+
6015
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
6016
+ * specify the type of a symbol, without any arguments.  On systems that use
6017
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
6018
+ *
6019
+ * Define this macro only if it is correct to use the default definition of
6020
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
6021
+ * definition of this macr, or if you do not need explicit symbol types at all,
6022
+ * do not define this macro.
6023
+ */
6024
+
6025
+/* TYPE OPERAND_FMD ... A
6026
+ */
6027
+
6028
+/* ASM_OUTPUT_TYPE_DIRECTIVE
6029
+ */
6030
+
6031
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
6032
+ * if this macro is not defined, then the function name is defined in the usual
6033
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
6034
+ */
6035
+
6036
+/* ASM_DECLARE_FUNCTION_SIZE
6037
+ * ASM_DECLARE_COLD_FUNCTION_NAME
6038
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
6039
+ * ASM_DECLARE_OBJECT_NAME
6040
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
6041
+ */
6042
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
6043
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
6044
+ * claiming a register REGNO for a global variable DECL with name NAME.
6045
+ *
6046
+ * If you don't defin this macro, that is equivalent to dfining it to do
6047
+ * nothing.
6048
+ */
6049
+
6050
+/* ASM_FINISH_DECLARE_OBJECT
6051
+ * TARGET_ASM_GLOBALIZE_LABEL
6052
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
6053
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
6054
+ * ASM_WEAKEN_LABEL
6055
+ * ASM_WEAKEN_DECL
6056
+ * ASM_OUTPUT_WEAKREF
6057
+ * SUPPORTS_WEAK
6058
+ * TARGET_SUPPORTS_WEAK
6059
+ * MAKE_DECL_ONE_ONLY
6060
+ * SUPPORTS_ONE_ONLY
6061
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
6062
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
6063
+ * ASM_OUTPUT_EXTERNAL
6064
+ * TARGET_ASM_EXTERNAL_LIBCALL
6065
+ * TARGET_ASM_MARK_DECLPRESERVED
6066
+ * ASM_OUTPUT_LABELREF
6067
+ * TARGET_MANGLE_ASSEMBLER_NAME
6068
+ * ASM_OUTPUT_SYMBOL_REF
6069
+ * ASM_OUTPUT_LABEL_REF
6070
+ * TARGET_ASM_INTERNAL_LABEL
6071
+ * ASM_OUTPUT_DEBUG_LABEL
6072
+ * ASM_GENERATE_INTERNAL_LABEL
6073
+ * ASM_FORMAT_PRIVATE_NAME
6074
+ */
6075
+
6076
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
6077
+ * assembler code which defines (equates) the symbol NAME to have the value
6078
+ * VALUE.
6079
+ *
6080
+ * ZipCPU---So many other things that we need depend upon this, that we need
6081
+ * to implement a non-default version.
6082
+ */
6083
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
6084
+
6085
+/* ASM_OUTPUT_DEF_FROM_DECLS
6086
+ * TARGET_DEFERRED_OUTPUT_DEFS
6087
+ * ASM_OUTPUT_WEAK_ALIAS
6088
+ * OBJ_GEN_METHOD_LABEL
6089
+ */
6090
+
6091
+
6092
+/* 17.20.7 Output of Assembler Instructions */
6093
+
6094
+#define        REGISTER_NAMES { "R0","R1","R2","R3","R4","R5","R6","R7","R8","R9", \
6095
+       "R10","R11","R12","SP","CC","PC" }
6096
+
6097
+/* REGISTER_PREFIX     (Undefined by default)
6098
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
6099
+ * USER_LABEL_PREFIX   defaults to "*"
6100
+ * IMMEDIATE_PREFIX    (Undefined by default)
6101
+ *
6102
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
6103
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
6104
+ * 'md' file must support multiple assembler formats.  In that case, the various
6105
+ * 'tm.h' files can define these macros differently.
6106
+ */
6107
+// #define     USER_LABEL_PREFIX       "*"
6108
+
6109
+/* Defining memory operand address formats is in this section. */
6110
+
6111
+/* 17.20.10 Assembler Commands for Alignment */
6112
+
6113
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
6114
+ * which is a common destination of jumps and has no fallthru incoming
6115
+ * edge.  This macro need not be defined if you don't want any special alignment
6116
+ * to be done at such a time.  Most machine descriptions do not currently define
6117
+ * this macro.
6118
+ *
6119
+ * ZipCPU---The assembler should automatically deal with label alignment, so
6120
+ * let's not do anything about it here.
6121
+ */
6122
+
6123
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
6124
+ */
6125
+
6126
+/* LABEL_ALIGN_AFTER_BARRIER
6127
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
6128
+ */
6129
+
6130
+/* LOOP_ALIGN(label)
6131
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
6132
+ * LABEL_ALIGN
6133
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
6134
+ */
6135
+
6136
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
6137
+ * stream an assembler instruction to advance the location counter by nbytes
6138
+ * bytes.
6139
+ */
6140
+
6141
+/* TARGET_ASM_LABEL_ALIGN */
6142
+/* Assembler Commands for Alignment */
6143
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
6144 127 dgisselq
+       { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
6145 102 dgisselq
+
6146
+
6147
+
6148
+/* 17.21 Controlling Debugging Information Format */
6149
+/* 17.22 Cross Compilation and Floating Point */
6150 111 dgisselq
+
6151
+// REAL_VALUE_TYPE
6152
+// REAL_VALUES_EQUAL
6153
+// REAL_VALUES_LESS ... Tess whether x is less than y
6154
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
6155
+ * If x is negative, returns zero.
6156
+ */
6157
+// REAL_VALUE_ATOF
6158
+// REAL_VALUE_NEGATIVE
6159
+// REAL_VALUE_ISINF
6160
+// REAL_VALUE_ISNAN
6161
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
6162
+ * on two floating point values X and Y, storing the result in OUT (which must
6163
+ * be a variable).
6164
+ *
6165
+ * The operation to be performed is specified by CODE.  Only the following
6166
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
6167
+ * MIN_EXPR.
6168
+ *
6169
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
6170
+ * floating point format cannot represent infinity, it will call abort().
6171
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
6172
+ */
6173
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
6174
+ * value X.
6175
+ */
6176
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
6177
+ */
6178 102 dgisselq
+/* 17.23 Mode switching instructions */
6179
+/* 17.24 Defining target-specific uses of __attribute__ */
6180
+#undef TARGET_OPTION_OVERRIDE
6181
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
6182
+
6183
+/* 17.25 Emulating TLS */
6184
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
6185
+
6186
+ // ZipCPU isn't MIPS.
6187
+
6188
+/* 17.27 Parameters for Precompiled Header Validity Checking */
6189
+/* 17.28 C++ ABI parameters */
6190
+/* 17.29 Adding support for named address spaces */
6191
+/* 17.30 Miscellaneous Parameters */
6192
+
6193
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
6194
+ * not your architecture has conditional branches that can span all of memory.
6195
+ * It is used in conjunction with an optimization that partitions hot and
6196
+ * cold basic blocks into separate sections of the executable.  If this macro
6197
+ * is set to false, gcc will convert any conditional branches that attempt to
6198
+ * cross between sections into unconditional branches or indirect jumps.
6199
+ *
6200
+ * ZipCPU --- The assembler renders long unconditional branch code without
6201
+ * problems, so we can pretend that such long branches exist.
6202
+ */
6203
+#define        HAS_LONG_COND_BRANCH true
6204
+
6205
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
6206
+ * or not your architecture has unconditional branches that can span all of
6207
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
6208
+ * conjunction with an optimization that partitions hot and cold basic blocks
6209
+ * into separate sections of the executable.  If this macro is set to false,
6210
+ * gcc will convert any unconditional branches that attempt to cross between
6211
+ * sections into indirect jumps.
6212
+ *
6213
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
6214
+ * jump.
6215
+ */
6216
+#define        HAS_LONG_UNCOND_BRANCH  true
6217
+
6218
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
6219
+ * mode that eleemnts of a jump-table should have.
6220
+ *
6221
+ */
6222
+#define        CASE_VECTOR_MODE        SImode
6223
+
6224
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
6225
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
6226
+ * If you define this, it enables extra code in branch shortening to deal with
6227
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
6228
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
6229
+ *
6230
+ * ZipCPU---No advantage here.
6231
+ */
6232
+
6233
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
6234
+ * jump-tables should contain relative addresses.  You need not define this
6235
+ * macro if jump-tables never contain relative addresses, or jump-tables
6236
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
6237
+ *
6238
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
6239
+ * code.
6240
+ */
6241
+
6242
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
6243
+ * number of different values for which it is best to use a jump-table instead
6244
+ * of a tree of conditional branches.  The default is four for machines with a
6245
+ * casesi instruction and five otherwise.  This is best for most machines.
6246
+ *
6247
+ * ZipCPU---Leave at the default.
6248
+ */
6249
+
6250
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
6251
+ * registers with integral mode smaller than a word are always performed on the
6252
+ * entire register.  Most RISC machines have this property and most CISC
6253
+ * machines do not.
6254
+ *
6255
+ * ZipCPU---We have the property, 'cause we're fairly risk.
6256
+ */
6257
+#undef WORD_REGISTER_OPERATIONS
6258
+#define        WORD_REGISTER_OPERATIONS        1
6259
+
6260
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
6261
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
6262
+ * word, set the bits outside of MEMMODE to be either the sign extension or
6263
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
6264
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
6265
+ * UNKNOWN for other modes.
6266
+ *
6267
+ * Do not define this macro if it would always return UNKNOWN.
6268
+ *
6269
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
6270
+ */
6271
+#undef LOAD_EXTEND_OP
6272
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
6273
+
6274
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
6275
+ *
6276
+ * ZipCPU---All immediates are sign extended, so yes.
6277
+ */
6278
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
6279
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
6280
+
6281
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
6282
+ */
6283
+
6284
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
6285
+ * quickly between memory and registers or between two memory locations.
6286
+ *
6287
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
6288
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
6289
+ * Therefore, this is defined to be one.
6290
+ */
6291
+#define        MOVE_MAX        1
6292
+
6293
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
6294
+ * move quickly between memory and registers or between two memory ...
6295
+ *
6296
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
6297
+ * definition of this.
6298
+ */
6299
+
6300
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
6301
+ * the number of bits actually used for the count of a shift operation is equal
6302
+ * to the number of bits needed to represent the size of the object being
6303
+ * shifted.
6304
+ *
6305
+ * You need not define this macro if it would have the value of zero.
6306
+ *
6307
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
6308
+ * value in the register, therefore this value should be zero, the default.
6309
+ */
6310
+
6311
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
6312
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
6313
+ * more than the width of the mode.
6314
+ *
6315
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
6316
+ * This is the case for the ZipCPU as well.
6317
+ */
6318
+
6319
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
6320
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
6321
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
6322
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
6323
+ *
6324
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
6325
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
6326
+ */
6327
+#undef TRULY_NOOP_TRUNCATION
6328
+#define TRULY_NOOP_TRUNCATION(O,I)     1
6329
+
6330
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
6331
+ * mode can be such that the values are always extended to a wider integral
6332
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
6333
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
6334
+ * use zero-extended.
6335
+ *
6336
+ */
6337
+// #undef      TARGET_MODE_REP_EXTENDED
6338
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
6339
+
6340
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
6341
+ * comparison operator with an integral mode and stored by a store-flag
6342
+ * instruction (cstoremode4) when the condition is true.  This description
6343
+ * must apply to all the cstoremode4 patterns and all the comparison operators
6344
+ * whose results have MODE_INT mode.
6345
+ *
6346
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
6347
+ */
6348
+
6349
+/* FLOAT_STORE_FLAG_VALUE
6350
+ *
6351
+ * ZipCPU
6352
+ */
6353
+
6354
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
6355
+ * comparison operations that return a vector result ...
6356
+ *
6357
+ * ZipCPU---Doesn't support vector operations.
6358
+ */
6359
+
6360
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6361
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6362
+ *
6363
+ * A C expression that indicates whetther the architecture defines a value for
6364
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
6365
+ * 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
6366
+ * entry, then the macro should evaluate to 2.  In cases where the value is
6367
+ * defined, value should be set to this value.
6368
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
6369
+ * be undefined.
6370
+ *
6371
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
6372
+ */
6373
+
6374
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
6375
+ * define this to be the integer mode corresponding to the width of a
6376
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
6377
+ * On some machines you must define this to be one of the partial
6378
+ * integer modes, such as PSImode.
6379
+ */
6380
+#undef Pmode
6381
+#define        Pmode   SImode
6382
+
6383
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
6384
+ * function being called, in call RTL expressions.  On most CISC machines, where
6385
+ * an instruction can begin at any byte address, this should be QImode.  On most
6386
+ * RISC machines, where all instructions have fixed size and alignment, this
6387
+ * should be a mode with the same size and alignment as the machine instruction
6388
+ * words--typically SImode or HImode.
6389
+ *
6390
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
6391
+ * addresses on the ZipCPU.
6392
+ */
6393
+#undef FUNCTION_MODE
6394
+#define        FUNCTION_MODE   SImode
6395
+
6396
+/* STDC_0_IN_SYSTEM_HEADERS
6397
+ */
6398
+
6399
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
6400
+ * file to be included at the start of all compilations, as if it had been
6401
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
6402
+ * or if the header is not found, or if the user specifies -ffreestanding or
6403
+ * -nostdinc, no header is included.
6404
+ *
6405
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
6406
+ * as NULL.
6407
+ */
6408
+#undef TARGET_C_PREINCLUDE
6409
+#define        TARGET_C_PREINCLUDE     NULL
6410
+
6411
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
6412
+ * specific C++ implicit extern C functions.  If this function returns true
6413
+ * for the name of a file-scope function, that function implicitly gets extern
6414
+ * "C" linkage rather than whatever linkage the declaration would normally have.
6415
+ * An example of such function is WinMain on Win32 targets.
6416
+ *
6417
+ * ZipCPU---Not ready to deal with this yet.
6418
+ */
6419
+
6420
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
6421
+ * support C++ as well as C.  This macro inhibits the usual method of using
6422
+ * system header files in C++, which is to pretend that the file's contents
6423
+ * are enclosed in 'extern "C" {...}'.
6424
+ *
6425
+ *
6426
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
6427
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
6428
+ */
6429
+
6430
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
6431
+ * target specific pragmas.
6432
+ *
6433
+ * ZipCPU --- let's not.
6434
+ */
6435
+
6436
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
6437
+ * expanded in the arguments of #pragma pack().
6438
+ *
6439
+ * ZipCPU ... why?
6440
+ */
6441
+
6442
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
6443
+ * default other than 0 (meaning the machine default), define this macro to
6444
+ * the necessary value (in bytes).  This must be a value that would also be
6445
+ * valid to use with #pragma pack() (that is a small power of two.
6446
+ */
6447
+
6448
+/* DOLLARS_IN_IDENTIFIERS
6449
+ * ZipCPU --- Default (not changing C)
6450
+ */
6451
+
6452
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
6453
+ * is nonzero if it is safe for the delay slot schedule to place instructions
6454
+ * in the delay slot of INSN, even if they appear to use a resource set or
6455
+ * clobbered in INSN.  INSN is always a ...
6456
+ *
6457
+ * ZipCPU --- You need not define this macro if it would always return zero.
6458
+ */
6459
+
6460
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
6461
+ * that is nonzero if it is safe for the delay slot schedule to place
6462
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
6463
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
6464
+ * machines where some insn or jump_insn is really a function call and ...
6465
+ *
6466
+ * ZipCPU --- You need not define this macro if it would always return zero.
6467
+ */
6468
+
6469
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
6470
+ * nonzero if, in some cases, global symbols from one translation unit may not
6471
+ * be bound to undefined symbols in another translation unit without user
6472
+ * intervention.  For instance, under Microsoft Windows symbols must be
6473
+ * explicitly imported from shared libraries (DLLs).
6474
+ *
6475
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
6476
+ * so we won't.
6477
+ */
6478
+
6479
+/* TARGET_MD_ASM_ADJUST
6480
+ */
6481
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6482
+ * define this macro if the default of "m" is wrong.
6483
+ *
6484
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6485
+ * works doesn't sound like a problem.  Let's not define this.
6486
+ */
6487
+
6488
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6489
+ * variable that specifies where the linker should look for libraries.
6490
+ *
6491
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6492
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6493
+ * libraries.
6494
+ */
6495
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6496
+
6497
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6498
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6499
+ *
6500
+ * ZipCPU does not.
6501
+ */
6502
+
6503
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6504
+ * instructions to execute via conditional execution instructions instead of a
6505
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6506
+ * cc0 and 1 if it does use cc0.
6507
+ *
6508
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6509
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6510
+ * something else, so let's keep looking into this.
6511
+ */
6512
+
6513
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6514 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6515 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6516
+ * structure, struct ce_if_block, which contains information about the currently
6517
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6518
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6519
+ * or FALSE to a null pointer if the tests cannot be converted.
6520
+ *
6521
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6522
+ * execution and conditional testing capabilities.
6523
+ */
6524 122 dgisselq
+#define        IFCVT_MODIFY_TESTS(CI,TR,FL)    zip_ifcvt_modify_tests(CI,&TR,&FL)
6525 102 dgisselq
+
6526
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6527
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6528
+ * into conditions combined by and and or operations.  BB contains the basic
6529
+ * block that contains the test that is currently being processed and about to
6530
+ * be turned into a condition.
6531
+ *
6532
+ *
6533
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6534
+ * execution and conditional testing capabilities.
6535
+ */
6536
+// #warning "Need to come back to this."
6537 122 dgisselq
+#define        IFCVT_MODIFY_MULTIPLE_TESTS(CI,BB,TR,FL) TR=NULL_RTX
6538 102 dgisselq
+
6539
+
6540
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6541
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6542
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6543
+ * information about the currently processed blocks.
6544
+ *
6545
+ *
6546
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6547
+ * execution and conditional testing capabilities.
6548
+ */
6549 142 dgisselq
+#define        IFCVT_MODIFY_INSN(CE,PATRN,INSN) zip_ifcvt_modify_insn(CE,PATRN,INSN)
6550 102 dgisselq
+
6551
+
6552
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6553
+ * machine dependent modifications in converting code to conditional
6554
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6555
+ * structure pointed to be CEINFO.
6556
+ *
6557
+ *
6558
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6559
+ * execution and conditional testing capabilities.
6560
+ */
6561
+// #warning "Need to come back to this."
6562 122 dgisselq
+#define        IFCVT_MODIFY_FINAL(CEINFO)      zip_ifcvt_modify_final(CEINFO)
6563 102 dgisselq
+
6564
+
6565
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6566
+ * dependent modifications in converting code to conditional execution.  The
6567
+ * involved basic blocks can be found in the struct ce_if_block structure that
6568
+ * is pointed to by CEINFO.
6569
+ *
6570
+ *
6571
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6572
+ * execution and conditional testing capabilities.
6573
+ */
6574
+// #warning "Need to come back to this."
6575 122 dgisselq
+#define        IFCVT_MODIFY_CANCEL(CEINFO)     zip_ifcvt_modify_cancel(CEINFO)
6576 102 dgisselq
+
6577
+
6578
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6579
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6580
+ * that is pointed by CEINFO.
6581
+ *
6582
+ *
6583
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6584
+ * execution and conditional testing capabilities.
6585
+ */
6586
+// #warning "Need to come back to this."
6587 122 dgisselq
+#define        IFCVT_MACHDEP_INIT(CEINFO)      zip_ifcvt_machdep_init(CEINFO)
6588 102 dgisselq
+
6589
+
6590
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6591
+ * target specific pass over the instruction stream.  The compiler will run it
6592
+ * at all optimization levels, just before the point at which it normally does
6593
+ * delayed branch scheduling.
6594
+ *
6595
+ * You need not implement the hook if it has nothing to do.
6596
+ *
6597
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6598
+ * just get us started.
6599
+ */
6600
+
6601
+
6602
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6603
+ * specific builtin functions that need to be defined.  It should be a function
6604
+ * that performs the necessary setup.  Machine specific builtin functions can be
6605
+ * useful to expand special machine instructions that would otherwise not
6606
+ * normally be generated because they have no equivalent in the source language.
6607
+ *
6608
+ * To create a built in function, call the function lang_hooks.builtin_function
6609
+ * which is defined by the language front end.  You can use any type nodes
6610
+ * set up by build_common_tree_nodes; only language front ends that use those
6611
+ * two functions will call "TARGET_INIT_BUILTINS".
6612
+ *
6613
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6614
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6615
+ * restore_context(cstackregno).
6616
+ *
6617
+ */
6618
+#undef TARGET_INIT_BUILTINS
6619
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6620
+
6621
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6622
+ * machine specific builtin functions that need to be defined.  It should be a
6623
+ * function that returns the builtin function declaration for the builtin
6624
+ * function code code.  If there is no such builtin and it cannot be initialized
6625
+ * at this time if INITP is true the function should return NULL_TREE.  If
6626
+ * CODE is out of range the fucntion should return error-mark_node.
6627
+ *
6628
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6629
+ */
6630
+#undef TARGET_BUILTIN_DECL
6631
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6632
+
6633
+
6634
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6635
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6636
+ * TREE is the expression for the function call; the result should go to
6637
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6638
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6639
+ * non-zero if the value is to be ignored.  This function should return the
6640
+ * result of the call to the built-in function.
6641
+ *
6642
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6643
+ */
6644
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6645
+
6646
+
6647
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6648
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6649
+ *
6650
+ * ZipCPU --- not interested.
6651
+ */
6652
+/* TARGET_CHKP_BOUND_TYPE
6653
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6654
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6655
+ *
6656
+ * ZipCPU --- Same as last one.
6657
+ */
6658
+
6659
+
6660
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6661
+ * for a machine specific built-in function that was set up by
6662
+ * TARGET_INIT_BUILTINS.
6663
+ *
6664
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6665
+ * to then overload it?
6666
+ */
6667
+
6668
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6669
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6670
+ * is the declaration of the built-in function.  NARGS is the number of
6671
+ * arguments passed to the function; the arguments themselves are pointed to by
6672
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6673
+ * containing as simplified expression for the call's result.  If IGNORE is
6674
+ * true the value will be ignored.
6675
+ *
6676
+ * ZipCPU --- You know, this and the previous couple sound like something
6677
+ * whereby I might be able replace bit-reversal code with my bit reverse
6678
+ * instruction.  That would be very useful, but not necessary to get me
6679
+ * started.
6680
+ */
6681
+
6682
+/* TARGET_GIMPLE_FOLD_BUILTIN
6683
+ * TARGET_COMPARE_VERSION_PRIORITY
6684
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6685
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6686
+ * TARGET_CAN_USE_DOLOOP_P
6687
+ * TARGET_INVALID_WITHIN_DOOLOOP
6688
+ * TARGET_LEGITIMATE_COMBINED_INSN
6689
+ * TARGET_CAN_FOLLOW_JUMP
6690
+ * TARGET_COMMUTATIVE_P
6691
+ */
6692
+
6693
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6694
+ * register has been copied in a pseudo register, it is often not necessary
6695
+ * ...
6696
+ */
6697
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6698
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6699
+ * can use this hook to enhance precision of analysis for unspec and
6700
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6701
+ * elements of RTX in which case flags should be passed along.
6702
+ */
6703
+
6704
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6705
+ * it changes its current function context (CFUN).  You can define this
6706
+ * function if the back end needs to perform any initialization or reset
6707
+ * actions on a per-function basis.  For example, it may be used to implement
6708
+ * function attributes that affect register usage or code generation patterns.
6709
+ */
6710
+
6711
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6712
+ * suffix for object files on your target machine.  If you do not define this
6713
+ * macro, GCC will use ".o" as the suffix for object files.
6714
+ */
6715
+#define        TARGET_OBJECT_SUFFIX    ".o"
6716
+
6717
+/* TARGET_EXECUTABLE_SUFFIX
6718
+ */
6719
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6720
+
6721
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6722
+ * files specified on its command line and create an export list for the linker.
6723
+ * Define this macro for systems like AIX, where the linker discards object
6724
+ * files that are not referenced from main and uses export lists.
6725
+ *
6726
+ * ZipCPU --- shoudln't need this.
6727
+ */
6728
+
6729
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6730
+ * representing a variant of the method call mdecl, if Java Native Interface
6731
+ * (JNI) methods must be invoked differently from other methods on your
6732
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6733
+ * using the stdcall calling convention and this macro is then ...
6734
+ *
6735
+ * ZipCPU----Don't need this.  (yet)
6736
+ */
6737
+
6738
+
6739
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6740
+ * point in which a new jump instructions could be created.  On machines that
6741
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6742
+ * would typically be reload, so thiss target hook should be defined to a
6743
+ * function such as:
6744
+ *
6745 117 dgisselq
+ * ZipCPU --- I don't get what this is for.
6746
+ *     Actually, in hind sight, ZipCPU needs this.  Without this, the
6747
+ * compiler will try to reorder basic blocks, shuffling logic around and so
6748
+ * fortch, preventing our comparison optimizations from being used.  By setting
6749
+ * this function appropriately, we can prevent it from reversing conditions into
6750
+ * conditions we don't support.
6751 102 dgisselq
+ */
6752 117 dgisselq
+#define        TARGET_CANNOT_MODIFY_JUMPS_P    zip_cannot_modify_jumps_p
6753 102 dgisselq
+
6754
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6755
+ * class for which branch target register optimizations should be applied.  All
6756
+ * registers in this class should be usable interchangably.  After reload,
6757
+ * registers in this class will be re-allocated and loads will be hoisted out of
6758
+ * loops and be subjected to inter-block scheduling.
6759
+ *
6760
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6761
+ */
6762
+
6763
+
6764
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6765
+ * optimization will by default exclude callee-saved registers that are not
6766
+ * already live during the current function.  If this target hook returns true,
6767
+ * they will be included.  The target code must then make sure that all target
6768
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6769
+ * be saved are saaved.
6770
+ *
6771
+ * ZipCPU---
6772
+ */
6773
+
6774
+
6775
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6776
+ * if the target supports conditional execution.  This target hook is required
6777
+ * only when the target has several different modes and they have different
6778
+ * conditional execution capability, such as ARM.
6779
+ *
6780
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6781
+ * long version load immediate ...)
6782
+ */
6783
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6784
+
6785
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6786
+ * emit a comparison instruction for the first compare in a sequence of
6787
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6788
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6789
+ * compare are saved in prep_seq and the compare instructions are saved in
6790
+ * gen_seq.  They will be emitted when all the compares in the conditional
6791
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6792
+ * for op0 and op1.
6793
+ *
6794
+ *
6795
+ * ZipCPU---???
6796
+ */
6797
+
6798
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6799
+ * prepares to emit a conditional comparison within a sequence of conditional
6800
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6801
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6802
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6803
+ * emitted when all the compares in the conditional comparison are generated
6804
+ * without error.  The pPREV expression is the result of a prior call to either
6805
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6806
+ * PREV and this comparison is not supported, otherwise the result must be the
6807
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6808
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6809
+ * on the compares.
6810
+ *
6811
+ *
6812
+ * ZipCPU --- ???
6813
+ */
6814
+
6815
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6816
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6817
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6818
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6819
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6820
+ *
6821
+ *
6822
+ * ZipCPU -- ???
6823
+ */
6824
+
6825
+
6826
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6827
+ * C expression that specifies the maximum number of floating point
6828
+ * multiplications that should be emitted when expanding exponentiation by an
6829
+ * integer constant inline.  When this value is defined, exponentiation
6830
+ * requiring more than this number of multiplications is implemented by calling
6831
+ * the system library's pow, powf, or powl routines.  The default value
6832
+ places no upper bound on the multiplication count.
6833
+ *
6834
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6835
+ * ready for this macro.
6836
+ */
6837
+
6838
+
6839
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6840
+ * register any extra include files for the target.  The parameter stdinc
6841
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6842
+ * system root directory.  The parameter PFX is the prefix for the GCC
6843
+ * directoiry.
6844
+ *
6845
+ *
6846
+ * ZipCPU---None yet.
6847
+ */
6848
+
6849
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6850
+ * register any extrra include files for the target before any standard headers.
6851
+ * The parameter stdinc indicates if normal include files are present.
6852
+ *
6853
+ * ZipCPU --- None.
6854
+ */
6855
+
6856
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6857
+ * for the target.  The parameter path is the integer to register.  On Darwin
6858
+ * systems, this is used for Framework includes, which have semantics that are
6859
+ * different from -I.
6860
+ *
6861
+ *
6862
+ * ZipCPU --- None.
6863
+ */
6864
+
6865
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6866
+ * safe to use a local alias for a virtual function FN when constructing
6867
+ * thunks, false otherwise.  By default, the macro returns true for all
6868
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6869
+ * false otherwise.
6870
+ *
6871
+ *
6872
+ * ZipCPU --- ???
6873
+ */
6874
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6875
+
6876
+
6877
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6878
+ * variable containing target-specific format checking information for the
6879
+ * -Wformat option.  The default is to have no target-specific format checks.
6880
+ *
6881
+ * ZipCPU --- Default
6882
+ */
6883
+
6884
+/* TARGET_N_FORMAT_TYPES
6885
+ *
6886
+ * ZipCPU --- Default
6887
+ */
6888
+
6889
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6890
+ * a global variable containing target-specific format overrides for the
6891
+ * -Wformat option.  The default is to have no target specific format overrides.
6892
+ *
6893
+ * ZipCPU --- Default
6894
+ */
6895
+
6896
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6897
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6898
+ *
6899
+ * If defined, the (first) macro is the name of a global variable containing
6900
+ * target-specific format overrides for the -Wformat option.
6901
+ */
6902
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6903
+ * optional initialization routine for target specific customizations of the
6904
+* system printf and scanf formatter settings.
6905
+ */
6906
+
6907
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6908
+ * macro returns the diagnostic message when it is illegal to pass an argument
6909
+ * VAL to function FN with prototype TLIST.
6910
+ *
6911
+ * ZipCPU---Default.
6912
+ */
6913
+
6914
+/* TARGET_INVALID_CONVERSION
6915
+ * TARGET_INVALID_UNARY_OP
6916
+ * TARGET_INVALID_BINARY_OP
6917
+ * TARGET_INVALID_PARAMETER_TYPE
6918
+ * TARGET_INVALID_RETURN_TYPE
6919
+ * TARGET_PROMOTED_TYPE
6920
+ * TARGET_CONVERT_TO_TYPE
6921
+ * TARGET_USE_JCR_SECTION_TYPE
6922
+ * OBJC_JBLEN
6923
+ * LIBGCC2_UNWIND_ATTRIBUTE
6924
+ * TARGET_UPDATE_STACK_BOUNDARY
6925
+ * TARGET_GET_DRAP_RTX
6926
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6927
+ */
6928
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6929
+ * instructions to synthesize a constant. If there is another constant already
6930
+ * in a register that is close enough in value then it is preferable that the
6931
+ * new constant is computed from the register using immediate addition or
6932
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6933
+ * constant we also add a lower and an upper constant anchor to the available
6934
+ * expressions.  These are then queried when encountering new constants.  The
6935
+ * anchors are computed by rounding the constant up and down to a multiple of
6936
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6937
+ * positive value accepted by immediate-add plus one.  We currently assume that
6938
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6939
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6940
+ * to 0x8000.  The default value is zero, which disables this optimization.
6941
+ *
6942
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6943
+ * access registers plus immediates.  To use this, we *need* this capability.
6944
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6945
+ * signed immediate offsets)
6946
+ *
6947
+ * On ZipCPU---2^17
6948
+ */
6949
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
6950
+
6951
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
6952
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
6953
+ * if address Sanitizer is not supported by the target.
6954
+ */
6955
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
6956
+
6957
+/* TARGET_MEMMODEL_CHECK
6958
+ */
6959
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
6960
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
6961
+ */
6962
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
6963
+ * functions.  The support includes the assembler, linker, and dynamic linker.
6964
+ * The default value of this hook is based on target's libc.
6965
+ */
6966
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
6967
+
6968
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
6969
+ * an appropriate alignment in bits for an atomic object of machine mode
6970
+ * MODE.  If 0 is returned then the default alignment for the specified mode
6971
+ * is used.
6972
+ *
6973
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
6974
+ */
6975
+
6976
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
6977
+ * assignments that may raise floating-point exceptions to raise exceptions
6978
+ * corresponding to the arithmetic operation whose result was successfully
6979
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
6980
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
6981
+ * appropriate points in the compare-and-exchange sequence.  This hook should
6982
+ * set *hold to an expression equivalent
6983
+ *
6984
+ * ZipCPU --- ???
6985
+ */
6986
+
6987
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
6988
+ * the compilation unit and no named sections are available.  It is called once
6989
+ * for each symbol that must be recorded in the offload function and variable
6990
+ * table.
6991
+ *
6992
+ * ZipCPU --- Offloaded functions?
6993
+ */
6994
+
6995
+/* TARGET_OFFLOAD_OPTIONS
6996
+ *
6997
+ * ZipCPU---none defined
6998
+ */
6999
+
7000
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
7001
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
7002
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
7003
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
7004
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
7005
+ * HOST_WIDE_INT representation.
7006
+ *
7007
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
7008
+ * are wider than DImode ...)
7009
+ */
7010
+#define        TARGET_SUPPORTS_WIDE_INT        0
7011
+
7012
+
7013
+/* Now, for the prototype functions ...*/
7014
+// These have been moved to zip-protos.h
7015
+
7016
+// extern void zip_init_builtins(void);
7017
+// extern void zip_asm_output_anchor(rtx x);
7018
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
7019
+// extern void zip_asm_trampoline_template(FILE *);
7020
+// extern void zip_initial_elimination_offset(int from, int to);
7021
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
7022
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
7023
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
7024
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
7025
+// extern      int zip_address_operand(rtx op);
7026
+// extern      int zip_const_address_operand(rtx op);
7027
+// extern void zip_expand_prologue(void);
7028
+// extern void zip_expand_epilogue(void);
7029
+// extern bool zip_gen_move_rtl(rtx, rtx);
7030
+// extern bool zip_load_address_lod(rtx, rtx);
7031
+// extern bool zip_load_address_sto(rtx, rtx);
7032
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
7033
+// extern void zip_print_operand_address(FILE *fp, rtx x);
7034
+// extern bool zip_use_return_insn(void);
7035
+
7036 111 dgisselq
+#define        UQQmode USQmode
7037
+#define        UHQmode USQmode
7038
+#define        UHAmode USAmode
7039
+#define        QQmode  SQmode
7040
+#define        HQmode  SQmode
7041 102 dgisselq
+#define        QImode  SImode
7042
+#define        HImode  SImode
7043 111 dgisselq
+#define        QAmode  SAmode
7044
+#define        HAmode  SAmode
7045 102 dgisselq
+
7046
+#include "insn-modes.h"
7047
+#include "zip-protos.h"
7048
+
7049
+#endif /* GCC_ZIP_H */
7050
+
7051
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
7052
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
7053 142 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-05-09 16:29:28.701366941 -0400
7054
@@ -0,0 +1,3238 @@
7055 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7056
+;;
7057
+;; Filename:   zip.md
7058
+;;
7059
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
7060
+;;
7061
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
7062
+;;             GNU compiler collection (GCC).
7063
+;;
7064
+;;
7065
+;; Creator:    Dan Gisselquist, Ph.D.
7066
+;;             Gisselquist Technology, LLC
7067
+;;
7068
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7069
+;;
7070
+;; Copyright (C) 2015, Gisselquist Technology, LLC
7071
+;;
7072
+;; This program is free software (firmware): you can redistribute it and/or
7073
+;; modify it under the terms of  the GNU General Public License as published
7074
+;; by the Free Software Foundation, either version 3 of the License, or (at
7075
+;; your option) any later version.
7076
+;;
7077
+;; This program is distributed in the hope that it will be useful, but WITHOUT
7078
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
7079
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7080
+;; for more details.
7081
+;;
7082
+;; License:    GPL, v3, as defined and found on www.gnu.org,
7083
+;;             http://www.gnu.org/licenses/gpl.html
7084
+;;
7085
+;;
7086
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7087
+;;
7088
+;;
7089
+;; - Immediate integer operand constraints
7090
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
7091
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
7092
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
7093
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
7094
+;;     'R'     0...31                                          (Shift value)
7095
+;; - Memory constraints
7096 111 dgisselq
+;;     "Q"     Op-B capable references to memory
7097
+;;     "S"     References to constant memory
7098 102 dgisselq
+;; - Address constraints
7099 111 dgisselq
+;;     "U"     Op-B capable address that references to memory
7100
+;;     "T"     Constant memory addresses
7101 102 dgisselq
+(define_constraint "M"
7102
+  "An 13-bit signed immediate such as a MOV instruction can handle"
7103
+  (and (match_code "const_int")
7104
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
7105
+(define_constraint "N"
7106
+  "An 14-bit signed immediate offset such as an Op-B register offset"
7107
+  (and (match_code "const_int")
7108
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
7109
+(define_constraint "O"
7110
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
7111
+  (and (match_code "const_int")
7112
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
7113
+(define_constraint "R"
7114
+  "Bits that a value may be shifted"
7115
+  (and (match_code "const_int")
7116
+       (match_test "(ival < 32) && (ival >= 0)")))
7117
+;;
7118
+;
7119
+;
7120
+; Our builtin functions, by identifier
7121
+;
7122
+(define_constants
7123 117 dgisselq
+       [(UNSPEC_RTU             1)
7124
+       (UNSPEC_HALT             2)
7125
+       (UNSPEC_IDLE             3)
7126
+       (UNSPEC_SYSCALL          4)
7127
+       (UNSPEC_SAVE_CONTEXT     5)
7128
+       (UNSPEC_RESTORE_CONTEXT  6)
7129
+       (UNSPEC_BITREV           7)
7130
+       (UNSPEC_GETUCC           8)
7131
+       (UNSPEC_GETCC            9)
7132
+       (UNSPEC_LDILO           10)
7133 127 dgisselq
+       ; (UNSPEC_RAW_CALL      11)
7134 102 dgisselq
+       ])
7135
+;
7136
+;
7137
+; Registers by name
7138
+(define_constants
7139
+  [(RTN_REG            0)      ; Return address register
7140
+   (RTNV_REG           1)      ; Subroutine return value register
7141
+   (AP_REG             10)     ; Hopefully never used
7142
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
7143
+   (FP_REG             12)
7144
+   (SP_REG             13)
7145
+   (CC_REG             14)
7146
+   (PC_REG             15)
7147
+  ])
7148
+;
7149
+;
7150
+;
7151
+
7152
+;; Predicates
7153
+(define_predicate "zip_const_address_operand_p"
7154
+       (match_code "symbol_ref,const,label_ref,code_label")
7155
+{
7156
+       return zip_const_address_operand(op);
7157
+})
7158
+
7159
+(define_predicate "zip_address_operand_p"
7160
+       (match_code "reg,plus")
7161
+{
7162 111 dgisselq
+       return zip_pd_opb_operand(op);
7163 102 dgisselq
+})
7164
+
7165 111 dgisselq
+(define_predicate "zip_opb_operand_p"
7166 122 dgisselq
+       (match_code "reg,plus,const_int,subreg")
7167 111 dgisselq
+{
7168
+       return zip_pd_opb_operand(op);
7169
+})
7170
+
7171 122 dgisselq
+(define_predicate "zip_opb_immv_p"
7172
+       (match_code "const_int")
7173
+{
7174
+       return (INTVAL(op)<((1<<13)-1))&&(INTVAL(op)>=-((1<<13)));
7175
+})
7176
+
7177 111 dgisselq
+(define_predicate "zip_opb_single_operand_p"
7178 122 dgisselq
+       (match_code "reg,subreg,const_int")
7179 111 dgisselq
+{
7180
+       return zip_pd_opb_operand(op);
7181
+})
7182
+
7183 102 dgisselq
+(define_predicate "zip_mov_operand_p"
7184
+       (match_code "reg,plus")
7185
+{
7186
+       return zip_pd_mov_operand(op);
7187
+})
7188
+
7189
+(define_predicate "zip_memory_operand_p"
7190
+       (match_code "mem")
7191
+{
7192 111 dgisselq
+       return zip_pd_opb_operand(XEXP(op,0));
7193 102 dgisselq
+})
7194
+
7195 111 dgisselq
+(define_predicate "zip_imm_operand_p"
7196
+       (match_code "const_int")
7197
+{
7198
+       return zip_pd_imm_operand(op);
7199
+})
7200
+
7201
+(define_predicate "zip_mvimm_operand_p"
7202
+       (match_code "const_int")
7203
+{
7204
+       return zip_pd_mvimm_operand(op);
7205
+})
7206
+
7207
+(define_predicate "zip_movdst_operand_p"
7208
+       (match_code "mem,reg,subreg")
7209
+{
7210
+       if (MEM_P(op)) // Check for valid store address
7211
+               return zip_pd_opb_operand(XEXP(op,0));
7212 122 dgisselq
+       else if (SUBREG_P(op))
7213
+               return 1;
7214
+       else if ((REG_P(op))||(SUBREG_P(op)))
7215
+               return register_operand(op, GET_MODE(op));
7216 111 dgisselq
+       return 1;
7217
+})
7218
+
7219
+(define_predicate "zip_movsrc_operand_p"
7220
+       (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
7221
+{
7222
+       if (MEM_P(op))
7223
+               return zip_pd_opb_operand(XEXP(op,0));
7224
+       else if (GET_CODE(op)==PLUS)
7225
+               return zip_pd_opb_operand(op);
7226 122 dgisselq
+       else if (SUBREG_P(op)) {
7227
+               //; As far as predicates are concerned, subregs must be valid.
7228
+               //; The details of them are settled within the constraints.
7229
+               return 1;
7230
+       } else if ((REG_P(op))||(SUBREG_P(op)))
7231
+               return register_operand(op,SImode);
7232
+       else if (CONST_INT_P(op))
7233
+               return 1;
7234 111 dgisselq
+       return 1;
7235
+})
7236
+
7237 102 dgisselq
+;; Constraints
7238
+;
7239
+(define_memory_constraint "S"
7240
+       "Any memory referenced by a constant address, possibly unknown at compile time"
7241
+       (and (match_code "mem")
7242
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
7243
+(define_memory_constraint "Q"
7244
+       "Any memory addressed suitably for a load or store instruction"
7245
+       (and (match_code "mem")
7246
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
7247
+(define_address_constraint "U"
7248
+       "An address suitable for a load or store instruction"
7249
+       (and (match_code "reg,plus")
7250
+               (match_test "zip_ct_address_operand(op)")))
7251
+(define_address_constraint "T"
7252
+       "Any constant address, to include those made by symbols unknown at compile time"
7253
+       (and (match_code "label_ref,code_label,symbol_ref,const")
7254
+               (match_test "zip_ct_const_address_operand(op)")))
7255
+;
7256
+;
7257
+;; Attributes
7258
+;
7259
+(define_attr "predicable"  "no,yes" (const_string "yes"))
7260
+(define_attr "conditional" "no,yes" (const_string "no"))
7261
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
7262
+;
7263
+; Mode attributes
7264
+; (define_mode_iterator ZI [QI HI SI])
7265
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
7266
+(define_mode_iterator ZI [SI])
7267
+(define_mode_attr zipa [(SI "")])
7268
+;
7269
+;
7270
+;
7271
+;; Instructions
7272
+;
7273
+; (define_insn
7274
+;      optional name
7275
+;      RTL template -- a vector of incomplete RTL expressions describing the
7276
+;              semantics of the instruction.  It is incomplete because it may
7277
+;              contain match_operand, match_operator, and match_dup expressions
7278
+;      The condition --- contains a C expression, may be an empty string
7279
+;      output template or output statement--fragment of C code returning a str
7280
+;      Attributes --
7281
+;      )
7282
+;
7283
+; (match_operand:m n predicate constraint)
7284
+;      Placeholder for operand #n of the instruction
7285
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
7286
+;                              (expression, machine mode)
7287
+;              we can build functions:
7288
+;                      "isregister"    to describe a register
7289
+;                      "isimmediate"   to describe an immediate
7290
+;                      "offsetreg"     to describe a register plus offset
7291
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
7292
+;              But ... functions "address_operand", "immediate_operand",
7293
+;                      "register_operand", "indirect_operand"
7294
+;              "comparison_operatot" and "ordered_comparison_operator"
7295
+;              are also available--be aware, they include more comparisons
7296
+;              than Zip CPU can do.
7297
+;
7298
+;
7299
+;
7300
+;
7301
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7302
+;;
7303
+;; Move instructions: both
7304
+;      (arbitrary) from variables to variables, but this gets
7305
+;              expanded into:
7306
+;      from registers to registers
7307
+;      from immediates to registers
7308
+;;
7309
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7310
+;
7311
+;
7312
+;
7313
+(define_expand "mov<mode>"
7314 111 dgisselq
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "")
7315
+               (match_operand:ZI 1 "general_operand" ""))]
7316 102 dgisselq
+       ""
7317 111 dgisselq
+       {//; Everything except mem=const or mem=mem can be done easily
7318
+       //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
7319
+       //; fprintf(stderr, "ZIP-GEN-MOVE\n");
7320
+       //; zip_debug_rtx_pfx("FROM: ", operands[1]);
7321
+       //; zip_debug_rtx_pfx("TO  : ", operands[0]);
7322
+
7323
+       //; Need to load into a register between memory slots
7324
+       if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
7325
+               //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
7326
+               if (can_create_pseudo_p()) {
7327
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
7328
+                       emit_insn(gen_movsi(tmp,operands[1]));
7329
+                       operands[1] = tmp;
7330
+               }
7331 102 dgisselq
+       }
7332 111 dgisselq
+
7333
+       //; Op[0] has a bad address, need to legitimize it
7334
+       if ((MEM_P(operands[0]))&&
7335
+               ((zip_const_address_operand(XEXP(operands[0],0)))
7336
+               ||(!zip_pd_opb_operand(XEXP(operands[0],0))))
7337
+               )
7338
+               {
7339
+               //; fprintf(stderr, "GEN-MOVSI: Not to a MEM(REG)\n");
7340
+               if (can_create_pseudo_p()) {
7341
+                       rtx tmp = gen_reg_rtx(Pmode);
7342
+                       //; Load the address into a register
7343
+                       emit_insn(gen_movsi(tmp,XEXP(operands[0],0)));
7344
+                       XEXP(operands[0],0) = tmp;
7345
+                       mark_reg_pointer(tmp,1);
7346
+               }
7347
+       }
7348
+       //; Op[1] is a constant.  Need to load into a register before we can
7349
+       //; place it into memory.
7350
+       if ((MEM_P(operands[0]))&&
7351
+               ((CONSTANT_P(operands[1]))
7352
+               ||(CONST_INT_P(operands[1])))) {
7353
+               //; fprintf(stderr, "GEN-MOVSI: CONST -> MEM\n");
7354
+               //; zip_debug_rtx_pfx("MEM  : ", operands[0]);
7355
+               //; zip_debug_rtx_pfx("CONST: ", operands[1]);
7356
+               if (can_create_pseudo_p()) {
7357
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[0]));
7358
+                       emit_insn(gen_movsi(tmp,operands[1]));
7359
+                       operands[1] = tmp;
7360
+               }
7361
+       }
7362
+       //; Op[1] has a bad address, need to legitimize it
7363
+       if ((MEM_P(operands[1]))&&
7364
+               //; (!REG_P(XEXP(operands[1],0)))
7365
+               ((zip_const_address_operand(XEXP(operands[1],0)))
7366 122 dgisselq
+               ||(!zip_pd_opb_operand(XEXP(operands[1],0))))) {
7367 111 dgisselq
+               //; fprintf(stderr, "GEN-MOVSI: Not from a MEM(REG)\n");
7368
+               if (can_create_pseudo_p()) {
7369
+                       rtx tmp = gen_reg_rtx(Pmode);
7370
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7371
+                       XEXP(operands[1],0) = tmp;
7372
+               } else if (REG_P(operands[0])) { //; Can we steal Op[0]'s reg?
7373
+                       rtx tmp = operands[0];
7374
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7375
+                       XEXP(operands[1],0) = tmp;
7376
+               }
7377
+       }
7378
+       }
7379 102 dgisselq
+       [(set_attr "ccresult" "unchanged")])
7380 111 dgisselq
+(define_insn "movsi_raw"
7381
+       [(set (match_operand:SI 0 "zip_movdst_operand_p" "=r,Q,r,r")
7382
+               (match_operand:SI 1 "zip_movsrc_operand_p" "r,r,Q,i"))]
7383 122 dgisselq
+       "(register_operand(operands[0],SImode))||(register_operand(operands[1],SImode))"
7384 111 dgisselq
+       "@
7385
+       MOV\t%1,%0
7386
+       STO\t%1,%0
7387
+       LOD\t%1,%0
7388
+       LDI\t%1,%0"
7389
+       [(set_attr "ccresult" "unchanged")])
7390 102 dgisselq
+(define_insn "mov<mode>_reg"   ; Register to register move
7391
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7392
+               (match_operand:ZI 1 "register_operand" "r"))]
7393
+       ""
7394
+       "MOV    %1,%0"
7395
+       [(set_attr "ccresult" "unchanged")])
7396 124 dgisselq
+(define_insn "mov<mode>_reg_off" ; Register to register move, used by prologue
7397 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7398
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7399 111 dgisselq
+                       (match_operand:ZI 2 "zip_mvimm_operand_p" "M")))
7400
+               ]
7401 102 dgisselq
+       ""
7402
+       "MOV    %2(%1),%0"
7403
+       [(set_attr "ccresult" "unchanged")])
7404 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
7405
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
7406
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7407
+;      ""
7408
+;      "LOD    %1,%0"
7409
+;      [(set_attr "ccresult" "unchanged")])
7410
+;(define_insn "mov<mode>_sto"  ; Store into memory
7411
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7412
+;              (match_operand:ZI 1 "register_operand" "r"))]
7413
+;      ""
7414
+;      "STO    %1,%0"
7415
+;      [(set_attr "ccresult" "unchanged")])
7416
+(define_expand "mov<mode>_lod" ; Load from memory
7417 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7418
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7419 103 dgisselq
+       "")
7420
+(define_insn "*movsi_lod"
7421
+       [(set (match_operand:SI 0 "register_operand" "=r")
7422 111 dgisselq
+               (match_operand:SI 1 "zip_memory_operand_p" ""))]
7423 102 dgisselq
+       ""
7424 103 dgisselq
+       "LOD\t%1,%0"
7425
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7426 124 dgisselq
+(define_insn "movsi_lod_off" ; used by epilogue code
7427
+       [(set (match_operand:SI 0 "register_operand" "=r")
7428
+               (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
7429
+                       (match_operand:SI 2 "const_int_operand" "N"))))]
7430
+       ""
7431
+       "LOD\t%2(%1),%0"
7432
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7433 103 dgisselq
+(define_expand "mov<mode>_sto" ; Store into memory
7434 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7435
+               (match_operand:ZI 1 "register_operand" "r"))]
7436 103 dgisselq
+       "")
7437
+(define_insn "*movsi_sto"
7438 111 dgisselq
+       [(set (match_operand:SI 0 "zip_memory_operand_p" "=Q")
7439 103 dgisselq
+               (match_operand:SI 1 "register_operand" "r"))]
7440 102 dgisselq
+       ""
7441 111 dgisselq
+       "STO\t%1,%0"
7442 103 dgisselq
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7443 124 dgisselq
+(define_insn "movsi_sto_off" ; used by prologue code
7444
+       [(set (mem:SI (plus:SI
7445
+                       (match_operand:SI 0 "register_operand" "r")
7446
+                       (match_operand:SI 1 "const_int_operand" "N")))
7447
+               (match_operand:SI 2 "register_operand" "r"))]
7448
+       ""
7449
+       "STO\t%2,%1(%0)"
7450
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7451 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
7452
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7453
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
7454
+       ""
7455
+       "LDI    %1,%0"
7456
+       [(set_attr "ccresult" "unchanged")])
7457
+;
7458
+;
7459
+;
7460
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7461
+;;
7462
+;; Load and store multiple values
7463
+;;
7464
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7465
+;
7466
+; So far, from the code I've seen from GCC's output,
7467
+; these instructions do not appear to be necessary.
7468
+;
7469
+;(define_insn "load_multiple"
7470
+;      for(a=0; a<%2; a++)
7471
+;              LOD a(%1),%0+a
7472
+;(define_insn "store_multiple"
7473
+;      for(a=0; a<%2; a++)
7474
+;              STO %0+a,a(%1)
7475
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
7476
+;
7477
+;
7478
+;
7479
+;
7480
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7481
+;;
7482 127 dgisselq
+;; Substitution Pattern
7483
+;;
7484
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7485
+;
7486
+;
7487
+(define_subst "cc_substitution"
7488
+       ; The pattern may not have any match_dup expressions.
7489
+       [(set (match_operand:SI 0 "" "") (match_operand:SI 1 "" ""))
7490
+               (clobber (reg:CC CC_REG))]
7491
+       ""
7492
+       [(set (match_dup 0) (match_dup 1))
7493
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))
7494
+       ])
7495
+;
7496
+(define_subst_attr "cc_subst" "cc_substitution" "_raw" "_clobber")
7497
+;
7498
+;
7499
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7500
+;;
7501 102 dgisselq
+;; General arithmetic instructions
7502
+;;
7503
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7504
+;
7505
+;
7506
+;
7507
+;
7508 111 dgisselq
+(define_expand "add<mode>3" ; Fastest/best instruction always goes first
7509 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7510 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7511 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7512 127 dgisselq
+       ])
7513
+(define_insn_and_split "add<mode>3_split_reg"
7514
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7515
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7516
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7517
+       ""
7518
+       "#"     ; This code means the instruction *must* be split
7519
+       "(reload_completed)&&(REG_P(operands[0]))&&(REG_P(operands[1]))&&(REGNO(operands[0])==REGNO(operands[1]))"
7520
+       [(parallel [(set (match_dup 0) (plus:ZI (match_dup 1) (match_dup 2)))
7521
+               (clobber (reg:CC CC_REG))])]
7522
+       ""
7523
+       [(set_attr "predicable" "yes")])
7524
+(define_insn_and_split "add<mode>3_split_off"
7525
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7526
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7527
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7528
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7529
+       ""
7530
+       "#"     ; This code means the instruction *must* be split
7531
+       "(reload_completed)&&(REG_P(operands[0]))&&(REG_P(operands[1]))&&(REGNO(operands[0])==REGNO(operands[1]))"
7532
+       [(parallel [(set (match_dup 0) (plus:ZI (match_dup 1)
7533
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7534
+               (clobber (reg:CC CC_REG))])]
7535
+       ""
7536
+       [(set_attr "predicable" "yes")])
7537
+(define_insn "addsi3_reg_clobber"
7538 122 dgisselq
+       [(set (match_operand:SI 0 "register_operand" "=r")
7539
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7540
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7541 127 dgisselq
+       (clobber (reg:CC CC_REG))]
7542
+       ""
7543
+       "ADD    %2,%0"
7544
+       [(set_attr "ccresult" "set")])
7545
+(define_insn "addsi3_reg_raw"
7546
+       [(set (match_operand:SI 0 "register_operand" "=r")
7547
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7548
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7549 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7550 102 dgisselq
+       ""
7551
+       "ADD    %2,%0"
7552
+       [(set_attr "ccresult" "set")])
7553 127 dgisselq
+(define_insn "add<mode>3_off_raw"
7554 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7555 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7556
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7557 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7558
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7559 102 dgisselq
+       ""
7560
+       "ADD    %3+%2,%0"
7561
+       [(set_attr "ccresult" "set")])
7562 127 dgisselq
+(define_insn "add<mode>3_off_clobber"
7563
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7564
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7565
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7566
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7567
+       (clobber (reg:CC CC_REG))]
7568
+       ""
7569
+       "ADD    %3+%2,%0"
7570
+       [(set_attr "ccresult" "set")])
7571 102 dgisselq
+;
7572
+;
7573
+;
7574 103 dgisselq
+(define_expand "sub<mode>3"
7575 138 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7576 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7577 138 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7578 127 dgisselq
+(define_insn_and_split "sub<mode>3_split_reg"
7579 103 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7580
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7581 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7582
+       ""
7583
+       "#"
7584
+       "(reload_completed)"
7585
+       [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1) (match_dup 2)))
7586
+       (clobber (reg:CC CC_REG))])]
7587
+       ""
7588 138 dgisselq
+       [(set_attr "ccresult" "set") (set_attr "predicable" "yes")])
7589 127 dgisselq
+(define_insn "sub<mode>3_reg_raw"
7590
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7591
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7592 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7593 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7594 102 dgisselq
+       ""
7595
+       "SUB    %2,%0"
7596
+       [(set_attr "ccresult" "set")])
7597 127 dgisselq
+(define_insn "sub<mode>3_reg_clobber"
7598 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7599 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7600 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7601
+       (clobber (reg:CC CC_REG))]
7602
+       ""
7603
+       "SUB    %2,%0"
7604
+       [(set_attr "ccresult" "set")])
7605
+(define_insn_and_split "sub<mode>3_off_split"
7606
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7607
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7608 103 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7609 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7610
+       ""
7611
+       "#"
7612
+       "(reload_completed)"
7613
+       [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1)
7614
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7615
+       (clobber (reg:CC CC_REG))])]
7616
+       ""
7617
+       [(set_attr "ccresult" "set")])
7618
+(define_insn "sub<mode>3_off_raw"
7619
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7620
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7621
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7622 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7623
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7624 102 dgisselq
+       ""
7625
+       "SUB    %3+%2,%0"
7626
+       [(set_attr "ccresult" "set")])
7627 127 dgisselq
+(define_insn "sub<mode>3_off_clobber"
7628
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7629
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7630
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7631
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7632
+       (clobber (reg:CC CC_REG))]
7633
+       ""
7634
+       "SUB    %3+%2,%0"
7635
+       [(set_attr "ccresult" "set")])
7636 138 dgisselq
+(define_insn "mul<mode>3_oldstyle"
7637 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7638
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
7639
+                       (match_operand:ZI 2 "register_operand" "r")))
7640 122 dgisselq
+       (clobber (match_scratch:ZI 3 "=r"))
7641
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7642 102 dgisselq
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7643 138 dgisselq
+       "(!ZIP_LONGMPY)"
7644 102 dgisselq
+       "MOV    %1,%0
7645
+       MPYS    %2,%0
7646
+       MOV     %1,%3
7647
+       ROL     16,%3
7648
+       MPYS    %2,%3
7649
+       ROL     16,%3
7650
+       AND     0x0ffff,%3
7651
+       ADD     %3,%0
7652
+       MOV     %2,%3
7653
+       ROL     16,%3
7654
+       MPYS    %1,%3
7655
+       ROL     16,%3
7656
+       AND     0x0ffff,%3
7657
+       ADD     %3,%0"
7658
+       [(set_attr "ccresult" "unknown")])
7659 138 dgisselq
+;
7660
+;
7661
+(define_expand "mul<mode>3"
7662
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7663
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7664
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))]
7665
+       "(ZIP_LONGMPY)")
7666
+(define_insn_and_split "mul<mode>3_split_reg"
7667
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7668
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7669
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7670
+       "(ZIP_LONGMPY)"
7671
+       "#"
7672
+       "(reload_completed)"
7673
+       [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1) (match_dup 2)))
7674
+       (clobber (reg:CC CC_REG))])]
7675
+       ""
7676
+       [(set_attr "ccresult" "set")])
7677
+(define_insn_and_split "mul<mode>3_split_off"
7678
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7679
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7680
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7681
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7682
+       "(ZIP_LONGMPY)"
7683
+       "#"
7684
+       "(reload_completed)"
7685
+       [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1)
7686
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7687
+       (clobber (reg:CC CC_REG))])]
7688
+       ""
7689
+       [(set_attr "ccresult" "set")])
7690
+(define_insn "mul<mode>3_reg_clobber"
7691
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7692
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7693
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7694
+       (clobber (reg:CC CC_REG))]
7695
+       "(ZIP_LONGMPY)"
7696
+       "MPY\t%2,%0"
7697
+       [(set_attr "ccresult" "set")])
7698
+(define_insn "mul<mode>3_reg_raw"
7699
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7700
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7701
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7702
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7703
+       "(ZIP_LONGMPY)"
7704
+       "MPY\t%2,%0"
7705
+       [(set_attr "ccresult" "set")])
7706
+(define_insn "mul<mode>3_off_raw"
7707
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7708
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7709
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7710
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7711
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7712
+       "(ZIP_LONGMPY)"
7713
+       "MPY\t%3+%2,%0"
7714
+       [(set_attr "ccresult" "set")])
7715
+(define_insn "mul<mode>3_off_clobber"
7716
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7717
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7718
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7719
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7720
+       (clobber (reg:CC CC_REG))]
7721
+       "(ZIP_LONGMPY)"
7722
+       "MPY\t%3+%2,%0"
7723
+       [(set_attr "ccresult" "set")])
7724
+;
7725
+;
7726
+(define_expand "smulsi3_highpart"
7727
+       [(set (match_operand:SI 0 "register_operand" "=r")
7728
+           (truncate:SI (ashiftrt:DI (mult:DI
7729
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7730
+               (sign_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
7731
+               (const_int 32))))]
7732
+       "(ZIP_LONGMPY)")
7733
+(define_insn_and_split "smulsi3_highpart_split_reg"
7734
+       [(set (match_operand:SI 0 "register_operand" "=r")
7735
+           (truncate:SI (ashiftrt:DI (mult:DI
7736
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7737
+               (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7738
+               (const_int 32))))]
7739
+       "(ZIP_LONGMPY)"
7740
+       "#"
7741
+       "(reload_completed)"
7742
+       [(parallel [(set (match_dup 0)
7743
+               (truncate:SI (ashiftrt:DI
7744
+                       (mult:DI
7745
+                               (sign_extend:DI (match_dup 1))
7746
+                               (sign_extend:DI (match_dup 2)))
7747
+                       (const_int 32))))
7748
+       (clobber (reg:CC CC_REG))])]
7749
+       ""
7750
+       [(set_attr "ccresult" "set")])
7751
+(define_insn_and_split "smulsi3_highpart_split_off"
7752
+       [(set (match_operand:SI 0 "register_operand" "=r")
7753
+          (truncate:SI (ashift:DI (mult:DI
7754
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7755
+               (sign_extend:DI
7756
+                       (plus:SI (match_operand:SI 2 "register_operand" "r")
7757
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7758
+                       (const_int 32))))]
7759
+       "(ZIP_LONGMPY)"
7760
+       "#"
7761
+       "(reload_completed)"
7762
+       [(parallel [(set (match_dup 0)
7763
+               (truncate:SI (ashiftrt:DI
7764
+                       (mult:SI
7765
+                               (sign_extend:DI (match_dup 1))
7766
+                               (sign_extend:DI
7767
+                                       (plus:SI (match_dup 2) (match_dup 3))))
7768
+                       (const_int 32))))
7769
+       (clobber (reg:CC CC_REG))])]
7770
+       ""
7771
+       [(set_attr "ccresult" "set")])
7772
+(define_insn "smulsi3_highpart_reg_clobber"
7773
+       [(set (match_operand:SI 0 "register_operand" "=r")
7774
+            (truncate:SI (ashiftrt:DI
7775
+               (mult:SI
7776
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7777
+                 (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7778
+               (const_int 32))))
7779
+       (clobber (reg:CC CC_REG))]
7780
+       "(ZIP_LONGMPY)"
7781
+       "MPYSHI\t%2,%0"
7782
+       [(set_attr "ccresult" "set")])
7783
+(define_insn "smulsi3_highpart_reg_raw"
7784
+       [(set (match_operand:SI 0 "register_operand" "=r")
7785
+           (truncate:SI (ashiftrt:DI
7786
+               (mult:SI
7787
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7788
+                 (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7789
+               (const_int 32))))
7790
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7791
+       "(ZIP_LONGMPY)"
7792
+       "MPYSHI\t%2,%0"
7793
+       [(set_attr "ccresult" "set")])
7794
+(define_insn "smulsi3_highpart_off_raw"
7795
+       [(set (match_operand:SI 0 "register_operand" "=r")
7796
+           (truncate:SI (ashiftrt:DI
7797
+               (mult:SI
7798
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7799
+                 (sign_extend:DI (plus:SI
7800
+                               (match_operand:SI 2 "register_operand" "r")
7801
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7802
+               (const_int 32))))
7803
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7804
+       "(ZIP_LONGMPY)"
7805
+       "MPYSHI\t%3+%2,%0"
7806
+       [(set_attr "ccresult" "set")])
7807
+(define_insn "smulsi3_highpart_off_clobber"
7808
+       [(set (match_operand:SI 0 "register_operand" "=r")
7809
+           (truncate:SI (ashiftrt:DI
7810
+               (mult:SI
7811
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7812
+                 (sign_extend:DI (plus:SI
7813
+                       (match_operand:SI 2 "register_operand" "r")
7814
+                       (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7815
+               (const_int 32))))
7816
+       (clobber (reg:CC CC_REG))]
7817
+       "(ZIP_LONGMPY)"
7818
+       "MPYSHI\t%3+%2,%0"
7819
+       [(set_attr "ccresult" "set")])
7820
+;
7821
+;
7822
+(define_expand "umulsi3_highpart"
7823
+       [(set (match_operand:SI 0 "register_operand" "=r")
7824
+           (truncate:SI (ashiftrt:DI (mult:DI
7825
+               (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7826
+               (zero_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
7827
+               (const_int 32))))]
7828
+       "(ZIP_LONGMPY)")
7829
+(define_insn_and_split "umulsi3_highpart_split_reg"
7830
+       [(set (match_operand:SI 0 "register_operand" "=r")
7831
+           (truncate:SI (ashiftrt:DI (mult:DI
7832
+               (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7833
+               (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7834
+               (const_int 32))))]
7835
+       "(ZIP_LONGMPY)"
7836
+       "#"
7837
+       "(reload_completed)"
7838
+       [(parallel [(set (match_dup 0)
7839
+               (truncate:SI (ashiftrt:DI
7840
+                       (mult:SI
7841
+                               (zero_extend:DI (match_dup 1))
7842
+                               (zero_extend:DI (match_dup 2)))
7843
+                       (const_int 32))))
7844
+       (clobber (reg:CC CC_REG))])]
7845
+       ""
7846
+       [(set_attr "ccresult" "set")])
7847
+(define_insn_and_split "umulsi3_highpart_split_off"
7848
+       [(set (match_operand:SI 0 "register_operand" "=r")
7849
+               (truncate:SI (ashiftrt:DI
7850
+               (mult:DI
7851
+                 (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7852
+                 (zero_extend:DI
7853
+                       (plus:SI (match_operand:SI 2 "register_operand" "r")
7854
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7855
+               (const_int 32))))]
7856
+       "(ZIP_LONGMPY)"
7857
+       "#"
7858
+       "(reload_completed)"
7859
+       [(parallel [(set (match_dup 0)
7860
+               (truncate:SI (ashiftrt:DI
7861
+                       (mult:DI
7862
+                               (zero_extend:DI (match_dup 1))
7863
+                               (zero_extend:DI
7864
+                                       (plus:SI (match_dup 2) (match_dup 3))))
7865
+                       (const_int 32))))
7866
+       (clobber (reg:CC CC_REG))])]
7867
+       ""
7868
+       [(set_attr "ccresult" "set")])
7869
+(define_insn "umulsi3_highpart_reg_clobber"
7870
+       [(set (match_operand:SI 0 "register_operand" "=r")
7871
+           (truncate:SI (ashiftrt:DI
7872
+               (mult:DI
7873
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7874
+                   (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7875
+               (const_int 32))))
7876
+       (clobber (reg:CC CC_REG))]
7877
+       "(ZIP_LONGMPY)"
7878
+       "MPYSHI\t%2,%0"
7879
+       [(set_attr "ccresult" "set")])
7880
+(define_insn "umulsi3_highpart_reg_raw"
7881
+       [(set (match_operand:SI 0 "register_operand" "=r")
7882
+           (truncate:SI (ashiftrt:DI
7883
+               (mult:DI
7884
+                  (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7885
+                  (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7886
+               (const_int 32))))
7887
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7888
+       "(ZIP_LONGMPY)"
7889
+       "MPYSHI\t%2,%0"
7890
+       [(set_attr "ccresult" "set")])
7891
+(define_insn "umulsi3_highpart_off_raw"
7892
+       [(set (match_operand:SI 0 "register_operand" "=r")
7893
+           (truncate:SI (ashiftrt:DI
7894
+               (mult:DI
7895
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7896
+                   (zero_extend:DI (plus:SI
7897
+                               (match_operand:SI 2 "register_operand" "r")
7898
+                               (match_operand:DI 3 "zip_opb_immv_p" "N"))))
7899
+               (const_int 32))))
7900
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7901
+       "(ZIP_LONGMPY)"
7902
+       "MPYSHI\t%3+%2,%0"
7903
+       [(set_attr "ccresult" "set")])
7904
+(define_insn "umulsi3_highpart_off_clobber"
7905
+       [(set (match_operand:SI 0 "register_operand" "=r")
7906
+           (truncate:SI (ashiftrt:DI
7907
+               (mult:DI
7908
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7909
+                   (zero_extend:DI (plus:SI
7910
+                       (match_operand:SI 2 "register_operand" "r")
7911
+                       (match_operand:DI 3 "zip_opb_immv_p" "N"))))
7912
+               (const_int 32))))
7913
+       (clobber (reg:CC CC_REG))]
7914
+       "(ZIP_LONGMPY)"
7915
+       "MPYSHI\t%3+%2,%0"
7916
+       [(set_attr "ccresult" "set")])
7917
+;
7918
+;
7919 111 dgisselq
+(define_expand "div<mode>3"
7920 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7921 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7922 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7923
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7924 111 dgisselq
+       "(ZIP_DIVIDE)")
7925
+(define_insn "div<mode>3_reg"
7926
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7927
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7928 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7929
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7930 111 dgisselq
+       "(ZIP_DIVIDE)"
7931 102 dgisselq
+       "DIVS   %2,%0"
7932
+       [(set_attr "ccresult" "set")])
7933
+(define_insn "div<mode>3_off"
7934
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7935 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7936
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7937 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7938
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7939 111 dgisselq
+       "(ZIP_DIVIDE)"
7940 102 dgisselq
+       "DIVS   %3+%2,%0"
7941
+       [(set_attr "ccresult" "set")])
7942 111 dgisselq
+(define_expand "udiv<mode>3"
7943 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7944 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7945 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7946
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7947 111 dgisselq
+       "(ZIP_DIVIDE)")
7948
+(define_insn "udiv<mode>3_reg"
7949
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7950
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7951 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7952
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7953 111 dgisselq
+       "(ZIP_DIVIDE)"
7954 102 dgisselq
+       "DIVU   %2,%0"
7955
+       [(set_attr "ccresult" "set")])
7956
+(define_insn "udiv<mode>3_off"
7957
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7958 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7959
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7960 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7961
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7962 111 dgisselq
+       "(ZIP_DIVIDE)"
7963 102 dgisselq
+       "DIVU   %3+%2,%0"
7964
+       [(set_attr "ccresult" "set")])
7965
+;;
7966
+;; modsi3
7967
+;; umodsi3
7968
+;;
7969
+(define_insn "umin<mode>3"
7970
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7971
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
7972
+                       (match_operand:ZI 2 "register_operand" "r")))
7973 122 dgisselq
+       (clobber (reg:CC CC_REG))
7974 102 dgisselq
+       ]
7975
+       ""
7976
+       "CMP    %0,%2
7977
+       MOV.C   %2,%0"
7978
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7979
+(define_insn "umax<mode>3"
7980
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7981
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
7982
+                       (match_operand:ZI 2 "register_operand" "r")))
7983 122 dgisselq
+       (clobber (reg:CC CC_REG))
7984 102 dgisselq
+       ]
7985
+       ""
7986
+       "CMP    %2,%0
7987
+       MOV.C   %2,%0"
7988
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7989
+(define_insn "smin<mode>3"
7990
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7991
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
7992
+                       (match_operand:ZI 2 "register_operand" "r")))
7993 122 dgisselq
+       (clobber (reg:CC CC_REG))
7994 102 dgisselq
+       ]
7995
+       ""
7996
+       "CMP    %2,%0
7997
+       MOV.GT  %2,%0"
7998
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7999
+(define_insn "smax<mode>3"
8000
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8001
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
8002
+                       (match_operand:ZI 2 "register_operand" "r")))
8003 122 dgisselq
+       (clobber (reg:CC CC_REG))
8004 102 dgisselq
+       ]
8005
+       ""
8006
+       "CMP    %0,%2
8007
+       MOV.LT  %2,%0"
8008
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8009 127 dgisselq
+;
8010
+;
8011 111 dgisselq
+(define_expand "and<mode>3"
8012 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8013 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8014 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
8015
+(define_insn_and_split "and<mode>3_reg_split"
8016 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8017
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8018 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8019
+       ""
8020
+       "#"
8021
+       "(reload_completed)"
8022
+       [(parallel [(set (match_dup 0) (and:ZI (match_dup 1) (match_dup 2)))
8023
+       (clobber (reg:CC CC_REG))])]
8024
+       ""
8025
+       [(set_attr "ccresult" "set")])
8026
+(define_insn "and<mode>3_reg_raw"
8027
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8028
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8029 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8030
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8031 102 dgisselq
+       ""
8032
+       "AND    %2,%0"
8033
+       [(set_attr "ccresult" "set")])
8034 127 dgisselq
+(define_insn "and<mode>3_reg_clobber"
8035 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8036 127 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8037
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8038
+       (clobber (reg:CC CC_REG))]
8039
+       ""
8040
+       "AND    %2,%0"
8041
+       [(set_attr "ccresult" "set")])
8042
+(define_insn_and_split "and<mode>3_off_split"
8043
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8044 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8045
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8046 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8047
+       ""
8048
+       "#"
8049
+       "(reload_completed)"
8050
+       [(parallel [(set (match_dup 0) (and:ZI (match_dup 1)
8051
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8052
+       (clobber (reg:CC CC_REG))])]
8053
+       ""
8054
+       [(set_attr "ccresult" "set")])
8055
+(define_insn "and<mode>3_off_raw"
8056
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8057
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8058
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8059 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8060
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8061 102 dgisselq
+       ""
8062
+       "AND    %3+%2,%0"
8063
+       [(set_attr "ccresult" "set")])
8064 127 dgisselq
+(define_insn "and<mode>3_off_clobber"
8065
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8066
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8067
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8068
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8069
+       (clobber (reg:CC CC_REG))]
8070
+       ""
8071
+       "AND    %3+%2,%0"
8072
+       [(set_attr "ccresult" "set")])
8073
+;
8074
+;
8075 111 dgisselq
+(define_expand "ior<mode>3"
8076 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8077 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8078 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
8079
+(define_insn_and_split "ior<mode>3_reg_split"
8080 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8081
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8082 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8083
+       ""
8084
+       "#"
8085
+       "(reload_completed)"
8086
+       [(parallel [(set (match_dup 0) (ior:ZI (match_dup 1) (match_dup 2)))
8087
+       (clobber (reg:CC CC_REG))])]
8088
+       ""
8089
+       [(set_attr "ccresult" "set")])
8090
+(define_insn "ior<mode>3_reg_raw"
8091
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8092
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8093 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8094
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8095 102 dgisselq
+       ""
8096
+       "OR     %2,%0"
8097
+       [(set_attr "ccresult" "set")])
8098 127 dgisselq
+(define_insn "ior<mode>3_reg_clobber"
8099 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8100 127 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8101
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8102
+       (clobber (reg:CC CC_REG))]
8103
+       ""
8104
+       "OR     %2,%0"
8105
+       [(set_attr "ccresult" "set")])
8106
+(define_insn_and_split "ior<mode>3_off_split"
8107
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8108 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8109
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8110 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8111
+       ""
8112
+       "#"
8113
+       "(reload_completed)"
8114
+       [(parallel [(set (match_dup 0) (ior:ZI (match_dup 1)
8115
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8116
+       (clobber (reg:CC CC_REG))])]
8117
+       ""
8118
+       [(set_attr "ccresult" "set")])
8119
+(define_insn "ior<mode>3_off_raw"
8120
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8121
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8122
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8123 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8124
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8125 102 dgisselq
+       ""
8126
+       "OR     %3+%2,%0"
8127
+       [(set_attr "ccresult" "set")])
8128 127 dgisselq
+(define_insn "ior<mode>3_off_clobber"
8129
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8130
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8131
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8132
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8133
+       (clobber (reg:CC CC_REG))]
8134
+       ""
8135
+       "OR     %3+%2,%0"
8136
+       [(set_attr "ccresult" "set")])
8137
+;
8138
+;
8139
+;
8140 111 dgisselq
+(define_expand "xor<mode>3"
8141 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
8142 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8143 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
8144
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
8145
+       "")
8146 127 dgisselq
+(define_insn_and_split "xor<mode>3_reg_split"
8147 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8148
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8149 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8150
+       ""
8151
+       "#"
8152
+       "(reload_completed)"
8153
+       [(parallel [(set (match_dup 0) (xor:ZI (match_dup 1) (match_dup 2)))
8154
+       (clobber (reg:CC CC_REG))])]
8155
+       ""
8156
+       [(set_attr "ccresult" "set")])
8157
+(define_insn "xor<mode>3_reg_raw"
8158
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8159
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8160 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8161
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8162 102 dgisselq
+       ""
8163
+       "XOR    %2,%0"
8164
+       [(set_attr "ccresult" "set")])
8165 127 dgisselq
+(define_insn "xor<mode>3_reg_clobber"
8166 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8167 127 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8168
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8169
+       (clobber (reg:CC CC_REG))]
8170
+       ""
8171
+       "XOR    %2,%0"
8172
+       [(set_attr "ccresult" "set")])
8173
+(define_insn_and_split "xor<mode>3_off_split"
8174
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8175 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8176
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8177 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8178
+       ""
8179
+       "#"
8180
+       "(reload_completed)"
8181
+       [(parallel [(set (match_dup 0) (xor:ZI (match_dup 1)
8182
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8183
+       (clobber (reg:CC CC_REG))])]
8184
+       ""
8185
+       [(set_attr "ccresult" "set")])
8186
+(define_insn "xor<mode>3_off_raw"
8187
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8188
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8189
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8190 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8191
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8192 102 dgisselq
+       ""
8193
+       "XOR    %3+%2,%0"
8194
+       [(set_attr "ccresult" "set")])
8195 127 dgisselq
+(define_insn "xor<mode>3_off_clobber"
8196
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8197
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8198
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8199
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8200
+       (clobber (reg:CC CC_REG))]
8201
+       ""
8202
+       "XOR    %3+%2,%0"
8203
+       [(set_attr "ccresult" "set")])
8204 102 dgisselq
+;(define_insn "addv<mode>4"
8205
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
8206
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
8207
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
8208 122 dgisselq
+       ;(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
8209 102 dgisselq
+                       ;(label_ref (match_operand 3))
8210
+                       ;(pc)))]
8211
+       ;""
8212
+       ;"MOV   %1,%0
8213
+       ;ADD    %2,%0
8214
+       ;BV     %3"
8215
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8216
+;;(define_insn "subvsi4"
8217
+;;     MOV     %1,%0
8218
+;;     SUB     %2,%0
8219
+;;     BV      %3
8220
+;;(mulvsi4)
8221
+;;(define_insn "uaddvsi4"
8222
+;;     ADD     %2,%0
8223
+;;     BC      %3
8224
+;;(define_insn "usubvsi4"
8225
+;;     MOV     %1,%0
8226
+;;     SUB     %2,%0
8227
+;;     BC      %3
8228
+;;
8229
+;; (define_insn "umulvsi4"
8230
+;;     ... ???)
8231
+;;
8232 127 dgisselq
+(define_expand "ashr<mode>3"
8233 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8234
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8235 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8236
+(define_insn_and_split "ashr<mode>3_split"
8237
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8238
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8239
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8240
+       ""
8241
+       "#"
8242
+       "(reload_completed)"
8243
+       [(parallel [(set (match_dup 0) (ashiftrt:ZI (match_dup 1) (match_dup 2)))
8244
+       (clobber (reg:CC CC_REG))])]
8245
+       ""
8246
+       [(set_attr "ccresult" "set")])
8247
+(define_insn "ashr<mode>3_raw"
8248
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8249
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8250 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8251
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8252 102 dgisselq
+       ""
8253
+       "ASR    %2,%0"
8254
+       [(set_attr "ccresult" "set")])
8255 127 dgisselq
+(define_insn "ashr<mode>3_clobber"
8256 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8257 127 dgisselq
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8258
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8259
+       (clobber (reg:CC CC_REG))]
8260
+       ""
8261
+       "ASR    %2,%0"
8262
+       [(set_attr "ccresult" "set")])
8263
+;
8264
+;
8265
+(define_expand "ashl<mode>3"
8266
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8267 111 dgisselq
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8268 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8269
+(define_insn_and_split "ashl<mode>3_split"
8270
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8271
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8272
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8273
+       ""
8274
+       "#"
8275
+       "(reload_completed)"
8276
+       [(parallel [(set (match_dup 0) (ashift:ZI (match_dup 1) (match_dup 2)))
8277
+       (clobber (reg:CC CC_REG))])]
8278
+       ""
8279
+       [(set_attr "ccresult" "set")])
8280
+(define_insn "ashl<mode>3_raw"
8281
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8282
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8283 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8284
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8285 111 dgisselq
+       ""
8286 122 dgisselq
+       "LSL    %2,%0"
8287 111 dgisselq
+       [(set_attr "ccresult" "set")])
8288 127 dgisselq
+(define_insn "ashl<mode>3_clobber"
8289 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8290 127 dgisselq
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8291
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8292
+       (clobber (reg:CC CC_REG))]
8293
+       ""
8294
+       "LSL    %2,%0"
8295
+       [(set_attr "ccresult" "set")])
8296
+;
8297
+;
8298
+(define_expand "lshr<mode>3"
8299
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8300 102 dgisselq
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8301 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8302
+(define_insn_and_split "lshr<mode>3_split"
8303
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8304
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8305
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8306
+       ""
8307
+       "#"
8308
+       "(reload_completed)"
8309
+       [(parallel [(set (match_dup 0) (lshiftrt:ZI (match_dup 1) (match_dup 2)))
8310
+       (clobber (reg:CC CC_REG))])]
8311
+       ""
8312
+       [(set_attr "ccresult" "set")])
8313
+(define_insn "lshr<mode>3_raw"
8314
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8315
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8316
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8317 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8318 102 dgisselq
+       ""
8319
+       "LSR    %2,%0"
8320
+       [(set_attr "ccresult" "set")])
8321 127 dgisselq
+(define_insn "lshr<mode>3_clobber"
8322 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8323 127 dgisselq
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8324
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8325
+       (clobber (reg:CC CC_REG))]
8326
+       ""
8327
+       "LSR    %2,%0"
8328
+       [(set_attr "ccresult" "set")])
8329
+;
8330
+;
8331
+(define_expand "rotl<mode>3"
8332
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8333 102 dgisselq
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8334 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8335
+(define_insn_and_split "rotl<mode>3_split"
8336
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8337
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8338
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8339
+       ""
8340
+       "#"
8341
+       "(reload_completed)"
8342
+       [(parallel [(set (match_dup 0) (rotate:ZI (match_dup 1) (match_dup 2)))
8343
+       (clobber (reg:CC CC_REG))])]
8344
+       ""
8345
+       [(set_attr "ccresult" "set")])
8346
+(define_insn "rotl<mode>3_raw"
8347
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8348
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8349 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8350
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8351 102 dgisselq
+       ""
8352
+       "ROL    %2,%0"
8353
+       [(set_attr "ccresult" "set")])
8354 127 dgisselq
+(define_insn "rotl<mode>3_clobber"
8355
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8356
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8357
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8358
+       (clobber (reg:CC CC_REG))]
8359
+       ""
8360
+       "ROL    %2,%0"
8361
+       [(set_attr "ccresult" "set")])
8362 102 dgisselq
+;
8363 127 dgisselq
+;
8364
+;
8365 102 dgisselq
+(define_insn "neg<mode>2"
8366
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8367
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
8368 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8369 102 dgisselq
+       ""
8370
+       "NEG    %1,%0"
8371
+       [(set_attr "ccresult" "validzn")])
8372
+(define_insn "abs<mode>2"
8373
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8374
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
8375 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8376 102 dgisselq
+       ""
8377
+       "TEST   %0
8378
+       NEG.LT  %0"
8379
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8380
+(define_insn "popcount<mode>2"
8381
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8382
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
8383 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8384 102 dgisselq
+       ""
8385
+       "POPC   %1,%0"
8386
+       [(set_attr "ccresult" "set")])
8387
+(define_expand "parity<mode>2"
8388 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
8389 102 dgisselq
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
8390 127 dgisselq
+               (clobber (reg:CC CC_REG))])
8391 122 dgisselq
+       (parallel [
8392
+               (set (match_dup 0) (and:ZI (match_dup 0) (const_int -2)))
8393
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
8394 102 dgisselq
+       ])
8395
+(define_insn "one_cmpl<mode>2"
8396
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8397
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
8398 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8399 102 dgisselq
+       ""
8400
+       "XOR    -1,%0"
8401
+       [(set_attr "ccresult" "set")])
8402
+;
8403
+;
8404
+;
8405
+;
8406 117 dgisselq
+;
8407 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8408
+;;
8409
+;; General arithmetic instructions -- double words
8410
+;;
8411
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8412
+;
8413
+;
8414
+;
8415 111 dgisselq
+(define_expand "movdi3"
8416
+       [(set (match_operand:DI 0 "nonimmediate_operand" "")
8417
+               (match_operand:DI 1 "general_operand" ""))])
8418
+(define_insn "movdi_lod"
8419
+       [(set (match_operand:DI 0 "register_operand" "=r")
8420 122 dgisselq
+               (mem:DI (match_operand:SI 1 "zip_opb_operand_p" "")))]
8421 111 dgisselq
+       ""
8422
+       {
8423 122 dgisselq
+               if (REG_P(operands[1]))
8424 111 dgisselq
+                       return "LOD\t(%1),%H0\n\tLOD\t1(%1),%L0";
8425 122 dgisselq
+               else if (GET_CODE(operands[1])==PLUS) {
8426
+                       if ((REG_P(XEXP(operands[1],0)))
8427
+                               &&(CONST_INT_P(XEXP(operands[1],1)))) {
8428 111 dgisselq
+                               static  char    buf[64];
8429
+                               sprintf(buf,
8430
+                                       "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
8431 138 dgisselq
+                                       (long)INTVAL(XEXP(operands[1],1)),
8432
+                                       (long)INTVAL(XEXP(operands[1],1)+1));
8433 111 dgisselq
+                               return buf;
8434
+                       }
8435 122 dgisselq
+               } return "BREAK";
8436 111 dgisselq
+       }
8437
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8438
+(define_insn "movdi_sto"
8439
+       [(set (mem:DI (match_operand:SI 0 "zip_opb_operand_p" ""))
8440
+               (match_operand:DI 1 "register_operand" "r"))]
8441
+       ""
8442
+       {
8443
+               if (REG_P(operands[0]))
8444
+                       return "STO\t%H0,(%1)\n\tSTO\t%L0,1(%1)";
8445
+               else if (GET_CODE(operands[0])==PLUS) {
8446
+                       if ((REG_P(XEXP(operands[0],0)))
8447
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
8448
+                               static  char    buf[64];
8449
+                               sprintf(buf,
8450
+                                       "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
8451 138 dgisselq
+                                       (long)INTVAL(XEXP(operands[0],1)),
8452
+                                       (long)INTVAL(XEXP(operands[0],1)+1));
8453 111 dgisselq
+                               return buf;
8454
+                       }
8455 127 dgisselq
+               } return "BREAK";
8456 111 dgisselq
+       }
8457
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8458
+(define_insn "movdi_ldi"
8459
+       [(set (match_operand:DI 0 "register_operand" "=r")
8460
+               (match_operand:DI 1 "immediate_operand" "i"))]
8461
+       ""
8462
+       "LDI\t%H1,%H0\n\tLDI\t%L1,%L0"
8463
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8464 102 dgisselq
+(define_insn "adddi3" ; Fastest/best instruction always goes first
8465
+       [(set (match_operand:DI 0 "register_operand" "=r")
8466 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
8467 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
8468 122 dgisselq
+       (clobber (reg:CC CC_REG))
8469 102 dgisselq
+       ]
8470
+       ""
8471
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
8472
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8473
+;
8474
+(define_insn "subdi3"
8475
+       [(set (match_operand:DI 0 "register_operand" "=r")
8476 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
8477 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
8478 122 dgisselq
+       (clobber (reg:CC CC_REG))
8479 102 dgisselq
+       ]
8480
+       ""
8481
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
8482
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8483
+;
8484
+(define_insn "anddi3"
8485
+       [(set (match_operand:DI 0 "register_operand" "=r")
8486
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
8487
+                       (match_operand:DI 2 "register_operand" "r")))
8488 122 dgisselq
+       (clobber (reg:CC CC_REG))
8489 102 dgisselq
+       ]
8490
+       ""
8491
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
8492
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8493
+;
8494
+(define_insn "iordi3"
8495
+       [(set (match_operand:DI 0 "register_operand" "=r")
8496
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
8497
+                       (match_operand:DI 2 "register_operand" "r")))
8498 122 dgisselq
+       (clobber (reg:CC CC_REG))
8499 102 dgisselq
+       ]
8500
+       ""
8501
+       "OR     %2,%0\n\tOR\t%H2,%H0"
8502
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8503
+;
8504
+(define_insn "xordi3"
8505
+       [(set (match_operand:DI 0 "register_operand" "=r")
8506
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
8507
+                       (match_operand:DI 2 "register_operand" "r")))
8508 122 dgisselq
+       (clobber (reg:CC CC_REG))
8509 102 dgisselq
+       ]
8510
+       ""
8511
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
8512
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8513
+;
8514
+(define_insn "negdi2"
8515
+       [(set (match_operand:DI 0 "register_operand" "=r")
8516 122 dgisselq
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))
8517
+       (clobber (reg:CC CC_REG))
8518
+       ]
8519 102 dgisselq
+       ""
8520
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
8521
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8522
+;
8523
+(define_insn "absdi2"
8524 122 dgisselq
+       [(set (match_operand:DI 0 "register_operand" "=r")
8525
+               (abs:DI (match_operand:DI 1 "register_operand" "0")))
8526
+       (clobber (match_scratch:SI 2 "=r"))
8527
+       (clobber (reg:CC CC_REG))
8528
+       ]
8529 102 dgisselq
+       ""
8530
+       "CLR    %2
8531
+       TEST    %H0             ; Problem, we can't tell conditions
8532
+       LDILO.LT        1,%2
8533
+       XOR.LT  -1,%L0
8534
+       XOR.LT  -1,%H0
8535
+       ADD     %2,%L0
8536 122 dgisselq
+       ADD.C   1,%H0"
8537 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8538
+(define_insn "one_cmpldi2"
8539
+       [(set (match_operand:DI 0 "register_operand" "=r")
8540
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
8541 122 dgisselq
+       (clobber (reg:CC CC_REG))
8542 102 dgisselq
+       ]
8543
+       ""
8544
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
8545
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8546
+(define_insn "umindi3"
8547
+       [(set (match_operand:DI 0 "register_operand" "=r")
8548
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
8549
+                       (match_operand:DI 2 "register_operand" "r")))
8550 122 dgisselq
+       (clobber (reg:CC CC_REG))
8551 102 dgisselq
+       ]
8552
+       ""
8553
+       "CMP    %H0,%H2
8554
+       CMP.Z   %L0,%L2
8555
+       MOV.C   %H2,%H0
8556
+       MOV.C   %L2,%L0"
8557
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8558
+(define_insn "umaxdi3"
8559
+       [(set (match_operand:DI 0 "register_operand" "=r")
8560
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
8561
+                       (match_operand:DI 2 "register_operand" "r")))
8562 122 dgisselq
+       (clobber (reg:CC CC_REG))
8563 102 dgisselq
+       ]
8564
+       ""
8565
+       "CMP    %H2,%H0
8566
+       CMP.Z   %L2,%L0
8567
+       MOV.C   %H2,%H0
8568
+       MOV.C   %L2,%L0"
8569
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8570
+(define_insn "popcountdi2"
8571
+       [(set (match_operand:SI 0 "register_operand" "=r")
8572 122 dgisselq
+               (popcount:SI (match_operand:DI 1 "register_operand" "r")))
8573 102 dgisselq
+       (clobber (match_scratch:SI 2 "=r"))
8574 122 dgisselq
+       (clobber (reg:CC CC_REG))
8575 102 dgisselq
+       ]
8576
+       ""
8577
+       "POPC   %L1,%0
8578
+       POPC    %H1,%2
8579
+       ADD     %2,%0"
8580
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8581
+(define_expand "paritydi2"
8582
+       [(set (match_operand:SI 0 "register_operand" "=r")
8583
+               (popcount (match_operand:DI 1 "register_operand" "r")))
8584
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
8585
+       ])
8586 117 dgisselq
+;(define_insn "extendsidi2"
8587
+;      [(set (match_operand:DI 0 "register_operand" "=r")
8588
+;              (sign_extend:DI (match_operand:SI 0 "register_operand" "r")))]
8589
+;      ""
8590
+;      "TEST\t%1\nMOV\t%1,%L0\nCLR\t%L1\nLDI.LT\t-1,%L1"
8591
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8592
+;(define_insn "mulsidi3"
8593
+;      [(set (match_operand:DI 0 "register_operand" "=r")
8594
+;              (mult:SI (match_operand:SI 1 "register_operand" "%r")
8595
+;                      (match_operand:SI 2 "register_operand" "r")))
8596
+;      (clobber (match_scratch:SI 3 "=r"))]
8597
+;      ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
8598
+;      ""
8599
+;      "MOV    %1,%L0
8600
+;      MPYS    %2,%L0                  ; L0 = R2 * R1
8601
+;      MOV     %1,%3                   ; R3 = R1
8602
+;      ROL     16,%3                   ; R3 = (R1 <<< 16)
8603
+;      MPYS    %2,%3                   ; R3 = (R1 <<< 16) * R2
8604
+;      ROL     16,%3                   ; R3 = upper bits of (R1<<<16)*R2
8605
+;      AND     0x0ffff,%3
8606
+;      ADD     %3,%L0                  ; L0 = L0 + R3 = L0  + (R1>>16)*R2
8607
+;      MOV     %2,%3
8608
+;      ROL     16,%3
8609
+;      MPYS    %1,%3
8610
+;      ROL     16,%3
8611
+;      AND     0x0ffff,%3
8612
+;      ADD     %3,%0"
8613
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8614
+
8615 102 dgisselq
+;
8616
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
8617
+;      mult:di, div:di, divu:di
8618
+;
8619
+;
8620
+;
8621
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8622
+;;
8623
+;; Conditional arithmetic instructions
8624
+;;
8625
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8626
+;
8627
+;
8628
+;
8629
+;
8630
+(define_expand "cstore<mode>4" ; Store 0 or 1 in %0 based on cmp between %2&%3
8631 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 2 "register_operand" "r")
8632
+               (match_operand:ZI 3 "zip_opb_operand_p" "rO")))
8633 102 dgisselq
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8634
+                       (match_operator 1 "ordered_comparison_operator"
8635 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
8636 102 dgisselq
+                       (const_int 1) (const_int 0)))]
8637
+       ""
8638
+       )
8639
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
8640
+       [(set (match_operand:SI 0 "register_operand" "=r")
8641
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
8642 122 dgisselq
+                       [(match_operand:DI 2 "register_operand" "r")
8643
+                               (match_operand:DI 3 "register_operand" "r")])
8644
+                       (const_int 1) (const_int 0)))
8645
+       (clobber (reg:CC CC_REG))]
8646 102 dgisselq
+       ""
8647
+       {
8648
+               switch(GET_CODE(operands[1])) {
8649
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
8650
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
8651
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
8652
+               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";
8653
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
8654
+               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";
8655
+               default:
8656
+                       gcc_unreachable();
8657
+               }
8658
+       }
8659
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8660
+;
8661
+;
8662
+;
8663
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8664
+;;
8665
+;; Comparison instructions, both compare and test
8666
+;;
8667
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8668
+;
8669
+;
8670
+;
8671
+;; This will only work so well, since the direction of the compare is
8672
+;; important in unsigned compares.
8673
+;;
8674 122 dgisselq
+(define_expand "cmp<mode>"
8675
+       [(set (reg:CC CC_REG) (compare:CC
8676
+               (match_operand:ZI 0 "register_operand" "r")
8677
+               (match_operand:ZI 1 "nonmemory_operand" "")))]
8678 102 dgisselq
+       ""
8679 122 dgisselq
+       {
8680
+               if (!zip_opb_operand_p(operands[1],SImode)) {
8681
+                       if (can_create_pseudo_p()) {
8682
+                               //; fprintf(stderr, "Generating pseudo register for compare\n");
8683
+                               rtx tmp = gen_reg_rtx(SImode);
8684
+                               emit_insn(gen_movsi(tmp,operands[1]));
8685
+                               operands[1] = tmp;
8686
+                       } else FAIL;
8687
+               }
8688
+       })
8689
+(define_insn "cmp<mode>_reg"
8690
+       [(set (reg:CC CC_REG) (compare:CC
8691
+               (match_operand:ZI 0 "register_operand" "r")
8692
+               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO")))]
8693
+       ""
8694 102 dgisselq
+       "CMP\t%1,%0"
8695
+       [(set_attr "ccresult" "set")])
8696
+(define_insn "cmp<mode>_off"
8697 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8698
+               (match_operand:ZI 0 "register_operand" "r")
8699 138 dgisselq
+               (plus:SI (match_operand:ZI 1 "register_operand" "r")
8700 122 dgisselq
+                       (match_operand 2 "zip_opb_immv_p" "N"))))]
8701 102 dgisselq
+       ""
8702
+       "CMP\t%2+%1,%0"
8703
+       [(set_attr "ccresult" "set")])
8704
+(define_insn "test<mode>"
8705 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_operand:ZI 0 "register_operand" "r")
8706
+                               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO"))
8707 102 dgisselq
+                       (const_int 0)))]
8708
+       ""
8709
+       "TEST   %1,%0"
8710
+       [(set_attr "ccresult" "set")])
8711
+(define_insn "test<mode>_off"
8712 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8713
+               (and:ZI (match_operand:ZI 0 "register_operand" "r")
8714
+                       (plus:ZI
8715
+                               (match_operand:ZI 1 "register_operand" "r")
8716
+                               (match_operand:ZI 2 "zip_opb_immv_p" "N")))
8717
+               (const_int 0)))]
8718 102 dgisselq
+       ""
8719
+       "TEST   %2+%1,%0"
8720
+       [(set_attr "ccresult" "set")])
8721
+(define_insn "nop"
8722
+       [(const_int 0)]
8723
+       ""
8724
+       "NOOP"
8725
+       [(set_attr "ccresult" "unchanged")])
8726
+;
8727
+;
8728
+;
8729
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8730
+;;
8731
+;; Conditional execution predicates
8732
+;;
8733
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8734
+;
8735
+; Sadly, these aren't complete like they should be.  Although these are all of
8736
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
8737
+; other conditions then these.  That is, (cond_exec ...) is not as well
8738
+; recognized as (if_then_else ...).  So we have to duplicate things to support
8739
+; both methods.
8740
+;
8741
+(define_cond_exec
8742 122 dgisselq
+       [(ne (reg:CC CC_REG) (const_int 0))]
8743 102 dgisselq
+       ""
8744
+       "(NZ)"
8745
+       [(set_attr "conditional" "yes")])
8746
+(define_cond_exec
8747 122 dgisselq
+       [(lt (reg:CC CC_REG) (const_int 0))]
8748 102 dgisselq
+       ""
8749
+       "(LT)"
8750
+       [(set_attr "conditional" "yes")])
8751
+(define_cond_exec
8752 122 dgisselq
+       [(eq (reg:CC CC_REG) (const_int 0))]
8753 102 dgisselq
+       ""
8754
+       "(Z)"
8755
+       [(set_attr "conditional" "yes")])
8756
+(define_cond_exec
8757 122 dgisselq
+       [(gt (reg:CC CC_REG) (const_int 0))]
8758 102 dgisselq
+       ""
8759
+       "(GT)"
8760
+       [(set_attr "conditional" "yes")])
8761
+(define_cond_exec
8762 122 dgisselq
+       [(ge (reg:CC CC_REG) (const_int 0))]
8763 102 dgisselq
+       ""
8764
+       "(GE)"
8765
+       [(set_attr "conditional" "yes")])
8766
+(define_cond_exec
8767 122 dgisselq
+       [(ltu (reg:CC CC_REG) (const_int 0))]
8768 102 dgisselq
+       ""
8769
+       "(C)"
8770
+       [(set_attr "conditional" "yes")])
8771
+;
8772
+;
8773
+;
8774
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8775
+;;
8776
+;; Conditional move instructions, since these won't accept conditional
8777
+;;     execution RTL
8778
+;;
8779
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8780
+;
8781
+; // Look for #define HAVE_conditional_move to understand how these might be
8782
+; // used.
8783
+;
8784
+(define_insn "set_zero_or_one<mode>"
8785
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8786
+                       (match_operator 1 "ordered_comparison_operator"
8787 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
8788 102 dgisselq
+                       (const_int 1) (const_int 0)))]
8789
+       ""
8790
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
8791
+       }
8792
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8793 127 dgisselq
+(define_expand "mov<mode>cc"
8794 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8795 127 dgisselq
+               (if_then_else:ZI (match_operand 1 "comparison_operator")
8796 102 dgisselq
+                       (match_operand:ZI 2 "general_operand" "rio")
8797
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
8798
+       ""
8799
+       {
8800 142 dgisselq
+       if (zip_expand_movsicc(operands[0], operands[1], operands[2], operands[3]))
8801
+               DONE;
8802
+       else
8803
+               FAIL;
8804 127 dgisselq
+       })
8805
+(define_insn_and_split "movsicc_bare"
8806
+       [(set (match_operand:SI 0 "register_operand" "=r")
8807
+               (if_then_else (match_operator 1 "ordered_comparison_operator"
8808
+                               [(reg:CC CC_REG) (const_int 0)])
8809
+                       (match_operand:SI 2 "general_operand" "rio")
8810
+                       (match_operand:SI 3 "register_operand" "0")))]
8811
+       "(zip_supported_condition(GET_CODE(operands[1])))"
8812
+       "#"
8813
+       "(reload_completed)"
8814
+       [(cond_exec (match_operator 1 "ordered_comparison_operator"
8815
+                               [(reg:CC CC_REG) (const_int 0)])
8816
+                       (set (match_dup 0) (match_dup 2)))]
8817
+       "" [(set_attr "predicable" "no")])
8818 102 dgisselq
+(define_insn "add<mode>cc"
8819
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
8820
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
8821 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8822 102 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
8823
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
8824
+                       (match_dup 0)))]
8825
+       ""
8826
+       {
8827
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
8828
+       }
8829
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8830
+;
8831
+;
8832
+;
8833
+; While an interesting approach, the following suffers from problems when the
8834
+; move amount is constant.  At anything less than four, moves should not require
8835
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
8836
+; are not required and should result in a hardcoded result.  Practically,
8837
+; though, this should really be a define_expand instruction, calling on the
8838 127 dgisselq
+; RTX's of all the respective subinstructions found below.  Or, perhaps, it is
8839
+; better as a subroutine?
8840 102 dgisselq
+;
8841
+;(define_insn "movmemSI"
8842
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
8843
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
8844
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
8845
+;              (match_operand 3 "" "")                 ;Alignment
8846
+;              (clobber (match_scratch:SI 4 "=r"))
8847
+;              (clobber (match_scratch:SI 5 "=r"))
8848
+;              (clobber (match_scratch:SI 6 "=r"))
8849
+;              (clobber (match_scratch:SI 7 "=r"))]
8850
+;      ""
8851
+;      "TEST\t1,%2
8852
+;      LOD.NZ\t%1,%4
8853
+;      STO.NZ\t%4,%0
8854
+;      ADD.NZ\t1,%0
8855
+;      ADD.NZ\t1,%1
8856
+;      TEST\t2,%2
8857
+;      LOD.NZ\t%1,%4
8858
+;      LOD.NZ\t1(%1),%5
8859
+;      STO.NZ\t%4,(%0)
8860
+;      STO.NZ\t%4,1(%0)
8861
+;      ADD.NZ\t2,%0
8862
+;      ADD.NZ\t2,%1
8863
+;      AND\t-4,%2
8864
+;      BZ\t.Lskp%=\n.Ltop%=:
8865
+;      LOD\t(%1),%4
8866
+;      LOD\t1(%1),%5
8867
+;      LOD\t2(%1,%6
8868
+;      LOD\t3(%1),%7
8869
+;      STO\t%4,(%1)
8870
+;      STO\t%5,1(%1)
8871
+;      STO\t%6,2(%1)
8872
+;      STO\t%7,3(%1)
8873
+;      SUB\t4,%2
8874
+;      BZ\t%.Lskp%=
8875
+;      BRA\t.Ltop%=\n.Lskp%=:"
8876
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8877
+;(define_insn "setmemsi"
8878
+;      [(parallel
8879
+;              [(set (mem:BLK
8880
+;                      (match_operand 0 "register_operand" "+r")); Destination
8881
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
8882
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
8883
+;              (match_operand 3 "" "")]
8884
+;      ""
8885
+;      "TEST\t1,%1
8886
+;      STO.NZ\t%2,(%0)
8887
+;      ADD.NZ\t1,%0
8888
+;      TEST\t2,%1
8889
+;      STO.NZ\t%2,(%0)
8890
+;      STO.NZ\t%2,1(%0)
8891
+;      ADD.NZ\t2,%0
8892
+;      AND\t-4,%1
8893
+;      BZ\t.Lskp%=\n.Ltop%=:\n
8894
+;      STO\t%2,(%0)
8895
+;      STO\t%2,1(%0)
8896
+;      STO\t%2,2(%0)
8897
+;      STO\t%2,3(%0)
8898
+;      SUB\t%4,%0
8899
+;      BZ\t.Lskp%=
8900
+;      BRA\t.Ltop%=\n.Lskp%=:"
8901
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8902
+;;
8903
+;
8904
+;
8905
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8906
+;;
8907
+;; Control flow instructions
8908
+;;
8909
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8910
+;
8911
+;
8912
+;
8913
+(define_expand "jump"
8914
+       [(set (pc)
8915
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
8916 127 dgisselq
+(define_insn "jump_const"
8917
+       [(set (pc)
8918 102 dgisselq
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
8919
+       ""
8920
+       "BRA    %0"
8921
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8922
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
8923
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8924
+               (label_ref (match_operand 0 "" "")))]
8925
+       ""
8926
+       "BRA    %0"
8927
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8928
+;
8929
+; This is really the same thing as an indirect jump ... the big difference
8930
+; is that the zip_address_operand_p checks for an "N" type condition, not an
8931
+; "M" type condition ... a bug, but one that works for now.  (The assembler
8932
+; should be able to catch and except on it ...)
8933
+;
8934
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8935
+(define_insn "jump_variable"
8936
+       [(set (pc)
8937
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
8938
+       ""
8939
+       "JMP    %0"
8940
+       [(set_attr "ccresult" "unchanged")])
8941
+;
8942
+; Indirect jumps ... both to registers, and registers plus offsets
8943
+;
8944
+(define_insn "indirect_jump"
8945
+       [(set (pc)
8946
+               (match_operand:SI 0 "register_operand" "r"))]
8947
+       ""
8948
+       "JMP    %0"
8949
+       [(set_attr "ccresult" "unchanged")])
8950
+(define_insn "indirect_jump_mem"
8951
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
8952
+       ""
8953
+       "LOD    %0,PC"
8954
+       [(set_attr "ccresult" "unchanged")])
8955
+(define_insn "indirect_jump_off"
8956
+       [(set (pc)
8957
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
8958
+                       (match_operand:SI 1 "const_int_operand" "M")))]
8959
+       ""
8960
+       "JMP    %1(%0)"
8961
+       [(set_attr "ccresult" "unchanged")])
8962
+;;
8963
+; cbranchsi4
8964
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
8965
+;;     Op 1&2 the operands of the compare instruction
8966
+;;     Op 3 is the jump label
8967
+;;
8968
+;;
8969
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
8970
+;;
8971
+(define_expand "cbranch<mode>4"
8972 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 1 "register_operand" "r")
8973
+               (match_operand:ZI 2 "zip_opb_operand_p" "rO")))
8974 102 dgisselq
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
8975 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8976 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
8977
+                       (pc)))]
8978
+       ""
8979
+       {
8980 125 dgisselq
+               if (true) {
8981 117 dgisselq
+               extern void zip_debug_rtx_pfx(const char *, const_rtx);
8982 102 dgisselq
+               //; Two branches give us no end of difficulty when implementing.
8983
+               //; Let's check for these two branch codes, and swap the
8984
+               //; comparison to simplify them.
8985 122 dgisselq
+               //; fprintf(stderr, "CBRANCH\n");
8986
+               //; zip_debug_rtx_pfx("- CMP: ", operands[0]);
8987
+               //; zip_debug_rtx_pfx("- A  : ", operands[1]);
8988
+               //; zip_debug_rtx_pfx("- B  : ", operands[2]);
8989
+               //; zip_debug_rtx_pfx("- JMP: ", operands[3]);
8990 117 dgisselq
+               //; Can we do better if we reverse some compares?
8991 102 dgisselq
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
8992 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
8993
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
8994 102 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
8995
+                       DONE;
8996
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
8997 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
8998
+                       emit_insn(gen_cmpsi_off(operands[2], operands[1],
8999
+                                       GEN_INT(1)));
9000
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9001 102 dgisselq
+                       DONE;
9002 117 dgisselq
+               } else if ((GET_CODE(operands[0])==LE)&&(REG_P(operands[2]))) {
9003 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(LE,?,REG,?)\n");
9004 117 dgisselq
+                       //; Swap operands, turn into a GTE compare
9005 122 dgisselq
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
9006 117 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ge(operands[3]));
9007
+                       DONE;
9008 102 dgisselq
+               } // ; Otherwise ... just handle the branch normally
9009
+
9010
+               //; Except ... we can do better for some instructions, such as
9011
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
9012
+               //; would be difficult to explain to users why MIN_INT didn't
9013
+               //; compare properly.  Hence we only adjust constant integers.
9014
+               //;
9015 122 dgisselq
+               if (GET_CODE(operands[0])==LE) {
9016
+                       if ((CONST_INT_P(operands[2]))
9017 117 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
9018 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
9019
+                               emit_insn(gen_cmpsi(operands[1],
9020
+                                               GEN_INT(INTVAL(operands[2])+1)));
9021
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9022
+                               DONE;
9023
+                       //; Now for the controversial ones--where we add one
9024
+                       //; when it may or may not be permissable.  For now, we
9025
+                       //; just do it anyway and postpone the philosophical
9026
+                       //; discussion for later.
9027
+                       } else if (REG_P(operands[2])) {
9028
+                               emit_insn(gen_cmpsi_off(operands[1],
9029
+                                               operands[2],GEN_INT(1)));
9030
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9031
+                               DONE;
9032
+                       } else if ((GET_CODE(operands[2])==PLUS)
9033
+                               &&(REG_P(XEXP(operands[2],0)))
9034
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
9035
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
9036
+                               emit_insn(gen_cmpsi_off(operands[1],
9037
+                                               XEXP(operands[2],0),
9038
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
9039
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9040
+                               DONE;
9041
+                       }
9042
+               } else if (GET_CODE(operands[0])==LEU) {
9043
+                       if ((CONST_INT_P(operands[2]))
9044 102 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
9045 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
9046
+                               emit_insn(gen_cmpsi(operands[1],
9047
+                                               GEN_INT(INTVAL(operands[2])+1)));
9048
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9049
+                               DONE;
9050
+                       //; Now for the controversial ones--this time having
9051
+                       //; to do with unsigned compares.
9052
+                       } else if (REG_P(operands[2])) {
9053
+                               emit_insn(gen_cmpsi_off(operands[1],
9054
+                                                       operands[2],GEN_INT(1)));
9055
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9056
+                               DONE;
9057
+                       } else if ((GET_CODE(operands[2])==PLUS)
9058
+                               &&(REG_P(XEXP(operands[2],0)))
9059
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
9060
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
9061
+                               emit_insn(gen_cmpsi_off(operands[1],
9062
+                                       XEXP(operands[2],0),
9063
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
9064
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9065
+                               DONE;
9066
+                       }
9067 124 dgisselq
+               }}
9068 102 dgisselq
+       })
9069
+(define_insn "cbranch_jmp_eq"
9070 122 dgisselq
+       [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
9071 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9072
+                (pc)))]
9073
+       ""
9074
+       "BZ\t%0"
9075
+       [(set_attr "predicable" "no")
9076
+               (set_attr "conditional" "yes")
9077
+               (set_attr "ccresult" "unchanged")])
9078
+(define_insn "cbranch_jmp_neq"
9079 122 dgisselq
+       [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
9080 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9081
+                (pc)))]
9082
+       ""
9083
+       "BNZ\t%0"
9084
+       [(set_attr "predicable" "no")
9085
+               (set_attr "conditional" "yes")
9086
+               (set_attr "ccresult" "unchanged")])
9087
+(define_insn "cbranch_jmp_lt"
9088 122 dgisselq
+       [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9089 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9090
+                (pc)))]
9091
+       ""
9092
+       "BLT\t%0"
9093
+       [(set_attr "predicable" "no")
9094
+               (set_attr "conditional" "yes")
9095
+               (set_attr "ccresult" "unchanged")])
9096
+(define_insn "cbranch_jmp_le"
9097 122 dgisselq
+       [(set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
9098 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9099
+                (pc)))]
9100
+       ""
9101
+       "BLT\t%0
9102
+       BZ\t%0"
9103
+       [(set_attr "predicable" "no")
9104
+               (set_attr "conditional" "yes")
9105
+               (set_attr "ccresult" "unchanged")])
9106
+(define_insn "cbranch_jmp_gt"
9107 122 dgisselq
+       [(set (pc) (if_then_else (gt (reg:CC CC_REG) (const_int 0))
9108 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9109
+                (pc)))]
9110
+       ""
9111
+       "BGT\t%0"
9112
+       [(set_attr "predicable" "no")
9113
+               (set_attr "conditional" "yes")
9114
+               (set_attr "ccresult" "unchanged")])
9115
+(define_insn "cbranch_jmp_ge"
9116 122 dgisselq
+       [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
9117 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9118
+                (pc)))]
9119
+       ""
9120
+       "BGE\t%0"
9121
+       [(set_attr "predicable" "no")
9122
+               (set_attr "conditional" "yes")
9123
+               (set_attr "ccresult" "unchanged")])
9124
+(define_insn "cbranch_jmp_ltu"
9125 122 dgisselq
+       [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9126 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9127
+                (pc)))]
9128
+       ""
9129
+       "BC\t%0"
9130
+       [(set_attr "predicable" "no")
9131
+               (set_attr "conditional" "yes")
9132
+               (set_attr "ccresult" "unchanged")])
9133
+(define_insn "cbranch_jmp_gtu"
9134 122 dgisselq
+       [(set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9135 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9136 122 dgisselq
+                (pc)))
9137
+       ;(clobber (reg:CC CC_REG))
9138
+       ]
9139 102 dgisselq
+       ""      ; Flip the condition, and then we can jump
9140 127 dgisselq
+       "BC\t.Lgtu%=\n\tBZ\t.Lgtu%=\n\tBRA\t%0\n.Lgtu%=:"
9141 102 dgisselq
+       [(set_attr "predicable" "no")
9142
+               (set_attr "conditional" "yes")
9143
+               (set_attr "ccresult" "unknown")])
9144
+(define_insn "cbranch_jmp_leu"
9145 122 dgisselq
+       [(set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9146 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9147
+                (pc)))]
9148
+       ""      ; Need to check for both LTU (i.e. C) and Z
9149
+       "BC\t%0
9150
+       BZ\t%0"
9151
+       [(set_attr "predicable" "no")
9152
+               (set_attr "conditional" "yes")
9153
+               (set_attr "ccresult" "unchanged")])
9154
+(define_insn "cbranch_jmp_geu"
9155 122 dgisselq
+       [(set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9156 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9157 122 dgisselq
+                (pc)))
9158
+       ;(clobber (reg:CC CC_REG))
9159
+       ]
9160 127 dgisselq
+       ""
9161
+       "BC\t.Lgeu%=\n\tBRA\t%0\n.Lgeu%=:"
9162 102 dgisselq
+       [(set_attr "predicable" "no")
9163
+               (set_attr "conditional" "yes")
9164
+               (set_attr "ccresult" "unknown")])
9165
+(define_insn "cbranchdi4"
9166
+       [(set (pc) (if_then_else
9167
+               (match_operator 0 "ordered_comparison_operator"
9168
+                       [(match_operand:DI 1 "register_operand" "r")
9169 122 dgisselq
+                               (match_operand:DI 2 "register_operand" "r")])
9170 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
9171
+                       (pc)))
9172 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9173 102 dgisselq
+       ""
9174
+       {
9175
+               switch(GET_CODE(operands[0])) {
9176
+               case EQ:
9177
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
9178
+               case NE:
9179
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
9180
+               case LE:
9181
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
9182
+               case GT:
9183
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
9184
+               case LT:
9185
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
9186
+               case GE:
9187
+                       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%=:";
9188
+               case LTU:
9189
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
9190
+               case LEU:
9191
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
9192
+               case GTU:
9193
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
9194
+               case GEU:
9195
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
9196
+               default:
9197
+                       gcc_unreachable();
9198
+               }
9199
+       }
9200
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9201
+;
9202
+;
9203
+;
9204
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9205
+;;
9206
+;; Subroutine call
9207
+;;
9208
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9209
+;
9210
+;
9211
+; There are two types of calls: "call" and "call_value".
9212
+;
9213
+; Each of these types of calls are then expanded into one of:
9214
+;
9215
+;      _const          - A call to a constant address, such as a symbol
9216
+;                      reference or a fixed location
9217
+;
9218
+;      _label          - This should be the same as _const, except that for
9219
+;                      some reason the RTL and matching rules are separate.
9220
+;                      Hence we have a separate rule for this.
9221
+;
9222
+;      _mem            - The memory address we wish to jump to is stored in
9223
+;                      memory somewhere, and we have only a pointer.  In this
9224
+;                      case, we load that pointer straight to the PC and go.
9225
+;
9226
+;      _var            - The address to jump to is given as an offset to a
9227
+;                      register, such as X+R3.  This is an indirect jump.
9228
+;                      Although we support it, it does require different RTL
9229
+;                      code.
9230
+;
9231
+(define_expand "call"
9232
+       [(call (match_operand 0 "" "")
9233
+               (match_operand 1 "" ""))]
9234
+       ""
9235
+       {
9236
+               if (MEM_P(operands[0])) {
9237
+                       // This should always be the case
9238
+                       rtx addr = XEXP(operands[0],0);
9239
+                       if (zip_const_address_operand_p(addr, SImode)) {
9240 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_void_call_const()\n");
9241 102 dgisselq
+                               emit_call_insn(gen_void_call_const(addr,
9242
+                                               operands[1]));
9243
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
9244
+                                                       XEXP(addr,0)))) {
9245
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
9246
+                                                                operands[1]));
9247
+                       } else {
9248
+                               emit_call_insn(gen_void_call_var(addr,
9249
+                                                                operands[1]));
9250
+                       }
9251
+                       DONE;
9252
+               }
9253
+       })
9254
+;
9255
+;
9256
+;
9257
+; How do we want to do this better?
9258
+;      Replace the RTL w/
9259
+;              return_label= gen_label_rtx();
9260
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
9261
+;                      gen_rtx_REG(zip_PC),return_label));
9262
+;              emit_jump(label_rtx(
9263
+;
9264
+;              emit_label(return_label);
9265
+;
9266
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
9267
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
9268
+; label gets removed and the call gets lost.  Hence we do it this way (below).
9269
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
9270
+; recognize as such, but for now we'll use .Lcall# as our label.
9271
+;
9272
+(define_insn "void_call_const"
9273 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9274 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9275 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9276
+               (clobber (reg:CC CC_REG))]
9277 102 dgisselq
+       ""
9278
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
9279
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9280
+(define_insn "void_call_mem"
9281 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9282 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9283 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9284
+               (clobber (reg:CC CC_REG))]
9285 102 dgisselq
+       ""
9286
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
9287
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9288
+;
9289
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9290
+(define_insn "void_call_var"
9291 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9292 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9293 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9294
+               (clobber (reg:CC CC_REG))]
9295 102 dgisselq
+       ""
9296
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
9297
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9298
+(define_expand "call_value"
9299 122 dgisselq
+       [(parallel [(set (reg:SI RTNV_REG)
9300 102 dgisselq
+               (call (match_operand:SI 1 "" "")
9301 111 dgisselq
+                       (match_operand 2 "const_int_operand" "n")))
9302 122 dgisselq
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))
9303
+       (clobber (reg:CC CC_REG))])]
9304 102 dgisselq
+       ""
9305
+       {
9306 122 dgisselq
+               //; extern void zip_debug_rtx(const_rtx);
9307
+               //; fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
9308
+               //; zip_debug_rtx(operands[1]);
9309 102 dgisselq
+               if (MEM_P(operands[1])) {
9310 122 dgisselq
+                       //; fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
9311
+                       //; zip_debug_rtx(operands[1]);
9312
+                       //; This should always be the case
9313 102 dgisselq
+                       rtx addr = XEXP(operands[1],0);
9314
+                       if (zip_const_address_operand_p(addr, SImode)) {
9315 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_reg_call_const()\n");
9316 102 dgisselq
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
9317
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
9318 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9319 102 dgisselq
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
9320
+                       } else {
9321 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9322 102 dgisselq
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
9323
+                       }
9324
+                       DONE;
9325
+               }
9326
+       })
9327
+(define_insn "reg_call_const"
9328 122 dgisselq
+       [(set (reg:SI RTNV_REG)
9329 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9330 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
9331 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9332
+               (clobber (reg:CC CC_REG))]
9333 102 dgisselq
+       ""
9334
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
9335
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9336
+(define_insn "reg_call_mem"
9337
+       [(set (reg:SI RTNV_REG)
9338 111 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9339
+                       (match_operand 1 "const_int_operand" "n")))
9340 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9341
+               (clobber (reg:CC CC_REG))]
9342 102 dgisselq
+       ""
9343 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tLOD\t%0,PC\n.Lcall%=:"
9344 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9345 111 dgisselq
+;
9346 102 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9347
+(define_insn "reg_call_var"
9348 122 dgisselq
+       [(set (reg:SI RTNV_REG)
9349 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9350 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
9351 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9352
+               (clobber (reg:CC CC_REG))]
9353 102 dgisselq
+       ""
9354 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tJMP\t%0\n.Lcall%=:"
9355 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9356
+;
9357
+;
9358
+;
9359
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9360
+;;
9361
+;; Frame manipulation RTX
9362
+;;
9363
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9364
+;
9365
+;
9366
+;
9367
+(define_expand "prologue"
9368
+       [(const_int 0)]
9369
+       ""
9370
+       "{ zip_expand_prologue(); DONE; }")
9371
+(define_expand "epilogue"
9372
+       [(return)]
9373
+       ""
9374
+       "{ zip_expand_epilogue(); DONE; }")
9375
+(define_expand "return" ; In order to use the function predicate, this *must*
9376
+       [(return)]      ; be a define_expand
9377
+       "zip_use_return_insn()")
9378
+       ; "JMP  R0"
9379
+       ; [(set_attr "ccresult" "unchanged")])
9380
+(define_insn "*return" ; A "*" -- means it cannot be called from C
9381
+       [(return)]
9382
+       ""
9383
+       "JMP    R0"
9384
+       [(set_attr "ccresult" "unchanged")])
9385
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
9386
+       [(simple_return)]
9387
+       ""
9388
+       "JMP    R0"
9389
+       [(set_attr "ccresult" "unchanged")])
9390
+;
9391
+;
9392
+;
9393
+;;;;;;;;;;;;;;;;;;;;;;;;;;
9394
+;;
9395
+;; Zip Builtin Functions
9396
+;;
9397
+;;;;;;;;;;;;;;;;;;;;;;;;;;
9398
+;
9399
+;
9400
+;
9401
+(define_insn "zip_rtu"
9402
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
9403 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9404 102 dgisselq
+       "(!ZIP_USER)"
9405
+       "RTU"
9406
+       [(set_attr "ccresult" "unknown")])
9407
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
9408
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
9409 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9410 102 dgisselq
+       "(!ZIP_USER)"
9411
+       "HALT"
9412
+       [(set_attr "ccresult" "unknown")])
9413
+(define_insn "zip_idle"
9414
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
9415 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9416 102 dgisselq
+       ""
9417
+       "WAIT"
9418
+       [(set_attr "ccresult" "unknown")])
9419
+(define_insn "zip_syscall"
9420
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
9421
+       ""
9422
+       "CLR\tCC"
9423
+       [(set_attr "ccresult" "unknown")])
9424
+;
9425
+;
9426
+; Operator "save_context"
9427
+;
9428 117 dgisselq
+;      Okay, so we're not really reading and writing operand 0, %0, however
9429
+;      if we don't list it as a "+r" register, the compiler may allocate it
9430
+;      among the other registers, thus we clobber it in the middle of the
9431
+;      operation before the task is complete.
9432 102 dgisselq
+;
9433
+(define_insn "zip_save_context"
9434 117 dgisselq
+       [(unspec_volatile
9435
+                       [ (match_operand:SI 0 "register_operand" "+r") ]
9436 102 dgisselq
+                       UNSPEC_SAVE_CONTEXT)
9437
+               (clobber (match_scratch:SI 1 "=r"))
9438
+               (clobber (match_scratch:SI 2 "=r"))
9439
+               (clobber (match_scratch:SI 3 "=r"))
9440 117 dgisselq
+               (clobber (match_scratch:SI 4 "=r"))]
9441 102 dgisselq
+       "(!ZIP_USER)"
9442
+       "MOV\tuR0,%1
9443
+       MOV\tuR1,%2
9444
+       MOV\tuR2,%3
9445
+       MOV\tuR3,%4
9446
+       STO\t%1,%0
9447
+       STO\t%2,1(%0)
9448
+       STO\t%3,2(%0)
9449
+       STO\t%4,3(%0)
9450
+       MOV\tuR4,%1
9451
+       MOV\tuR5,%2
9452
+       MOV\tuR6,%3
9453
+       MOV\tuR7,%4
9454
+       STO\t%1,4(%0)
9455
+       STO\t%2,5(%0)
9456
+       STO\t%3,6(%0)
9457
+       STO\t%4,7(%0)
9458
+       MOV\tuR8,%1
9459
+       MOV\tuR9,%2
9460
+       MOV\tuR10,%3
9461
+       MOV\tuR11,%4
9462
+       STO\t%1,8(%0)
9463
+       STO\t%2,9(%0)
9464
+       STO\t%3,10(%0)
9465
+       STO\t%4,11(%0)
9466
+       MOV\tuR12,%1
9467
+       MOV\tuSP,%2
9468
+       MOV\tuCC,%3
9469
+       MOV\tuPC,%4
9470
+       STO\t%1,12(%0)
9471
+       STO\t%2,13(%0)
9472
+       STO\t%3,14(%0)
9473
+       STO\t%4,15(%0)"
9474 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
9475 117 dgisselq
+;
9476
+; See the comment above about why operand 0, %0, *must* be a "+r" operand,
9477
+; even though we don't really read (or change) its value throughout this
9478
+; operation.
9479
+;
9480 102 dgisselq
+(define_insn "zip_restore_context"
9481
+       [(unspec_volatile [
9482 117 dgisselq
+               (match_operand:SI 0 "register_operand" "+r")] UNSPEC_RESTORE_CONTEXT)
9483 102 dgisselq
+       (clobber (match_scratch:SI 1 "=r"))
9484
+       (clobber (match_scratch:SI 2 "=r"))
9485
+       (clobber (match_scratch:SI 3 "=r"))
9486 117 dgisselq
+       (clobber (match_scratch:SI 4 "=r"))]
9487 102 dgisselq
+       "(!ZIP_USER)"
9488
+       "LOD\t0(%0),%1
9489
+       LOD\t1(%0),%2
9490
+       LOD\t2(%0),%3
9491
+       LOD\t3(%0),%4
9492
+       MOV\t%1,uR0
9493
+       MOV\t%2,uR1
9494
+       MOV\t%3,uR2
9495
+       MOV\t%4,uR3
9496
+       LOD\t4(%0),%1
9497
+       LOD\t5(%0),%2
9498
+       LOD\t6(%0),%3
9499
+       LOD\t7(%0),%4
9500
+       MOV\t%1,uR4
9501
+       MOV\t%2,uR5
9502
+       MOV\t%3,uR6
9503
+       MOV\t%4,uR7
9504
+       LOD\t8(%0),%1
9505
+       LOD\t9(%0),%2
9506
+       LOD\t10(%0),%3
9507
+       LOD\t11(%0),%4
9508
+       MOV\t%1,uR8
9509
+       MOV\t%2,uR9
9510
+       MOV\t%3,uR10
9511
+       MOV\t%4,uR11
9512
+       LOD\t12(%0),%1
9513
+       LOD\t13(%0),%2
9514
+       LOD\t14(%0),%3
9515
+       LOD\t15(%0),%4
9516
+       MOV\t%1,uR12
9517
+       MOV\t%2,uSP
9518
+       MOV\t%3,uCC
9519
+       MOV\t%4,uPC"
9520 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
9521 102 dgisselq
+(define_insn "zip_bitrev"
9522
+       [(set (match_operand:SI 0 "register_operand" "=r")
9523
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
9524
+       ]
9525
+       ""
9526
+       "BREV\t%1,%0"
9527 122 dgisselq
+       [(set_attr "ccresult" "unchanged")])
9528 102 dgisselq
+(define_insn "zip_cc"
9529
+       [(set (match_operand:SI 0 "register_operand" "=r")
9530
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9531
+       ""
9532
+       "MOV\tCC,%0"
9533
+       [(set_attr "ccresult" "unchanged")])
9534 117 dgisselq
+(define_insn "zip_ucc"
9535
+       [(set (match_operand:SI 0 "register_operand" "=r")
9536
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETUCC))]
9537
+       ""
9538
+       "MOV\tuCC,%0"
9539
+       [(set_attr "ccresult" "unchanged")])
9540 111 dgisselq
+(define_insn "zip_cc_sto"
9541
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
9542 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9543 111 dgisselq
+       ""
9544
+       "STO\tCC,(%0)"
9545
+       [(set_attr "ccresult" "unchanged")])
9546
+(define_insn "zip_cc_sto_off"
9547
+       [(set (mem:SI (plus:SI
9548
+                       (match_operand:SI 0 "register_operand" "r")
9549
+                       (match_operand:SI 1 "const_int_operand" "N")))
9550 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9551 111 dgisselq
+       ""
9552
+       "STO\tCC,%1(%0)"
9553
+       [(set_attr "ccresult" "unchanged")])
9554 102 dgisselq
+(define_insn "ldilo"
9555
+       [(set (match_operand:SI 0 "register_operand" "=r")
9556
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
9557
+       ""
9558
+       "LDILO  %1,%0"
9559
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9560
+
9561
+;
9562
+;
9563
+;
9564
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9565
+;;
9566
+;; Floating point Op-codes
9567
+;;
9568
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9569
+;
9570
+;
9571
+;
9572
+(define_insn "addsf3"
9573
+       [(set (match_operand:SF 0 "register_operand" "=r")
9574
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
9575 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9576
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9577 102 dgisselq
+       "(ZIP_FPU)"
9578
+       "FPADD  %2,%0"
9579
+       [(set_attr "ccresult" "unknown")])
9580
+(define_insn "subsf3"
9581
+       [(set (match_operand:SF 0 "register_operand" "=r")
9582
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
9583 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9584
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9585 102 dgisselq
+       "(ZIP_FPU)"
9586
+       "FPSUB  %2,%0"
9587
+       [(set_attr "ccresult" "unknown")])
9588
+(define_insn "mulsf3"
9589
+       [(set (match_operand:SF 0 "register_operand" "=r")
9590
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
9591 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9592
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9593 102 dgisselq
+       "(ZIP_FPU)"
9594
+       "FPMUL  %2,%0"
9595
+       [(set_attr "ccresult" "unknown")])
9596
+(define_insn "divsf3"
9597
+       [(set (match_operand:SF 0 "register_operand" "=r")
9598
+               (div:SF (match_operand:SF 1 "register_operand" "0")
9599 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9600
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9601 102 dgisselq
+       "(ZIP_FPU)"
9602
+       "FPDIV  %2,%0"
9603
+       [(set_attr "ccresult" "unknown")])
9604 111 dgisselq
+(define_expand "negsf2"
9605
+       [(set (match_operand:SF 0 "register_operand" "=r")
9606
+               (neg:SF (match_operand:SF 1 "register_operand" "0")))
9607
+       ]
9608
+       ""
9609
+       {
9610
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
9611
+               if (can_create_pseudo_p()) {
9612
+                       rtx tmp = gen_reg_rtx(SImode);
9613
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
9614 122 dgisselq
+                       emit_insn(gen_xorsi3(operands[0], operands[0], tmp));
9615 111 dgisselq
+                       DONE;
9616
+               } else {
9617
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9618 122 dgisselq
+                       emit_insn(gen_iorsi3(operands[0], operands[0],
9619
+                               gen_int_mode(1,SImode)));
9620 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9621
+                       DONE;
9622
+               }
9623
+       })
9624
+(define_expand "abssf2"
9625 122 dgisselq
+       [(set (match_operand:SF 0 "register_operand" "=r")
9626
+               (abs:SF (match_operand:SF 1 "register_operand" "0")))
9627 111 dgisselq
+       ]
9628
+       ""
9629
+       {
9630
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
9631
+               if (can_create_pseudo_p()) {
9632
+                       rtx tmp = gen_reg_rtx(SImode);
9633
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
9634 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0], tmp));
9635 111 dgisselq
+                       DONE;
9636
+               } else {
9637
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9638 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0],
9639
+                               gen_int_mode(-2,SImode)));
9640 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9641
+                       DONE;
9642
+               }
9643
+       })
9644 102 dgisselq
+;
9645
+;
9646
+;
9647
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9648
+;;
9649
+;; Trap Instruction
9650
+;;
9651
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9652
+;
9653
+;
9654
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
9655
+; *nothing* should ever trap, and so we should never get here.  However, the
9656
+; compiler seems to want a trap instruction for some reason.  (It keeps us
9657
+; from calling the abort() function, if we don't define these ...)  So let's
9658
+; just grab onto the break instruction and declare it to be a trap instruction
9659
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
9660
+; will work for both user and system instructions.
9661
+;
9662
+(define_insn "trap"
9663
+       [(trap_if (const_int 1) (const_int 0))]
9664
+       ""
9665
+       "BREAK"
9666
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9667
+;
9668
+(define_expand "ctrap<mode>4"
9669 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9670
+               (match_operand:ZI 1 "register_operand" "r")
9671
+               (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
9672 102 dgisselq
+       (trap_if (match_operator 0 "ordered_comparison_operator"
9673 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9674 102 dgisselq
+                       (match_operand 3 "const_int_operand" "O"))]
9675
+       ""
9676
+       )
9677
+(define_insn "trapif"
9678
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
9679 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9680 102 dgisselq
+                       (match_operand 1 "const_int_operand" "O"))]
9681
+       ""
9682
+       "BREAK\t%1"
9683
+       [(set_attr "predicable" "no")])
9684
+;
9685
+;
9686
+;
9687
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9688
+;;
9689
+;; Unimplemented (or not yet implemented) RTL Codes
9690
+;;
9691
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9692
+;
9693
+;
9694
+;
9695
+;(define_insn "sync_compare_and_swapsi"
9696
+;      [(set ...
9697
+;              )]
9698
+;      "(ZIP_ATMOC)"
9699
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
9700
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
9701
+;      CMP     %0,%2   DCD-valid
9702
+;      STO.Z   %2,%1   PF-valid
9703
+;
9704
+;(define_insn "sync_lock_test_and_setsi"
9705
+;      LOCK
9706
+;      LOD     %1,%0
9707
+;      STO     %0,%1
9708
+;
9709
+;(define_insn "sync_lock_releasesi"
9710
+;      STO     %1,%0
9711
+;
9712
+;
9713
+;(define_insn "negvsi3"
9714
+;      "MOV    %1,%0
9715
+;      XOR     -1,%0
9716
+;      ADD     1,%0
9717
+;      BV      %2"
9718
+;      "")
9719 124 dgisselq
+;
9720
+; Match:
9721
+;      CMP     R1,R0
9722
+;      BGTU    lbl
9723
+; Transform to:
9724
+;      CMP     R0,R1
9725
+;      BC      lbl
9726
+;
9727 117 dgisselq
+(define_peephole2
9728 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9729
+               (match_operand:SI 0 "register_operand")
9730
+               (match_operand:SI 1 "register_operand")))
9731
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9732
+                       (label_ref (match_operand 2 ""))
9733 117 dgisselq
+                       (pc)))]
9734 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9735 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1) (match_dup 0)))
9736
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9737 117 dgisselq
+                       (label_ref (match_dup 2))
9738
+                       (pc)))]
9739
+       "")
9740 127 dgisselq
+(define_peephole2
9741
+       [(match_scratch:SI 3 "=r")
9742
+       (set (reg:CC CC_REG) (compare:CC
9743
+               (match_operand:SI 0 "register_operand")
9744
+               (match_operand 1 "const_int_operand")))
9745
+       (match_dup 3)
9746
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9747
+                       (label_ref (match_operand 2 ""))
9748
+                       (pc)))]
9749
+       "(ZIP_PEEPHOLE)"
9750
+       [(set (match_dup 3) (match_dup 1))
9751
+       (set (reg:CC CC_REG) (compare:CC (match_dup 3) (match_dup 0)))
9752
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9753
+                       (label_ref (match_dup 2))
9754
+                       (pc)))]
9755
+       "")
9756
+;(define_peephole2
9757
+;      [(set (reg:CC CC_REG) (compare:CC
9758
+;              (match_operand:SI 0 "register_operand")
9759
+;              (match_operand 1 "const_int_operand")))
9760
+;      (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9761
+;                      (label_ref (match_operand 2 ""))
9762
+;                      (pc)))]
9763
+;      ""
9764
+;      [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9765
+;      (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9766
+;                      (label_ref (match_dup 2))
9767
+;                      (pc)))]
9768
+;      "operands[1] = GEN_INT(INTVAL(operands[1])-1);")
9769 124 dgisselq
+;
9770
+;
9771
+; Match:
9772
+;      CMP     R1,R0
9773
+;      BGEU    lbl
9774
+; Transform to:
9775
+;      CMP     1(R0),R1
9776
+;      BC      lbl
9777
+;
9778 117 dgisselq
+(define_peephole2
9779 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9780
+               (match_operand:SI 0 "register_operand")
9781
+               (match_operand:SI 1 "register_operand")))
9782
+       (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9783
+                       (label_ref (match_operand 2 ""))
9784 117 dgisselq
+                       (pc)))]
9785 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9786 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9787
+               (match_dup 1) (plus (match_dup 0) (const_int 1))))
9788
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9789 117 dgisselq
+                       (label_ref (match_dup 2))
9790
+                       (pc)))]
9791
+       "")
9792 124 dgisselq
+;
9793
+;
9794
+; Match:
9795
+;      CMP     R1,R0
9796
+;      BGE     lbl
9797
+; Transform to:
9798
+;      CMP     1(R0),R1
9799
+;      BLT     lbl
9800 142 dgisselq
+; ... why?  when we support a BGE instruction?
9801
+;(define_peephole2
9802
+       ;[(set (reg:CC CC_REG) (compare:CC
9803
+               ;(match_operand:SI 0 "register_operand")
9804
+               ;(match_operand:SI 1 "register_operand")))
9805
+       ;(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
9806
+                       ;(label_ref (match_operand 2 ""))
9807
+                       ;(pc)))]
9808
+       ;"(ZIP_PEEPHOLE)"
9809
+       ;[(set (reg:CC CC_REG) (compare:CC (match_dup 1)
9810
+                       ;(plus:SI (match_dup 0) (const_int 1))))
9811
+       ;(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9812
+                       ;(label_ref (match_dup 2))
9813
+                       ;(pc)))]
9814
+       ;"")
9815 124 dgisselq
+;
9816
+;
9817
+; Match:
9818
+;      CMP     R1,R0
9819
+;      BLEU    lbl
9820
+; Transform to:
9821
+;      CMP     1(R1),R0
9822 142 dgisselq
+;      BC      lbl
9823 124 dgisselq
+;
9824 117 dgisselq
+(define_peephole2
9825 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9826
+               (match_operand:SI 0 "register_operand" "")
9827 117 dgisselq
+               (match_operand:SI 1 "register_operand" "")))
9828 122 dgisselq
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9829 117 dgisselq
+                       (label_ref (match_operand 2 "" ""))
9830
+                       (pc)))]
9831 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9832 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
9833
+                       (plus (match_dup 1) (const_int 1))))
9834
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9835 117 dgisselq
+                       (label_ref (match_dup 2))
9836
+                       (pc)))]
9837
+       "")
9838
+;
9839 142 dgisselq
+;
9840
+;
9841
+; Match:
9842
+;      CMP     R1,R0
9843
+;      BLE     lbl
9844
+; Transform to:
9845
+;      CMP     1(R1),R0
9846
+;      BLT     lbl
9847
+;
9848 127 dgisselq
+(define_peephole2
9849
+       [(set (reg:CC CC_REG)
9850
+               (compare:CC (match_operand:SI 0 "register_operand" "")
9851
+                       (match_operand:SI 1 "const_int_operand" "")))
9852
+       (set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
9853
+                       (label_ref (match_operand 2 "" ""))
9854
+                       (pc)))]
9855
+       "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
9856
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9857
+       (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9858
+                       (label_ref (match_dup 2))
9859
+                       (pc)))]
9860
+       "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
9861 142 dgisselq
+;
9862
+; Match:
9863
+;      CMP     R1,R0
9864
+;      BLEU    lbl
9865
+; Transform to:
9866
+;      CMP     1(R1),R0
9867
+;      BC(LTU) lbl
9868
+;
9869 127 dgisselq
+(define_peephole2
9870
+       [(set (reg:CC CC_REG)
9871
+               (compare:CC (match_operand:SI 0 "register_operand" "")
9872
+                       (match_operand:SI 1 "const_int_operand" "")))
9873
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9874
+                       (label_ref (match_operand 2 "" ""))
9875
+                       (pc)))]
9876
+       "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
9877
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9878 142 dgisselq
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9879 127 dgisselq
+                       (label_ref (match_dup 2))
9880
+                       (pc)))]
9881
+       "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
9882 102 dgisselq
+;
9883 117 dgisselq
+;
9884
+;
9885
+;
9886 127 dgisselq
+; Match:
9887
+;      (parallel [(set () ()) (clobber (CC))])
9888
+;      (compare () ())
9889
+; Transform to:
9890
+;      (parallel [(set () ()) (set (CC) (0))]
9891
+;      (compare () ())
9892 117 dgisselq
+;
9893 127 dgisselq
+(define_peephole2
9894
+       [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
9895
+               (clobber (reg:CC CC_REG))])
9896
+       (set (reg:CC CC_REG) (compare:CC (match_operand:SI 2 "")
9897
+                       (match_operand:SI 3 "")))]
9898
+       "(ZIP_PEEPHOLE)&&zip_insn_sets_cc(insn)"
9899
+       [(parallel [(set (match_dup 0) (match_dup 1))
9900
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9901
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (match_dup 3)))]
9902
+       "")
9903
+;
9904
+;
9905
+;
9906 122 dgisselq
+; Match:
9907 127 dgisselq
+;      (parallel [(set () ()) (clobber (CC))])
9908
+;      (set () ())
9909
+;      (compare () ())
9910
+; Transform to:
9911
+;      (parallel [(set () ()) (set (CC) (0))]
9912
+;      (set () ())
9913
+;      (compare () ())
9914
+;
9915
+(define_peephole2
9916
+       [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
9917
+               (clobber (reg:CC CC_REG))])
9918
+       (set (match_operand 2 "") (match_operand 3 ""))
9919
+       (set (reg:CC CC_REG) (compare:CC (match_operand:SI 4 "")
9920
+                       (match_operand:SI 5 "")))]
9921
+       "(ZIP_PEEPHOLE)&&(zip_insn_sets_cc(insn))&&((!REG_P(operands[2]))||(REGNO(operands[2])!=CC_REG))"
9922
+       [(parallel [(set (match_dup 0) (match_dup 1))
9923
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9924
+       (set (match_dup 2) (match_dup 3))
9925
+       (set (reg:CC CC_REG) (compare:CC (match_dup 4) (match_dup 5)))]
9926
+       "")
9927
+;
9928
+;
9929
+;
9930
+; Match:
9931 122 dgisselq
+;      MOV A(R1),R3
9932
+;      CMP R3,R0
9933
+;      (R3 is dead)
9934
+; Transform to:
9935
+;      CMP A(R1),R0
9936
+;
9937
+(define_peephole2
9938
+       [(set (match_operand:SI 3 "register_operand")
9939
+               (plus:SI (match_operand:SI 1 "register_operand")
9940
+                       (match_operand:SI 2 "zip_mvimm_operand_p")))
9941
+       (set (reg:CC CC_REG)
9942
+               (compare:CC (match_operand:SI 0 "register_operand")
9943
+                       (match_dup 3)))]
9944 127 dgisselq
+       "(ZIP_PEEPHOLE)&&peep2_regno_dead_p(2, REGNO(operands[3]))"
9945 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
9946
+               (plus:SI (match_dup 1) (match_dup 2))))]
9947
+       "")
9948
+;
9949
+;
9950
+; Match:
9951
+;      ALU OpB,R0
9952
+;      CMP 0,R0
9953
+; Transform to:
9954
+;      ALU OpB,R0
9955
+;
9956
+(define_peephole2
9957 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9958
+                       (match_operand:SI 1 ""))
9959 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9960
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9961 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9962 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
9963
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9964
+       ])
9965
+;
9966
+;
9967
+; Match:
9968
+;      ALU OpB,R0
9969
+;      MOV R1,R2       // Can be LDI, LOD, STO, etc.
9970 127 dgisselq
+;      CMP 0,R0
9971 122 dgisselq
+; Transform to:
9972
+;      ALU OpB,R0
9973
+;      MOV R0,R1
9974
+;
9975
+(define_peephole2
9976 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9977
+                       (match_operand:SI 1 ""))
9978 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9979 124 dgisselq
+       (set (match_operand:SI 2 "nonimmediate_operand") (match_operand:SI 3 ""))
9980 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9981 127 dgisselq
+       "(ZIP_PEEPHOLE)&&((!REG_P(operands[2]))||((REGNO(operands[2])!=REGNO(operands[0]))&&((REGNO(operands[2])>=FIRST_PSEUDO_REGISTER)||(REGNO(operands[2])<CC_REG))))"
9982 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
9983
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9984
+       (set (match_dup 2) (match_dup 3))
9985
+       ])
9986
+;
9987
+;
9988
+; Match:
9989
+;      ALU OpB,R0
9990
+;      MOV R0,R1
9991
+;      CMP 0,R1
9992
+; Transform to:
9993
+;      ALU OpB,R0
9994
+;      MOV R0,R1
9995
+;
9996
+(define_peephole2
9997 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9998
+                       (match_operand:SI 1 ""))
9999 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10000 124 dgisselq
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))
10001 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))]
10002 127 dgisselq
+       "(ZIP_PEEPHOLE)"
10003 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
10004
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10005
+       (set (match_dup 2) (match_dup 3))
10006
+       ])
10007
+;
10008 124 dgisselq
+;
10009
+; Match:
10010
+;      MOV R1,R0
10011
+;      ADD $x,R0
10012
+;      (CCREG is dead, and x is within range ...)
10013
+; Transform to:
10014 127 dgisselq
+;      MOV $x(R1),R0
10015 124 dgisselq
+(define_peephole2
10016
+       [(set (match_operand:SI 0 "register_operand")
10017
+               (match_operand:SI 1 "register_operand"))
10018
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
10019
+                               (match_operand 2 "zip_mvimm_operand_p")))
10020
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10021
+       ]
10022 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))"
10023 124 dgisselq
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
10024
+;
10025 127 dgisselq
+; Match:
10026
+;      MOV A(R0),R0
10027
+;      ADD $x,R1
10028
+;      (CCREG is dead, and (A+x) is within range ...)
10029
+; Transform to:
10030
+;      MOV $x(R1),R0
10031 124 dgisselq
+;
10032 127 dgisselq
+(define_peephole2
10033
+       [(set (match_operand:SI 0 "register_operand")
10034
+               (plus:SI (match_operand:SI 1 "register_operand")
10035
+                       (match_operand 2 "zip_mvimm_operand_p")))
10036
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
10037
+                               (match_operand 3 "zip_mvimm_operand_p")))
10038
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10039
+       ]
10040
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
10041
+               &&(INTVAL(operands[2])+INTVAL(operands[3])<((1<<17)))
10042
+               &&(INTVAL(operands[2])+INTVAL(operands[3])>=-(1<<17))"
10043
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
10044
+       "operands[2]=GEN_INT(INTVAL(operands[2])+INTVAL(operands[3]));")
10045 124 dgisselq
+;
10046 127 dgisselq
+;
10047
+;
10048 124 dgisselq
+; Match:
10049
+;      ADD $x,R0
10050
+;      MOV R0,R1
10051
+;      (CCREG is dead, and R0 is dead)
10052
+; Transform to:
10053
+;      MOV (A+$x)(R0),R1
10054
+; ... again, how do I build this plus?
10055
+;
10056
+(define_peephole2
10057
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10058
+                       (plus:SI (match_dup 0)
10059
+                               (match_operand 1 "zip_mvimm_operand_p")))
10060
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10061
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))]
10062 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2, REGNO(operands[0])))&&(peep2_regno_dead_p(2,CC_REG))"
10063 124 dgisselq
+       [(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))])
10064
+;
10065
+;
10066 127 dgisselq
+;
10067 124 dgisselq
+; Match:
10068 127 dgisselq
+;      ADD $x,R0
10069
+;      MOV A(R0),R1
10070
+;      (CCREG is dead, and R0 is dead)
10071
+; Transform to:
10072
+;      MOV (A+$x)(R0),R1
10073
+;
10074
+(define_peephole2
10075
+       [(parallel [
10076
+               (set (match_operand:SI 0 "register_operand")
10077
+                       (plus:SI (match_dup 0)
10078
+                               (match_operand 1 "zip_mvimm_operand_p")))
10079
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10080
+       (set (match_operand:SI 2 "register_operand")
10081
+               (plus:SI (match_dup 0)
10082
+                       (match_operand 3 "zip_mvimm_operand_p")))
10083
+       ]
10084
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
10085
+               &&(peep2_regno_dead_p(1,REGNO(operands[0])))
10086
+               &&(INTVAL(operands[1])+INTVAL(operands[3])<((1<<17)))
10087
+               &&(INTVAL(operands[1])+INTVAL(operands[3])>=-(1<<17))"
10088
+       [(set (match_dup 0) (plus:SI (match_dup 2) (match_dup 3)))]
10089
+       "operands[3]=GEN_INT(INTVAL(operands[1])+INTVAL(operands[3]));")
10090
+;
10091
+;
10092
+;
10093
+; Match:
10094 124 dgisselq
+;      ADD     $x,R0
10095
+;      ADD     R0,Rn
10096
+;      (R0 is dead, if R0 is not Rn)
10097
+; Transform to:
10098
+;      ADD     $x(R0),Rn
10099
+;
10100
+(define_peephole2
10101
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10102
+                       (plus:SI (match_dup 0)
10103
+                               (match_operand 1 "zip_opb_immv_p")))
10104
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10105
+       (parallel [(set (match_operand:SI 2 "register_operand")
10106
+                       (plus:SI (match_dup 2) (match_dup 0)))
10107
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
10108
+       ]
10109 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[2]))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
10110 124 dgisselq
+       [(parallel [(set (match_dup 2)
10111
+                       (plus:SI (match_dup 2)
10112
+                               (plus:SI (match_dup 0)
10113
+                                       (match_dup 1))))
10114
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
10115
+       ])
10116
+;
10117
+; Match:
10118
+;      ADD     $x,R0
10119
+;      LOD     -x(R0),R1
10120
+; Transform to:
10121
+;      LOD     (R0),R1
10122
+;      ADD     $x,R0
10123
+;
10124
+(define_peephole2
10125
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10126
+                       (plus:SI (match_dup 0)
10127
+                               (match_operand 1 "zip_opb_immv_p")))
10128
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10129
+       (set (match_operand:SI 3 "register_operand")
10130
+               (mem:SI (plus:SI (match_dup 0)
10131
+                       (match_operand 2 "zip_opb_immv_p"))))
10132
+       ]
10133 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10134 124 dgisselq
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
10135
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10136
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10137
+       ])
10138 127 dgisselq
+(define_peephole2
10139
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10140
+                       (plus:SI (match_dup 0)
10141
+                               (match_operand 1 "zip_opb_immv_p")))
10142
+               (clobber (reg:CC CC_REG))])
10143
+       (set (match_operand:SI 3 "register_operand")
10144
+               (mem:SI (plus:SI (match_dup 0)
10145
+                       (match_operand 2 "zip_opb_immv_p"))))
10146
+       ]
10147
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10148
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
10149
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10150
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10151
+       ])
10152 124 dgisselq
+;
10153
+;
10154
+;
10155
+; Match:
10156
+;      ADD     $x,R0
10157
+;      STO     R1,-x(R0)
10158
+; Transform to:
10159
+;      STO     R1,(R0)
10160
+;      ADD     $x,R0
10161
+;
10162
+(define_peephole2
10163
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10164
+                       (plus:SI (match_dup 0)
10165
+                               (match_operand 1 "zip_opb_immv_p")))
10166
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10167
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
10168
+               (match_operand:SI 3 "register_operand"))
10169
+       ]
10170 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10171 124 dgisselq
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
10172
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10173
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10174
+       ])
10175 127 dgisselq
+(define_peephole2
10176
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10177
+                       (plus:SI (match_dup 0)
10178
+                               (match_operand 1 "zip_opb_immv_p")))
10179
+               (clobber (reg:CC CC_REG))])
10180
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
10181
+               (match_operand:SI 3 "register_operand"))
10182
+       ]
10183
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10184
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
10185
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10186
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10187
+       ])
10188 124 dgisselq
+;
10189
+;
10190
+; Match:
10191
+;      ADD     $x,R0
10192
+;      ANY     R1,R2 (destination is not R0, source does not reference R0)
10193
+;      ADD     R0,Rn (could be 1 or 2, not 0)
10194
+;      (R0 is dead)
10195
+; Transform to:
10196
+;      ANY     R1,R2
10197
+;      ADD     $x(R0),Rn
10198
+;
10199
+;
10200
+;
10201 127 dgisselq
+; Match:
10202
+;      MOV     R1,R0
10203
+;      AND     #/R2,R0
10204
+;      (Ry dead ...)
10205
+; Transform to:
10206
+;      TEST    #/Rz,Rx
10207 124 dgisselq
+;
10208 127 dgisselq
+(define_peephole2
10209
+       [(set (match_operand:SI 0 "register_operand")
10210
+               (match_operand:SI 1 "register_operand"))
10211
+       (parallel [(set (match_dup 0)
10212
+                       (and:SI (match_dup 0)
10213
+                               (match_operand:SI 2 "zip_opb_single_operand_p")))
10214
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10215
+       ]
10216
+       "((1)||(ZIP_PEEPHOLE))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
10217
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_dup 1) (match_dup 2))
10218
+                       (const_int 0)))])
10219
+;
10220
+; Match:
10221
+;      (call ...
10222
+;      (set (pc) (label))
10223
+;  or (in asm)
10224
+;      MOV     .Lcallx(PC),R0
10225
+;      BRA     (somewhere)
10226
+; .Lcallx
10227
+;      BRA     (somewhere-else)
10228
+; Transform to:
10229
+;
10230
+;      (sequence [(call ...
10231
+;              (set (pc) (label))])
10232
+;   or (in asm)
10233
+;      "LDI    (somewhere-else),R0
10234
+;      BRA     subroutine"
10235
+;
10236
+; While the following looks good, it doesnt work.  My guess is that the reason
10237
+; why it doesnt work is that the jump at the end crosses basic block boundaries.
10238
+;
10239
+;(define_insn "void_call_mem_unspec"
10240
+;      [(call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p" ""))] UNSPEC_RAW_CALL)
10241
+;                      (match_operand 1 "const_int_operand" "n"))
10242
+;              (clobber (reg:SI RTN_REG))
10243
+;              (clobber (reg:CC CC_REG))]
10244
+;      ""
10245
+;      "BRA\t%0,PC"
10246
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
10247
+;(define_peephole2
10248
+;      [(parallel [(call (mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))
10249
+;                      (match_operand 1 "const_int_operand"))
10250
+;              (clobber (reg:SI RTN_REG))
10251
+;              (clobber (reg:CC CC_REG))])
10252
+;      ; The match operand for the (set (pc) ...) cannot have anything but
10253
+;      ; VOIDmode, or it wont match.
10254
+;      (set (pc) (match_operand:VOID 2 "zip_const_address_operand_p"))]
10255
+;      ""
10256
+;      [(set (reg:SI RTN_REG) (match_dup 2))
10257
+;      (call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))] UNSPEC_RAW_CALL)
10258
+;                      (match_operand 1 "const_int_operand"))
10259
+;              (use (reg:SI RTN_REG))
10260
+;              (clobber (reg:SI RTN_REG))
10261
+;              (clobber (reg:CC CC_REG))]
10262
+;      "fprintf(stderr, \"CALL-JUMP Matched\");")
10263
+;
10264
+;
10265
+;
10266
+; So, the following *should* have worked as well.  However, this falls apart
10267
+; because the 'final' routine can't tell if we are calling a subroutine in this
10268
+; function or not.
10269
+;
10270
+;(define_peephole
10271
+       ;[(parallel [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p"))
10272
+                       ;(match_operand 1 "const_int_operand"))
10273
+               ;(clobber (reg:SI RTN_REG))
10274
+               ;(clobber (reg:CC CC_REG))])
10275
+       ;(set (pc) (label_ref (match_operand 2 "")))]
10276
+       ;""
10277
+       ;"LDI\t%2,R0\;BRA\t%0"
10278
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
10279
+;
10280 124 dgisselq
+; and for
10281
+;      BRA target
10282
+;      BRA target ; two branches to the same identical target in a row ...
10283
+;
10284
+;
10285
+;
10286 102 dgisselq
+; STILL MISSING:
10287
+;      SYSCALL(ID)
10288
+;              MOV %ID,R0
10289
+;              CLR     CC
10290
+;      cmove   ... the conditional move, created from a
10291
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
10292
+;      pattern
10293
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
10294
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
10295 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-08 12:10:21.982586940 -0500
10296
@@ -0,0 +1,23 @@
10297 102 dgisselq
+/*
10298
+ * Commends in C-long comment form
10299
+ * class
10300
+ *     Mode = "SI"
10301
+ *     PRECISION, BYTESIZE, COUNT ??
10302
+ *     FORMAT
10303
+ *     EXPR
10304 111 dgisselq
+ *
10305
+ * The manual says I need to define BITS_PER_UNIT here.
10306 102 dgisselq
+ */
10307
+// INT_MODE(QI, 1);
10308
+// INT_MODE(HI, 1);
10309
+// INT_MODE(SI, 1);
10310
+// INT_MODE(DI, 2);
10311
+
10312
+// FLOAT_MODE(SF, 1, ieee_single_format);
10313
+// FLOAT_MODE(DF, 2, ieee_single_format);
10314
+
10315
+// We cannot override machmodes.def from here.  Thus, even though our QI,
10316
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
10317
+// change needed to be made in machmodes.def.  Hence, here is a target
10318
+// configuration change--in machmodes.def--that properly belonged in the
10319
+// config directory.
10320
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
10321
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
10322 142 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-05-09 11:16:54.734258166 -0400
10323
@@ -0,0 +1,83 @@
10324 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
10325
+//
10326
+// Filename:   zip-protos.h
10327
+//
10328
+// Project:    Zip CPU backend for the GNU Compiler Collection
10329
+//
10330
+// Purpose:
10331
+//
10332
+// Creator:    Dan Gisselquist, Ph.D.
10333
+//             Gisselquist Technology, LLC
10334
+//
10335
+////////////////////////////////////////////////////////////////////////////////
10336
+//
10337
+// Copyright (C) 2016, Gisselquist Technology, LLC
10338
+//
10339
+// This program is free software (firmware): you can redistribute it and/or
10340
+// modify it under the terms of  the GNU General Public License as published
10341
+// by the Free Software Foundation, either version 3 of the License, or (at
10342
+// your option) any later version.
10343
+//
10344
+// This program is distributed in the hope that it will be useful, but WITHOUT
10345
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
10346
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
10347
+// for more details.
10348
+//
10349
+// You should have received a copy of the GNU General Public License along
10350
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
10351
+// target there if the PDF file isn't present.)  If not, see
10352
+// <http://www.gnu.org/licenses/> for a copy.
10353
+//
10354
+// License:    GPL, v3, as defined and found on www.gnu.org,
10355
+//             http://www.gnu.org/licenses/gpl.html
10356
+//
10357
+//
10358
+////////////////////////////////////////////////////////////////////////////////
10359
+#ifndef        ZIP_PROTOS_H
10360
+#define        ZIP_PROTOS_H
10361
+
10362 127 dgisselq
+extern bool    zip_supported_condition(int c);
10363 102 dgisselq
+extern void    zip_expand_prologue(void);
10364
+extern void    zip_expand_epilogue(void);
10365 142 dgisselq
+extern bool    zip_expand_movsicc(rtx,rtx,rtx,rtx);
10366 102 dgisselq
+extern int     zip_initial_elimination_offset(int, int);
10367
+extern void    zip_print_operand(FILE *, rtx, int);
10368
+extern void    zip_print_operand_address(FILE *, rtx);
10369
+extern enum    reg_class       zip_reg_class(int);
10370
+extern rtx     zip_return_addr_rtx(int, rtx);
10371
+extern int     zip_num_arg_regs(enum machine_mode, tree);
10372
+
10373
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
10374 122 dgisselq
+
10375
+#ifdef HAVE_cc0
10376 102 dgisselq
+extern void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
10377 122 dgisselq
+#else
10378
+extern void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
10379
+#endif
10380 102 dgisselq
+extern int     zip_address_operand(rtx op);
10381
+extern int     zip_const_address_operand(rtx op);
10382
+extern bool    zip_gen_move_rtl(rtx, rtx);
10383
+extern bool    zip_use_return_insn(void);
10384
+extern const char *zip_set_zero_or_one(rtx, rtx);
10385
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
10386
+
10387 127 dgisselq
+extern int     zip_insn_sets_cc(rtx_insn *insn);
10388
+extern int     zip_is_conditional(rtx_insn *insn);
10389 102 dgisselq
+extern int     zip_ct_address_operand(rtx op);
10390 111 dgisselq
+extern int     zip_pd_opb_operand(rtx op);
10391 102 dgisselq
+extern int     zip_pd_mov_operand(rtx op);
10392 111 dgisselq
+extern int     zip_pd_imm_operand(rtx op);
10393
+extern int     zip_pd_mvimm_operand(rtx op);
10394 102 dgisselq
+extern int     zip_ct_const_address_operand(rtx op);
10395
+extern int     zip_pd_const_address_operand(rtx op);
10396
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
10397
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
10398
+
10399 122 dgisselq
+extern void    zip_ifcvt_machdep_init(struct ce_if_block *ceinfo);
10400
+extern void    zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo);
10401
+extern void    zip_ifcvt_modify_final(struct ce_if_block *ceinfo);
10402
+extern void    zip_ifcvt_modify_tests(struct ce_if_block *ceinfo, rtx *true_expr, rtx *false_expr);
10403 142 dgisselq
+extern void    zip_ifcvt_modify_insn(struct ce_if_block *ceinfo, rtx pattern, rtx_insn *insn);
10404 122 dgisselq
+
10405 102 dgisselq
+#endif
10406
+
10407
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
10408
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
10409
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
10410
@@ -479,6 +479,10 @@
10411
 tilepro*-*-*)
10412
        cpu_type=tilepro
10413
        ;;
10414
+zip*)
10415
+       cpu_type=zip
10416
+       tmake_file=zip/t-zip
10417
+       ;;
10418
 esac
10419
 
10420
 tm_file=${cpu_type}/${cpu_type}.h
10421
@@ -2972,6 +2976,15 @@
10422
        c_target_objs="m32c-pragma.o"
10423
        cxx_target_objs="m32c-pragma.o"
10424
        ;;
10425
+zip-*-netbsd*)
10426
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
10427
+       tmake_file="${tmake_file} zip/t-zip"
10428
+       ;;
10429
+zip*)
10430
+       target_has_targetm_common=yes
10431
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
10432
+       tmake_file="${tmake_file} zip/t-zip"
10433
+       ;;
10434
 *)
10435
        echo "*** Configuration ${target} not supported" 1>&2
10436
        exit 1
10437
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
10438
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
10439 138 dgisselq
+++ gcc-5.3.0-zip/gcc/cse.c     2016-05-04 11:07:38.874831028 -0400
10440
@@ -70,6 +70,7 @@
10441
 #include "dbgcnt.h"
10442
 #include "rtl-iter.h"
10443
 
10444
+
10445
 /* The basic idea of common subexpression elimination is to go
10446
    through the code, keeping a record of expressions that would
10447
    have the same value at the current scan point, and replacing
10448
@@ -634,6 +635,16 @@
10449 102 dgisselq
 
10450
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
10451
 
10452 111 dgisselq
+// #define     DO_ZIP_DEBUGS
10453 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
10454
+#include <stdio.h>
10455 138 dgisselq
+extern void    zip_debug_rtx(const_rtx);
10456
+extern void    zip_debug_rtx_pfx(char *, const_rtx);
10457 102 dgisselq
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
10458
+#else
10459
+#define        ZIP_DEBUG_LINE(STR,RTX)
10460
+#endif
10461
+
10462
 static bool
10463
 fixed_base_plus_p (rtx x)
10464
 {
10465 138 dgisselq
@@ -2898,6 +2909,7 @@
10466 102 dgisselq
          validate_canon_reg (&XVECEXP (x, i, j), insn);
10467
     }
10468
 
10469
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
10470
   return x;
10471
 }
10472
 
10473 138 dgisselq
@@ -3125,6 +3137,8 @@
10474
   rtx new_rtx = 0;
10475
   int changed = 0;
10476
 
10477
+ZIP_DEBUG_LINE("CSE:FOLD-RTX", insn);
10478
+
10479
   /* Operands of X.  */
10480
   /* Workaround -Wmaybe-uninitialized false positive during
10481
      profiledbootstrap by initializing them.  */
10482
@@ -3144,14 +3158,16 @@
10483 102 dgisselq
   if (x == 0)
10484
     return x;
10485
 
10486
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
10487
   /* Try to perform some initial simplifications on X.  */
10488
   code = GET_CODE (x);
10489
   switch (code)
10490
     {
10491
     case MEM:
10492
     case SUBREG:
10493
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
10494
-        return new_rtx;
10495
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
10496
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
10497
+        return new_rtx; }
10498
       return x;
10499
 
10500
     case CONST:
10501 138 dgisselq
@@ -3208,6 +3224,8 @@
10502 102 dgisselq
        rtx folded_arg = XEXP (x, i), const_arg;
10503
        machine_mode mode_arg = GET_MODE (folded_arg);
10504
 
10505
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
10506
+
10507
        switch (GET_CODE (folded_arg))
10508
          {
10509
          case MEM:
10510 138 dgisselq
@@ -3317,6 +3335,7 @@
10511 102 dgisselq
        }
10512
 
10513
       apply_change_group ();
10514
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
10515
     }
10516
 
10517
   /* If X is an arithmetic operation, see if we can simplify it.  */
10518 138 dgisselq
@@ -4203,6 +4222,7 @@
10519 102 dgisselq
 {
10520
   rtx dest = SET_DEST (set);
10521
   rtx src = SET_SRC (set);
10522
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
10523
 
10524
   if (REG_P (dest)
10525
       && REG_P (src) && ! HARD_REGISTER_P (src)
10526 138 dgisselq
@@ -4258,6 +4278,7 @@
10527 102 dgisselq
            }
10528
        }
10529
     }
10530
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
10531
 }
10532
 
10533
 /* Record all the SETs in this instruction into SETS_PTR,
10534 138 dgisselq
@@ -4351,6 +4372,7 @@
10535 102 dgisselq
   rtx tem;
10536
   rtx x = PATTERN (insn);
10537
   int i;
10538
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
10539
 
10540
   if (CALL_P (insn))
10541
     {
10542 138 dgisselq
@@ -4364,6 +4386,7 @@
10543 102 dgisselq
       canon_reg (SET_SRC (x), insn);
10544
       apply_change_group ();
10545
       fold_rtx (SET_SRC (x), insn);
10546
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
10547
     }
10548
   else if (GET_CODE (x) == CLOBBER)
10549
     {
10550 138 dgisselq
@@ -4400,6 +4423,7 @@
10551 102 dgisselq
     canon_reg (PATTERN (insn), insn);
10552
   else if (GET_CODE (x) == PARALLEL)
10553
     {
10554
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
10555
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
10556
        {
10557
          rtx y = XVECEXP (x, 0, i);
10558 138 dgisselq
@@ -4491,6 +4515,7 @@
10559 102 dgisselq
 
10560
      The result of apply_change_group can be ignored; see canon_reg.  */
10561
 
10562
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
10563
   apply_change_group ();
10564
 }
10565
 
10566
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
10567
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
10568
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
10569
@@ -480,6 +480,8 @@
10570
 #define LOG2_BITS_PER_UNIT 3
10571
 #elif BITS_PER_UNIT == 16
10572
 #define LOG2_BITS_PER_UNIT 4
10573
+#elif BITS_PER_UNIT == 32
10574
+#define LOG2_BITS_PER_UNIT 5
10575
 #else
10576
 #error Unknown BITS_PER_UNIT
10577
 #endif
10578 127 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/df-scan.c gcc-5.3.0-zip/gcc/df-scan.c
10579
--- gcc-5.3.0-original/gcc/df-scan.c    2015-01-09 15:18:42.000000000 -0500
10580
+++ gcc-5.3.0-zip/gcc/df-scan.c 2016-04-14 16:12:03.614777002 -0400
10581
@@ -61,6 +61,14 @@
10582
 
10583
 typedef struct df_mw_hardreg *df_mw_hardreg_ptr;
10584
 
10585
+// #define     DO_ZIP_DEBUGS
10586
+#ifdef DO_ZIP_DEBUGS
10587
+extern void    zip_debug_rtx(const_rtx);
10588
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10589
+#else
10590
+#define        ZIP_DEBUG_LINE(STR,RTX)
10591
+#endif
10592
+
10593
 
10594
 #ifndef HAVE_epilogue
10595
 #define HAVE_epilogue 0
10596 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
10597
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
10598
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
10599
@@ -0,0 +1,214 @@
10600
+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
10601
+entering extended mode
10602
+ restricted \write18 enabled.
10603
+ file:line:error style messages enabled.
10604
+ %&-line parsing enabled.
10605
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
10606
+gcc.texi
10607
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
10608
+Loading texinfo [version 2013-09-11.11]:
10609
+\bindingoffset=\dimen16
10610
+\normaloffset=\dimen17
10611
+\pagewidth=\dimen18
10612
+\pageheight=\dimen19
10613
+\outerhsize=\dimen20
10614
+\outervsize=\dimen21
10615
+\cornerlong=\dimen22
10616
+\cornerthick=\dimen23
10617
+\topandbottommargin=\dimen24
10618
+\headlinebox=\box16
10619
+\footlinebox=\box17
10620
+\margin=\insert252
10621
+\EMsimple=\toks13
10622
+\groupbox=\box18
10623
+\groupinvalidhelp=\toks14
10624
+\mil=\dimen25
10625
+\exdentamount=\skip18
10626
+\inmarginspacing=\skip19
10627
+\centerpenalty=\count27
10628
+ pdf,
10629
+\tempnum=\count28
10630
+\lnkcount=\count29
10631
+\filename=\toks15
10632
+\filenamelength=\count30
10633
+\pgn=\count31
10634
+\toksA=\toks16
10635
+\toksB=\toks17
10636
+\toksC=\toks18
10637
+\toksD=\toks19
10638
+\boxA=\box19
10639
+\countA=\count32
10640
+\nopdfimagehelp=\toks20
10641
+ fonts,
10642
+\sffam=\fam8
10643
+\textleading=\dimen26
10644
+ markup,
10645
+\fontdepth=\count33
10646
+ glyphs,
10647
+\errorbox=\box20
10648
+
10649
+page headings,
10650
+\titlepagetopglue=\skip20
10651
+\titlepagebottomglue=\skip21
10652
+\evenheadline=\toks21
10653
+\oddheadline=\toks22
10654
+\evenfootline=\toks23
10655
+\oddfootline=\toks24
10656
+ tables,
10657
+\tableindent=\dimen27
10658
+\itemindent=\dimen28
10659
+\itemmargin=\dimen29
10660
+\itemmax=\dimen30
10661
+\itemno=\count34
10662
+\multitableparskip=\skip22
10663
+\multitableparindent=\skip23
10664
+\multitablecolspace=\dimen31
10665
+\multitablelinespace=\skip24
10666
+\colcount=\count35
10667
+\everytab=\toks25
10668
+ conditionals,
10669
+\doignorecount=\count36
10670
+ indexing,
10671
+\whatsitskip=\skip25
10672
+\whatsitpenalty=\count37
10673
+\secondaryindent=\skip26
10674
+\partialpage=\box21
10675
+\doublecolumnhsize=\dimen32
10676
+ sectioning,
10677
+\unnumberedno=\count38
10678
+\chapno=\count39
10679
+\secno=\count40
10680
+\subsecno=\count41
10681
+\subsubsecno=\count42
10682
+\appendixno=\count43
10683
+\absseclevel=\count44
10684
+\secbase=\count45
10685
+\chapheadingskip=\skip27
10686
+\secheadingskip=\skip28
10687
+\subsecheadingskip=\skip29
10688
+ toc,
10689
+\tocfile=\write0
10690
+\contentsrightmargin=\skip30
10691
+\savepageno=\count46
10692
+\lastnegativepageno=\count47
10693
+\tocindent=\dimen33
10694
+ environments,
10695
+\lispnarrowing=\skip31
10696
+\envskipamount=\skip32
10697
+\circthick=\dimen34
10698
+\cartouter=\dimen35
10699
+\cartinner=\dimen36
10700
+\normbskip=\skip33
10701
+\normpskip=\skip34
10702
+\normlskip=\skip35
10703
+\lskip=\skip36
10704
+\rskip=\skip37
10705
+\nonfillparindent=\dimen37
10706
+\tabw=\dimen38
10707
+\verbbox=\box22
10708
+
10709
+defuns,
10710
+\defbodyindent=\skip38
10711
+\defargsindent=\skip39
10712
+\deflastargmargin=\skip40
10713
+\defunpenalty=\count48
10714
+\parencount=\count49
10715
+\brackcount=\count50
10716
+ macros,
10717
+\paramno=\count51
10718
+\macname=\toks26
10719
+ cross references,
10720
+\auxfile=\write1
10721
+\savesfregister=\count52
10722
+\toprefbox=\box23
10723
+\printedrefnamebox=\box24
10724
+\infofilenamebox=\box25
10725
+\printedmanualbox=\box26
10726
+ insertions,
10727
+\footnoteno=\count53
10728
+\SAVEfootins=\box27
10729
+\SAVEmargin=\box28
10730
+
10731
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
10732
+This is `epsf.tex' v2.7.4 <14 February 2011>
10733
+\epsffilein=\read1
10734
+\epsfframemargin=\dimen39
10735
+\epsfframethickness=\dimen40
10736
+\epsfrsize=\dimen41
10737
+\epsftmp=\dimen42
10738
+\epsftsize=\dimen43
10739
+\epsfxsize=\dimen44
10740
+\epsfysize=\dimen45
10741
+\pspoints=\dimen46
10742
+)
10743
+\noepsfhelp=\toks27
10744
+ localization,
10745
+\nolanghelp=\toks28
10746
+\countUTFx=\count54
10747
+\countUTFy=\count55
10748
+\countUTFz=\count56
10749
+ formatting,
10750
+\defaultparindent=\dimen47
10751
+ and turning on texinfo input format.)
10752
+\openout1 = `gcc.aux'.
10753
+
10754
+@cpindfile=@write2
10755
+@fnindfile=@write3
10756
+@vrindfile=@write4
10757
+@tpindfile=@write5
10758
+@kyindfile=@write6
10759
+@pgindfile=@write7
10760
+texinfo.tex: doing @include of gcc-common.texi
10761
+
10762
+
10763
+./gcc.texi:25: I can't find file `gcc-common.texi'.
10764
+@temp ->@input gcc-common.texi
10765
+
10766
+@includezzz ...and @input #1 }@expandafter }@temp
10767
+                                                  @popthisfilestack
10768
+l.25 @include gcc-common.texi
10769
+
10770
+(Press Enter to retry, or Control-D to exit)
10771
+Please type another input file name: include/gcc-common.texi
10772
+(./include/gcc-common.texi
10773
+texinfo.tex: doing @include of gcc-vers.texi
10774
+
10775
+
10776
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
10777
+@temp ->@input gcc-vers.texi
10778
+
10779
+@includezzz ...and @input #1 }@expandafter }@temp
10780
+                                                  @popthisfilestack
10781
+l.11 @include gcc-vers.texi
10782
+
10783
+(Press Enter to retry, or Control-D to exit)
10784
+Please type another input file name: include/gcc-vers.texi
10785
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
10786
+@temp ->@input gcc-vers.texi
10787
+
10788
+@includezzz ...and @input #1 }@expandafter }@temp
10789
+                                                  @popthisfilestack
10790
+l.11 @include gcc-vers.texi
10791
+
10792
+(Press Enter to retry, or Control-D to exit)
10793
+Please type another input file name:
10794
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
10795
+@temp ->@input gcc-vers.texi
10796
+
10797
+@includezzz ...and @input #1 }@expandafter }@temp
10798
+                                                  @popthisfilestack
10799
+l.11 @include gcc-vers.texi
10800
+
10801
+(Press Enter to retry, or Control-D to exit)
10802
+Please type another input file name:
10803
+./include/gcc-common.texi:11: Emergency stop.
10804
+@temp ->@input gcc-vers.texi
10805
+
10806
+@includezzz ...and @input #1 }@expandafter }@temp
10807
+                                                  @popthisfilestack
10808
+l.11 @include gcc-vers.texi
10809
+
10810
+End of file on the terminal!
10811
+
10812
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
10813
+duced!
10814 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/emit-rtl.c gcc-5.3.0-zip/gcc/emit-rtl.c
10815
--- gcc-5.3.0-original/gcc/emit-rtl.c   2015-08-05 07:20:59.000000000 -0400
10816 138 dgisselq
+++ gcc-5.3.0-zip/gcc/emit-rtl.c        2016-05-02 07:48:47.925017436 -0400
10817 117 dgisselq
@@ -81,6 +81,15 @@
10818
 #include "builtins.h"
10819
 #include "rtl-iter.h"
10820
 
10821
+// #define     DO_ZIP_DEBUGS
10822
+#include <stdio.h>
10823
+#ifdef DO_ZIP_DEBUGS
10824
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10825
+extern void    zip_debug_rtx(const_rtx);
10826
+#else
10827
+#define        ZIP_DEBUG_LINE(STR,RTX)
10828
+#endif
10829
+
10830
 struct target_rtl default_target_rtl;
10831
 #if SWITCHABLE_TARGET
10832
 struct target_rtl *this_target_rtl = &default_target_rtl;
10833 127 dgisselq
@@ -2979,6 +2988,8 @@
10834 117 dgisselq
       break;
10835
     }
10836
 
10837
+ZIP_DEBUG_LINE("Before RTX_FLAG",x);
10838
+
10839
   /* This rtx may not be shared.  If it has already been seen,
10840
      replace it with a copy of itself.  */
10841
 
10842 127 dgisselq
@@ -2989,6 +3000,8 @@
10843 117 dgisselq
     }
10844
   RTX_FLAG (x, used) = 1;
10845
 
10846
+ZIP_DEBUG_LINE("Post RTX_FLAG",x);
10847
+
10848
   /* Now scan the subexpressions recursively.
10849
      We can store any replaced subexpressions directly into X
10850
      since we know X is not shared!  Any vectors in X
10851 127 dgisselq
@@ -3665,7 +3678,9 @@
10852
     split_branch_probability = XINT (note, 0);
10853
   probability = split_branch_probability;
10854
 
10855
+ZIP_DEBUG_LINE("Before split", trial);
10856
   seq = safe_as_a <rtx_insn *> (split_insns (pat, trial));
10857
+ZIP_DEBUG_LINE("After split", seq);
10858
 
10859
   split_branch_probability = -1;
10860
 
10861
@@ -3834,6 +3849,7 @@
10862
     if (! tem->deleted () && INSN_P (tem))
10863
       tem = try_split (PATTERN (tem), tem, 1);
10864
 
10865
+
10866
   /* Return either the first or the last insn, depending on which was
10867
      requested.  */
10868
   return last
10869 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
10870
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
10871 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
10872 102 dgisselq
@@ -7999,6 +7999,8 @@
10873
    the back of the caller.
10874
    The normal operating mode is to pass FALSE for this parameter.  */
10875
 
10876
+#include "print-tree.h"
10877
+
10878
 rtx
10879
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
10880
                  enum expand_modifier modifier, rtx *alt_rtl,
10881 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/final.c gcc-5.3.0-zip/gcc/final.c
10882
--- gcc-5.3.0-original/gcc/final.c      2015-01-15 08:28:42.000000000 -0500
10883 127 dgisselq
+++ gcc-5.3.0-zip/gcc/final.c   2016-04-20 20:52:07.186056061 -0400
10884 111 dgisselq
@@ -109,6 +109,14 @@
10885
 #include "wide-int-print.h"
10886
 #include "rtl-iter.h"
10887
 
10888 122 dgisselq
+// #define     DO_ZIP_DEBUGS
10889 111 dgisselq
+#ifdef DO_ZIP_DEBUGS
10890
+extern void zip_debug_rtx(const_rtx);
10891
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10892
+#else
10893
+#define        ZIP_DEBUG_LINE(STR,RTX)
10894
+#endif
10895
+
10896
 #ifdef XCOFF_DEBUGGING_INFO
10897
 #include "xcoffout.h"          /* Needed for external data
10898
                                   declarations for e.g. AIX 4.x.  */
10899
@@ -2071,6 +2079,8 @@
10900
   /* Output the insns.  */
10901
   for (insn = first; insn;)
10902
     {
10903
+       ZIP_DEBUG_LINE("final()\n", insn);
10904
+
10905
       if (HAVE_ATTR_length)
10906
        {
10907
          if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
10908 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
10909
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
10910
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
10911
@@ -330,7 +330,8 @@
10912
         the size of a CC mode is four units.  */
10913
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
10914
 
10915
-      m->bytesize = 4;
10916
+       /* For the ZipCPU, however, it is only one unit */
10917
+      m->bytesize = 1;
10918
       m->ncomponents = 1;
10919
       m->component = 0;
10920
       break;
10921
@@ -766,11 +767,12 @@
10922
 
10923
   /* So put the default value unless the target needs a non standard
10924
      value. */
10925
-#ifdef BITS_PER_UNIT
10926
-  bits_per_unit = BITS_PER_UNIT;
10927
-#else
10928
-  bits_per_unit = 8;
10929
-#endif
10930
+// #ifdef BITS_PER_UNIT
10931
+  // bits_per_unit = BITS_PER_UNIT;
10932
+// #else
10933
+  bits_per_unit = 32;
10934
+#warning "Is there a more automated way to set bits per unit?"
10935
+// #endif
10936
 
10937
 #ifdef MAX_BITSIZE_MODE_ANY_INT
10938
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
10939
@@ -1083,7 +1085,7 @@
10940
       first = modes[c];
10941
       last = 0;
10942
       for (m = first; m; last = m, m = m->next)
10943
-       ;
10944
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
10945
 
10946
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
10947
         end will try to use it for bitfields in structures and the
10948
@@ -1268,7 +1270,7 @@
10949
            continue;
10950
          if (m->precision != (unsigned int) -1)
10951
            {
10952
-             if (m2->precision != 2 * m->precision)
10953
+             if (m2->precision < 2 * m->precision)
10954
                continue;
10955
            }
10956
          else
10957
@@ -1323,7 +1325,6 @@
10958
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
10959
     else
10960
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
10961
-
10962
   puts ("#undef MODE_MASK");
10963
   print_closer ();
10964
 }
10965
@@ -1351,12 +1352,23 @@
10966
   int c;
10967
   struct mode_data *m;
10968
 
10969
+  puts(
10970
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
10971
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
10972
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
10973
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
10974
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
10975
+" * of the target word in size.  However, this tries to do a little something\n"
10976
+" * teach our compiler what we are doing.\n"
10977
+" */\n");
10978
   print_maybe_const_decl ("%sunsigned char",
10979
                          "mode_base_align", "NUM_MACHINE_MODES",
10980
                          alignment);
10981
 
10982
   for_all_modes (c, m)
10983
-    tagged_printf ("%u", m->alignment, m->name);
10984
+    tagged_printf ("%u", 4*m->bytesize,
10985
+               // m->alignment,
10986
+               m->name);
10987
 
10988
   print_closer ();
10989
 }
10990 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/jump.c gcc-5.3.0-zip/gcc/jump.c
10991
--- gcc-5.3.0-original/gcc/jump.c       2015-01-27 04:19:30.000000000 -0500
10992 122 dgisselq
+++ gcc-5.3.0-zip/gcc/jump.c    2016-04-06 14:06:50.207563805 -0400
10993 117 dgisselq
@@ -80,6 +80,14 @@
10994
 #include "target.h"
10995
 #include "rtl-iter.h"
10996
 
10997
+// #define     DO_ZIP_DEBUGS
10998
+#ifdef DO_ZIP_DEBUGS
10999
+#include <stdio.h>
11000
+#define        ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
11001
+extern void zip_debug_rtx(const_rtx);
11002
+#else
11003
+#define        ZIP_DEBUG_LINE(STR,RTX)
11004
+#endif
11005
 /* Optimize jump y; x: ... y: jumpif... x?
11006
    Don't know if it is worth bothering with.  */
11007
 /* Optimize two cases of conditional jump to conditional jump?
11008
@@ -1136,6 +1144,7 @@
11009
   int i;
11010
   const char *fmt;
11011
 
11012
+ZIP_DEBUG_LINE("Mark jump label",insn);
11013
   switch (code)
11014
     {
11015
     case PC:
11016
@@ -1248,6 +1257,8 @@
11017
       break;
11018
     }
11019
 
11020
+ZIP_DEBUG_LINE("Post case",insn);
11021
+
11022
   fmt = GET_RTX_FORMAT (code);
11023
 
11024
   /* The primary target of a tablejump is the label of the ADDR_VEC,
11025 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
11026
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
11027 111 dgisselq
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-08 11:56:45.375491523 -0500
11028 102 dgisselq
@@ -184,11 +184,11 @@
11029
    larger types, then corresponding modes must be added here.  The
11030
    name OI is reserved for a 256-bit type (needed by some back ends).
11031
     */
11032
-INT_MODE (QI, 1);
11033
-INT_MODE (HI, 2);
11034
-INT_MODE (SI, 4);
11035
-INT_MODE (DI, 8);
11036
-INT_MODE (TI, 16);
11037
+// INT_MODE (QI, 1);
11038
+// INT_MODE (HI, 1);
11039
+INT_MODE (SI, 1);
11040
+INT_MODE (DI, 2);
11041
+INT_MODE (TI, 4);
11042
 
11043
 /* No partial integer modes are defined by default.  */
11044
 
11045 111 dgisselq
@@ -206,35 +206,35 @@
11046 102 dgisselq
    These are the IEEE mappings.  They can be overridden with
11047
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
11048
 
11049
-FLOAT_MODE (SF, 4, ieee_single_format);
11050
-FLOAT_MODE (DF, 8, ieee_double_format);
11051
+FLOAT_MODE (SF, 1, ieee_single_format);
11052
+FLOAT_MODE (DF, 2, ieee_double_format);
11053
 
11054
 /* Basic CC modes.
11055
    FIXME define this only for targets that need it.  */
11056 111 dgisselq
 CC_MODE (CC);
11057 102 dgisselq
 
11058
 /* Fixed-point modes.  */
11059 111 dgisselq
-FRACT_MODE (QQ, 1, 7); /* s.7 */
11060 102 dgisselq
-FRACT_MODE (HQ, 2, 15); /* s.15 */
11061
-FRACT_MODE (SQ, 4, 31); /* s.31 */
11062
-FRACT_MODE (DQ, 8, 63); /* s.63 */
11063
-FRACT_MODE (TQ, 16, 127); /* s.127 */
11064 111 dgisselq
-
11065
-UFRACT_MODE (UQQ, 1, 8); /* .8 */
11066 102 dgisselq
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
11067
-UFRACT_MODE (USQ, 4, 32); /* .32 */
11068
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
11069
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
11070 111 dgisselq
-
11071
-ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
11072
-ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
11073
-ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
11074
-ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
11075
-
11076
-UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
11077
-UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
11078
-UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
11079
-UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
11080
+/* FRACT_MODE (QQ, 1, 7); /* s.7 */
11081
+/* FRACT_MODE (HQ, 1, 15); /* s.15 */
11082
+FRACT_MODE (SQ, 1, 31); /* s.31 */
11083
+FRACT_MODE (DQ, 2, 63); /* s.63 */
11084
+FRACT_MODE (TQ, 4, 127); /* s.127 */
11085
+
11086
+/* UFRACT_MODE (UQQ, 1, 8); /* .8 */
11087
+/* UFRACT_MODE (UHQ, 1, 16); /* .16 */
11088 102 dgisselq
+UFRACT_MODE (USQ, 1, 32); /* .32 */
11089
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
11090
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
11091 111 dgisselq
+
11092
+/* ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
11093
+ACCUM_MODE (SA, 1, 16, 15); /* s16.15 */
11094
+ACCUM_MODE (DA, 2, 32, 31); /* s32.31 */
11095
+ACCUM_MODE (TA, 4, 64, 63); /* s64.63 */
11096
+
11097
+/* UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
11098
+UACCUM_MODE (USA, 1, 16, 16); /* 16.16 */
11099
+UACCUM_MODE (UDA, 2, 32, 32); /* 32.32 */
11100
+UACCUM_MODE (UTA, 4, 64, 64); /* 64.64 */
11101 102 dgisselq
 
11102 111 dgisselq
 /* Allow the target to specify additional modes of various kinds.  */
11103
 #if HAVE_EXTRA_MODES
11104 102 dgisselq
@@ -246,9 +246,9 @@
11105
 COMPLEX_MODES (FLOAT);
11106
 
11107
 /* Decimal floating point modes.  */
11108
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
11109
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
11110
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
11111
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
11112
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
11113
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
11114
 
11115
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
11116
    The tm.h file specifies which one.  It is not a distinct mode.  */
11117
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
11118
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
11119
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
11120
@@ -180,13 +180,7 @@
11121
 /* Get the size in bytes and bits of an object of mode MODE.  */
11122
 
11123
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
11124
-#if GCC_VERSION >= 4001
11125
-#define GET_MODE_SIZE(MODE) \
11126
-  ((unsigned short) (__builtin_constant_p (MODE) \
11127
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
11128
-#else
11129
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
11130
-#endif
11131
 #define GET_MODE_BITSIZE(MODE) \
11132
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
11133
 
11134
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
11135
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
11136
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
11137
@@ -765,10 +765,14 @@
11138
        {
11139
          switch (TYPE_MODE (type))
11140
            {
11141
+#ifdef HAVE_QImode
11142
            case QImode:
11143
              charType = 'C'; break;
11144
+#endif
11145
+#ifdef HAVE_HImode
11146
            case HImode:
11147
              charType = 'S'; break;
11148
+#endif
11149
            case SImode:
11150
              {
11151
                if (type == long_unsigned_type_node)
11152
@@ -788,10 +792,14 @@
11153
        {
11154
          switch (TYPE_MODE (type))
11155
            {
11156
+#ifdef HAVE_QImode
11157
            case QImode:
11158
              charType = 'c'; break;
11159
+#endif
11160
+#ifdef HAVE_HImode
11161
            case HImode:
11162
              charType = 's'; break;
11163
+#endif
11164
            case SImode:
11165
              {
11166
                if (type == long_integer_type_node)
11167
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
11168
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
11169 111 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-24 21:30:23.402590035 -0400
11170
@@ -71,6 +71,14 @@
11171 102 dgisselq
 #include "df.h"
11172
 #include "dbgcnt.h"
11173
 
11174 111 dgisselq
+// #define     DO_ZIP_DEBUGS
11175 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
11176
+extern void zip_debug_rtx(const_rtx);
11177
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11178
+#else
11179
+#define        ZIP_DEBUG_LINE(STR,RTX)
11180
+#endif
11181
+
11182
 static int reload_cse_noop_set_p (rtx);
11183
 static bool reload_cse_simplify (rtx_insn *, rtx);
11184
 static void reload_cse_regs_1 (void);
11185 111 dgisselq
@@ -120,6 +128,8 @@
11186 102 dgisselq
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
11187
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
11188
 
11189
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
11190
+
11191
   if (GET_CODE (body) == SET)
11192
     {
11193
       int count = 0;
11194 111 dgisselq
@@ -147,6 +157,7 @@
11195 102 dgisselq
        apply_change_group ();
11196
       else
11197
        reload_cse_simplify_operands (insn, testreg);
11198
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
11199
     }
11200
   else if (GET_CODE (body) == PARALLEL)
11201
     {
11202 111 dgisselq
@@ -205,6 +216,7 @@
11203 102 dgisselq
        apply_change_group ();
11204
       else
11205
        reload_cse_simplify_operands (insn, testreg);
11206
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
11207
     }
11208
 
11209
 done:
11210 111 dgisselq
@@ -246,6 +258,7 @@
11211 102 dgisselq
          cfg_changed |= reload_cse_simplify (insn, testreg);
11212
 
11213
        cselib_process_insn (insn);
11214
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
11215
       }
11216
 
11217
   /* Clean up.  */
11218 111 dgisselq
@@ -276,6 +289,8 @@
11219 102 dgisselq
 #endif
11220
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
11221
 
11222
+
11223
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
11224
   dreg = true_regnum (SET_DEST (set));
11225
   if (dreg < 0)
11226
     return 0;
11227 111 dgisselq
@@ -427,6 +442,7 @@
11228 102 dgisselq
   /* Array of alternatives, sorted in order of decreasing desirability.  */
11229
   int *alternative_order;
11230
 
11231
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
11232
   extract_constrain_insn (insn);
11233
 
11234
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
11235 111 dgisselq
@@ -519,6 +535,7 @@
11236 102 dgisselq
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
11237
     }
11238
 
11239
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
11240
   alternative_mask preferred = get_preferred_alternatives (insn);
11241
   for (i = 0; i < recog_data.n_operands; i++)
11242
     {
11243 111 dgisselq
@@ -617,6 +634,7 @@
11244 102 dgisselq
            }
11245
        }
11246
     }
11247
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
11248
 
11249
   /* Record all alternatives which are better or equal to the currently
11250
      matching one in the alternative_order array.  */
11251 111 dgisselq
@@ -666,6 +684,7 @@
11252 102 dgisselq
       validate_change (insn, recog_data.operand_loc[i],
11253
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
11254
     }
11255
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
11256
 
11257
   for (i = recog_data.n_dups - 1; i >= 0; i--)
11258
     {
11259 111 dgisselq
@@ -679,6 +698,7 @@
11260 102 dgisselq
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
11261
     }
11262
 
11263
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
11264
   return apply_change_group ();
11265
 }
11266
 
11267 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/recog.c gcc-5.3.0-zip/gcc/recog.c
11268
--- gcc-5.3.0-original/gcc/recog.c      2015-03-20 02:07:30.000000000 -0400
11269 127 dgisselq
+++ gcc-5.3.0-zip/gcc/recog.c   2016-04-14 23:19:07.630839483 -0400
11270 117 dgisselq
@@ -68,6 +68,15 @@
11271
 #include "df.h"
11272
 #include "insn-codes.h"
11273
 
11274
+// #define     DO_ZIP_DEBUGS
11275
+#ifdef DO_ZIP_DEBUGS
11276
+extern void    zip_debug_rtx(const_rtx);
11277
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11278
+#else
11279
+#define        ZIP_DEBUG_LINE(STR,RTX)
11280
+#endif
11281
+
11282
+
11283
 #ifndef STACK_PUSH_CODE
11284
 #ifdef STACK_GROWS_DOWNWARD
11285
 #define STACK_PUSH_CODE PRE_DEC
11286 122 dgisselq
@@ -2283,6 +2292,7 @@
11287
   recog_data.n_dups = 0;
11288
   recog_data.is_asm = false;
11289
 
11290
+ZIP_DEBUG_LINE("Extract-insn", insn);
11291
   switch (GET_CODE (body))
11292
     {
11293
     case USE:
11294
@@ -3671,7 +3681,6 @@
11295 117 dgisselq
            break;
11296
 
11297
          /* The buffer filled to the current maximum, so try to match.  */
11298
-
11299
          pos = peep2_buf_position (peep2_current + peep2_current_count);
11300
          peep2_insn_data[pos].insn = PEEP2_EOB;
11301
          COPY_REG_SET (peep2_insn_data[pos].live_before, live);
11302 122 dgisselq
@@ -3704,6 +3713,7 @@
11303 117 dgisselq
     rebuild_jump_labels (get_insns ());
11304
   if (peep2_do_cleanup_cfg)
11305
     cleanup_cfg (CLEANUP_CFG_CHANGED);
11306
+
11307
 }
11308
 #endif /* HAVE_peephole2 */
11309
 
11310
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
11311
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
11312 127 dgisselq
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-04-20 20:51:38.590252867 -0400
11313 117 dgisselq
@@ -72,6 +72,14 @@
11314
 #include "dumpfile.h"
11315
 #include "rtl-iter.h"
11316
 
11317
+// #define     DO_ZIP_DEBUGS
11318
+#ifdef DO_ZIP_DEBUGS
11319
+extern void    zip_debug_rtx(const_rtx);
11320
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11321
+#else
11322
+#define        ZIP_DEBUG_LINE(STR,RTX)
11323
+#endif
11324
+
11325
 /* This file contains the reload pass of the compiler, which is
11326
    run after register allocation has been done.  It checks that
11327
    each insn is valid (operands required to be in registers really
11328 127 dgisselq
@@ -794,6 +802,20 @@
11329 117 dgisselq
   basic_block bb;
11330
   bool inserted;
11331
 
11332
+#ifdef DO_ZIP_DEBUGS
11333
+  {
11334 127 dgisselq
+       fprintf(stderr, "BEFORE-RELOAD\n");
11335 117 dgisselq
+       int     total_count = 0, current_count = 0;
11336
+       for (insn = first; insn; insn = NEXT_INSN (insn))
11337
+               total_count++;
11338
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
11339
+               fprintf(stderr, "B %3d/%3d", current_count++, total_count);
11340
+               zip_debug_rtx(insn);
11341
+       }
11342 127 dgisselq
+       fprintf(stderr, "BEFORE-RELOAD -- END OF INSTRUCTION LIST\n");
11343 117 dgisselq
+  }
11344
+#endif
11345
+
11346
   /* Make sure even insns with volatile mem refs are recognizable.  */
11347
   init_recog ();
11348
 
11349 127 dgisselq
@@ -1366,6 +1388,20 @@
11350 117 dgisselq
 
11351
   reload_completed = !failure;
11352
 
11353
+#ifdef DO_ZIP_DEBUGS
11354
+  {
11355 127 dgisselq
+       fprintf(stderr, "AFTER-RELOAD\n");
11356 117 dgisselq
+       int     total_count = 0, current_count = 0;
11357
+       for (insn = first; insn; insn = NEXT_INSN (insn))
11358
+               total_count++;
11359
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
11360
+               fprintf(stderr, "A %3d/%3d", current_count++, total_count);
11361
+               zip_debug_rtx(insn);
11362
+       }
11363 127 dgisselq
+       fprintf(stderr, "AFTER-RELOAD -- END OF INSTRUCTION LIST\n");
11364 117 dgisselq
+  }
11365
+#endif
11366
+
11367
   return need_dce;
11368
 }
11369
 
11370 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
11371
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
11372 122 dgisselq
+++ gcc-5.3.0-zip/gcc/reload.c  2016-04-06 17:49:33.418613170 -0400
11373
@@ -136,6 +136,15 @@
11374
 #include "target.h"
11375
 #include "ira.h"
11376
 
11377
+// #define     DO_ZIP_DEBUGS
11378
+#ifdef DO_ZIP_DEBUGS
11379
+extern void zip_debug_rtx(const_rtx);
11380
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
11381
+#else
11382
+#define        ZIP_DEBUG_LINE(STR,RTX)
11383
+#endif
11384
+
11385
+
11386
 /* True if X is a constant that can be forced into the constant pool.
11387
    MODE is the mode of the operand, or VOIDmode if not known.  */
11388
 #define CONST_POOL_OK_P(MODE, X)               \
11389
@@ -2700,6 +2709,8 @@
11390
   hard_regs_live_known = live_known;
11391
   static_reload_reg_p = reload_reg_p;
11392
 
11393
+ZIP_DEBUG_LINE("Find reloads\n", insn);
11394
+
11395
   /* JUMP_INSNs and CALL_INSNs are not allowed to have any output reloads;
11396
      neither are insns that SET cc0.  Insns that use CC0 are not allowed
11397
      to have any input reloads.  */
11398
@@ -2707,8 +2718,17 @@
11399 102 dgisselq
     no_output_reloads = 1;
11400
 
11401
 #ifdef HAVE_cc0
11402
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
11403
+  // cond_exec instruction, we cannot change the input so that the instruction
11404
+  // relies on another register--cc0 is specific.  This requries that the
11405
+  // references be only cc0 and (const_int 0), rather than allowing other
11406
+  // registers here as well.
11407
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
11408
     no_input_reloads = 1;
11409
+  // If the result of an instruction is the cc0 register, that cannot
11410
+  // be changed, therefore no output reloading is allowed.  This only
11411
+  // works if instructions *only* set the cc0 register, and not multiple
11412
+  // registers.
11413
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
11414
     no_output_reloads = 1;
11415
 #endif
11416
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
11417
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
11418
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
11419
@@ -503,6 +503,11 @@
11420
        return 0
11421
     }
11422
 
11423
+    # Zip CPU doesn't support profiling (yet)
11424
+    if { [istarget zip*] }
11425
+        return 0
11426
+    }
11427
+
11428
     # MinGW does not support -p.
11429
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
11430
        return 0
11431
@@ -986,6 +991,12 @@
11432
        }]
11433
     }
11434
 
11435
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
11436
+    # set supports it, the CPU just isn't ready yet.
11437
+    if { [istarget zip*-*-*] } {
11438
+        return 0
11439
+    }
11440
+
11441
     # This proc is actually checking the availabilty of FPU
11442
     # support for doubles, so on the RX we must fail if the
11443
     # 64-bit double multilib has been selected.
11444
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
11445
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
11446
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
11447
@@ -972,7 +972,7 @@
11448
     {
11449
       if (val & 1)
11450
        {
11451
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
11452
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
11453
          result += powi_lookup_cost (digit, cache)
11454
                    + POWI_WINDOW_SIZE + 1;
11455
          val >>= POWI_WINDOW_SIZE;
11456
@@ -1012,7 +1012,7 @@
11457
     }
11458
   else if (n & 1)
11459
     {
11460
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
11461
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
11462
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
11463
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
11464
     }
11465
@@ -1651,7 +1651,7 @@
11466
 };
11467
 
11468
 #define BITS_PER_MARKER 8
11469
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
11470
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
11471
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
11472
 #define HEAD_MARKER(n, size) \
11473
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
11474
@@ -1687,7 +1687,7 @@
11475
   /* Zero out the extra bits of N in order to avoid them being shifted
11476
      into the significant bits.  */
11477
   if (size < 64 / BITS_PER_MARKER)
11478
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11479
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11480
 
11481
   switch (code)
11482
     {
11483
@@ -1714,7 +1714,7 @@
11484
     }
11485
   /* Zero unused bits for size.  */
11486
   if (size < 64 / BITS_PER_MARKER)
11487
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11488
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11489
   return true;
11490
 }
11491
 
11492
@@ -1761,7 +1761,7 @@
11493
   n->n = CMPNOP;
11494
 
11495
   if (size < 64 / BITS_PER_MARKER)
11496
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11497
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11498
 
11499
   return true;
11500
 }
11501
@@ -2020,7 +2020,7 @@
11502
          {
11503
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
11504
            uint64_t val = int_cst_value (rhs2), mask = 0;
11505
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
11506
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
11507
 
11508
            /* Only constants masking full bytes are allowed.  */
11509
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
11510
@@ -2064,7 +2064,7 @@
11511
              {
11512
                /* If STMT casts to a smaller type mask out the bits not
11513
                   belonging to the target type.  */
11514
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
11515
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
11516
              }
11517
            n->type = type;
11518
            if (!n->base_addr)
11519
@@ -2177,7 +2177,7 @@
11520
     {
11521
       uint64_t mask;
11522
 
11523
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
11524
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
11525
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
11526
       cmpnop &= mask;
11527
     }
11528
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
11529
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
11530 117 dgisselq
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-31 18:55:03.584197958 -0400
11531 102 dgisselq
@@ -143,6 +143,13 @@
11532
 #include "rtl-iter.h"
11533
 #include "fibonacci_heap.h"
11534
 
11535 117 dgisselq
+#ifdef DO_ZIP_DEBUGS
11536 102 dgisselq
+#include <stdio.h>
11537
+extern void zip_debug_rtx(const_rtx);
11538
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11539
+#else
11540
+#define ZIP_DEBUG_LINE(STR,RTX)
11541
+#endif
11542
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
11543
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
11544
 
11545
@@ -6356,6 +6363,7 @@
11546
                machine_mode indmode
11547
                  = TYPE_MODE (TREE_TYPE (argtype));
11548
                rtx mem = gen_rtx_MEM (indmode, x);
11549
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
11550
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
11551
                if (val && cselib_preserved_value_p (val))
11552
                  {
11553
@@ -6462,12 +6470,14 @@
11554
       machine_mode mode
11555
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
11556
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
11557
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
11558
       HOST_WIDE_INT token
11559
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
11560
       if (token)
11561
        clobbered = plus_constant (mode, clobbered,
11562
                                   token * GET_MODE_SIZE (mode));
11563
       clobbered = gen_rtx_MEM (mode, clobbered);
11564
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
11565
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
11566
       call_arguments
11567
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
11568
@@ -9790,6 +9800,7 @@
11569
              machine_mode indmode
11570
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
11571
              rtx mem = gen_rtx_MEM (indmode, incoming);
11572
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
11573
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
11574
                                                         VOIDmode,
11575
                                                         get_insns ());
11576
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
11577
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
11578
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
11579
@@ -195,6 +195,9 @@
11580
 tic6x-*-*)
11581
        cpu_type=c6x
11582
        ;;
11583
+zip*)
11584
+       cpu_type=zip
11585
+       ;;
11586
 esac
11587
 
11588
 # Common parts for widely ported systems.
11589
@@ -1300,6 +1303,9 @@
11590
        echo "*** Configuration ${host} not supported" 1>&2
11591
        exit 1
11592
        ;;
11593
+zip*)
11594
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
11595
+       ;;
11596
 esac
11597
 
11598
 case ${host} in
11599
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
11600
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
11601
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
11602
@@ -150,6 +150,9 @@
11603
        # Need to link with -lpthread so libgomp.so is self-contained.
11604
        XLDFLAGS="${XLDFLAGS} -lpthread"
11605
        ;;
11606
+  zip*)
11607
+        config_path="bsd posix"
11608
+        ;;
11609
 
11610
   *)
11611
        ;;

powered by: WebSVN 2.1.0

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