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

Subversion Repositories zipcpu

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

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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-05-12 21:52:06.137764804 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-05-12 21:52:06.141764778 -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 146 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-05-12 21:52:06.141764778 -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 146 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-05-12 15:20:14.000702915 -0400
2990
@@ -0,0 +1,4077 @@
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 146 dgisselq
+/* 17.20.4 Output of Data */
5971
+
5972
+#undef TARGET_ASM_ALIGNED_HI_OP
5973
+#undef TARGET_ASM_ALIGNED_SI_OP
5974
+#define        TARGET_ASM_UNALIGNED_HI_OP      "\t.byte\t"
5975
+#define        TARGET_ASM_UNALIGNED_SI_OP      "\t.byte\t"
5976
+/* These hooks (above) specify assembly directives for creating certain kinds
5977
+ * of integer objects.  The TARGET_ASM_BYTE_OP directive creates a byte-sized
5978
+ * object.  The TARGET_ASMALIGNED_HI_OP one creates an aligned two-byte object
5979
+ * and so on.  Any of the hookd may be NULL, indicating that no suitable
5980
+ * directive is available.
5981
+ *
5982
+ * The compiler will print these strings at the start of a new line, followed
5983
+ * immediately by the object's initial value.  In most cases, the string should
5984
+ * contain a tab, a pseudo op, and then another tab.
5985
+ */
5986
+
5987 102 dgisselq
+/* 17.20.4 Output and Generation of Labels */
5988
+
5989
+/* ASM_OUTPUT_LABEL
5990
+ * ... A default definition of this macro is provided which is correct for
5991
+ * most systems.
5992
+ */
5993
+
5994
+/* ASM_OUTPUT_FUNCTION_LABEL
5995
+ * ... if not defined, then the function name is defined in the usual manner
5996
+ * as a label.
5997
+ */
5998
+
5999
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
6000
+ * is known to refer to a compiler-generated label.  The default definition
6001
+ * uses assemble_name_raw, which is like assemble_name except that it is more
6002
+ * efficient.
6003
+ */
6004
+
6005
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
6006
+ * to specify the size of a symbol, without any arguments.  ON systems that
6007
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
6008
+ * define this macro.
6009
+ *
6010
+ * Define this amcro only if it is correct to use the default definitions of
6011
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
6012
+ * If you need your own custom definitions of those macros, or if you do not
6013
+ * need explicit symbol sizes at all, do not define this macro.
6014
+ */
6015
+
6016
+/* ASM_OUTPUT_SIZE_DIRECTIVE
6017
+ * ASM_OUTPUT_MEASURED_SIZE
6018
+ */
6019
+
6020
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
6021
+ * the character '$' in label names.  By default constructors and destructors
6022
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
6023
+ * used instead.
6024
+ */
6025
+
6026
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
6027
+ * character '.' in label names.  By default constructors and destructors in
6028
+ * G++ have names that use '.'.  If this macro is defined, these names are
6029
+ * rewritten to avoid '.'.
6030
+ */
6031
+
6032
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
6033
+ * specify the type of a symbol, without any arguments.  On systems that use
6034
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
6035
+ *
6036
+ * Define this macro only if it is correct to use the default definition of
6037
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
6038
+ * definition of this macr, or if you do not need explicit symbol types at all,
6039
+ * do not define this macro.
6040
+ */
6041
+
6042
+/* TYPE OPERAND_FMD ... A
6043
+ */
6044
+
6045
+/* ASM_OUTPUT_TYPE_DIRECTIVE
6046
+ */
6047
+
6048
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
6049
+ * if this macro is not defined, then the function name is defined in the usual
6050
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
6051
+ */
6052
+
6053
+/* ASM_DECLARE_FUNCTION_SIZE
6054
+ * ASM_DECLARE_COLD_FUNCTION_NAME
6055
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
6056
+ * ASM_DECLARE_OBJECT_NAME
6057
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
6058
+ */
6059
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
6060
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
6061
+ * claiming a register REGNO for a global variable DECL with name NAME.
6062
+ *
6063
+ * If you don't defin this macro, that is equivalent to dfining it to do
6064
+ * nothing.
6065
+ */
6066
+
6067
+/* ASM_FINISH_DECLARE_OBJECT
6068
+ * TARGET_ASM_GLOBALIZE_LABEL
6069
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
6070
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
6071
+ * ASM_WEAKEN_LABEL
6072
+ * ASM_WEAKEN_DECL
6073
+ * ASM_OUTPUT_WEAKREF
6074
+ * SUPPORTS_WEAK
6075
+ * TARGET_SUPPORTS_WEAK
6076
+ * MAKE_DECL_ONE_ONLY
6077
+ * SUPPORTS_ONE_ONLY
6078
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
6079
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
6080
+ * ASM_OUTPUT_EXTERNAL
6081
+ * TARGET_ASM_EXTERNAL_LIBCALL
6082
+ * TARGET_ASM_MARK_DECLPRESERVED
6083
+ * ASM_OUTPUT_LABELREF
6084
+ * TARGET_MANGLE_ASSEMBLER_NAME
6085
+ * ASM_OUTPUT_SYMBOL_REF
6086
+ * ASM_OUTPUT_LABEL_REF
6087
+ * TARGET_ASM_INTERNAL_LABEL
6088
+ * ASM_OUTPUT_DEBUG_LABEL
6089
+ * ASM_GENERATE_INTERNAL_LABEL
6090
+ * ASM_FORMAT_PRIVATE_NAME
6091
+ */
6092
+
6093
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
6094
+ * assembler code which defines (equates) the symbol NAME to have the value
6095
+ * VALUE.
6096
+ *
6097
+ * ZipCPU---So many other things that we need depend upon this, that we need
6098
+ * to implement a non-default version.
6099
+ */
6100
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
6101
+
6102
+/* ASM_OUTPUT_DEF_FROM_DECLS
6103
+ * TARGET_DEFERRED_OUTPUT_DEFS
6104
+ * ASM_OUTPUT_WEAK_ALIAS
6105
+ * OBJ_GEN_METHOD_LABEL
6106
+ */
6107
+
6108
+
6109
+/* 17.20.7 Output of Assembler Instructions */
6110
+
6111
+#define        REGISTER_NAMES { "R0","R1","R2","R3","R4","R5","R6","R7","R8","R9", \
6112
+       "R10","R11","R12","SP","CC","PC" }
6113
+
6114
+/* REGISTER_PREFIX     (Undefined by default)
6115
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
6116
+ * USER_LABEL_PREFIX   defaults to "*"
6117
+ * IMMEDIATE_PREFIX    (Undefined by default)
6118
+ *
6119
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
6120
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
6121
+ * 'md' file must support multiple assembler formats.  In that case, the various
6122
+ * 'tm.h' files can define these macros differently.
6123
+ */
6124
+// #define     USER_LABEL_PREFIX       "*"
6125
+
6126
+/* Defining memory operand address formats is in this section. */
6127
+
6128
+/* 17.20.10 Assembler Commands for Alignment */
6129
+
6130
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
6131
+ * which is a common destination of jumps and has no fallthru incoming
6132
+ * edge.  This macro need not be defined if you don't want any special alignment
6133
+ * to be done at such a time.  Most machine descriptions do not currently define
6134
+ * this macro.
6135
+ *
6136
+ * ZipCPU---The assembler should automatically deal with label alignment, so
6137
+ * let's not do anything about it here.
6138
+ */
6139
+
6140
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
6141
+ */
6142
+
6143
+/* LABEL_ALIGN_AFTER_BARRIER
6144
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
6145
+ */
6146
+
6147
+/* LOOP_ALIGN(label)
6148
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
6149
+ * LABEL_ALIGN
6150
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
6151
+ */
6152
+
6153
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
6154
+ * stream an assembler instruction to advance the location counter by nbytes
6155
+ * bytes.
6156
+ */
6157
+
6158
+/* TARGET_ASM_LABEL_ALIGN */
6159
+/* Assembler Commands for Alignment */
6160
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
6161 127 dgisselq
+       { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
6162 102 dgisselq
+
6163
+
6164
+
6165
+/* 17.21 Controlling Debugging Information Format */
6166
+/* 17.22 Cross Compilation and Floating Point */
6167 111 dgisselq
+
6168
+// REAL_VALUE_TYPE
6169
+// REAL_VALUES_EQUAL
6170
+// REAL_VALUES_LESS ... Tess whether x is less than y
6171
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
6172
+ * If x is negative, returns zero.
6173
+ */
6174
+// REAL_VALUE_ATOF
6175
+// REAL_VALUE_NEGATIVE
6176
+// REAL_VALUE_ISINF
6177
+// REAL_VALUE_ISNAN
6178
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
6179
+ * on two floating point values X and Y, storing the result in OUT (which must
6180
+ * be a variable).
6181
+ *
6182
+ * The operation to be performed is specified by CODE.  Only the following
6183
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
6184
+ * MIN_EXPR.
6185
+ *
6186
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
6187
+ * floating point format cannot represent infinity, it will call abort().
6188
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
6189
+ */
6190
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
6191
+ * value X.
6192
+ */
6193
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
6194
+ */
6195 102 dgisselq
+/* 17.23 Mode switching instructions */
6196
+/* 17.24 Defining target-specific uses of __attribute__ */
6197
+#undef TARGET_OPTION_OVERRIDE
6198
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
6199
+
6200
+/* 17.25 Emulating TLS */
6201
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
6202
+
6203
+ // ZipCPU isn't MIPS.
6204
+
6205
+/* 17.27 Parameters for Precompiled Header Validity Checking */
6206
+/* 17.28 C++ ABI parameters */
6207
+/* 17.29 Adding support for named address spaces */
6208
+/* 17.30 Miscellaneous Parameters */
6209
+
6210
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
6211
+ * not your architecture has conditional branches that can span all of memory.
6212
+ * It is used in conjunction with an optimization that partitions hot and
6213
+ * cold basic blocks into separate sections of the executable.  If this macro
6214
+ * is set to false, gcc will convert any conditional branches that attempt to
6215
+ * cross between sections into unconditional branches or indirect jumps.
6216
+ *
6217
+ * ZipCPU --- The assembler renders long unconditional branch code without
6218
+ * problems, so we can pretend that such long branches exist.
6219
+ */
6220
+#define        HAS_LONG_COND_BRANCH true
6221
+
6222
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
6223
+ * or not your architecture has unconditional branches that can span all of
6224
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
6225
+ * conjunction with an optimization that partitions hot and cold basic blocks
6226
+ * into separate sections of the executable.  If this macro is set to false,
6227
+ * gcc will convert any unconditional branches that attempt to cross between
6228
+ * sections into indirect jumps.
6229
+ *
6230
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
6231
+ * jump.
6232
+ */
6233
+#define        HAS_LONG_UNCOND_BRANCH  true
6234
+
6235
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
6236
+ * mode that eleemnts of a jump-table should have.
6237
+ *
6238
+ */
6239
+#define        CASE_VECTOR_MODE        SImode
6240
+
6241
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
6242
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
6243
+ * If you define this, it enables extra code in branch shortening to deal with
6244
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
6245
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
6246
+ *
6247
+ * ZipCPU---No advantage here.
6248
+ */
6249
+
6250
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
6251
+ * jump-tables should contain relative addresses.  You need not define this
6252
+ * macro if jump-tables never contain relative addresses, or jump-tables
6253
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
6254
+ *
6255
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
6256
+ * code.
6257
+ */
6258
+
6259
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
6260
+ * number of different values for which it is best to use a jump-table instead
6261
+ * of a tree of conditional branches.  The default is four for machines with a
6262
+ * casesi instruction and five otherwise.  This is best for most machines.
6263
+ *
6264
+ * ZipCPU---Leave at the default.
6265
+ */
6266
+
6267
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
6268
+ * registers with integral mode smaller than a word are always performed on the
6269
+ * entire register.  Most RISC machines have this property and most CISC
6270
+ * machines do not.
6271
+ *
6272
+ * ZipCPU---We have the property, 'cause we're fairly risk.
6273
+ */
6274
+#undef WORD_REGISTER_OPERATIONS
6275
+#define        WORD_REGISTER_OPERATIONS        1
6276
+
6277
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
6278
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
6279
+ * word, set the bits outside of MEMMODE to be either the sign extension or
6280
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
6281
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
6282
+ * UNKNOWN for other modes.
6283
+ *
6284
+ * Do not define this macro if it would always return UNKNOWN.
6285
+ *
6286
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
6287
+ */
6288
+#undef LOAD_EXTEND_OP
6289
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
6290
+
6291
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
6292
+ *
6293
+ * ZipCPU---All immediates are sign extended, so yes.
6294
+ */
6295
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
6296
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
6297
+
6298
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
6299
+ */
6300
+
6301
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
6302
+ * quickly between memory and registers or between two memory locations.
6303
+ *
6304
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
6305
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
6306
+ * Therefore, this is defined to be one.
6307
+ */
6308
+#define        MOVE_MAX        1
6309
+
6310
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
6311
+ * move quickly between memory and registers or between two memory ...
6312
+ *
6313
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
6314
+ * definition of this.
6315
+ */
6316
+
6317
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
6318
+ * the number of bits actually used for the count of a shift operation is equal
6319
+ * to the number of bits needed to represent the size of the object being
6320
+ * shifted.
6321
+ *
6322
+ * You need not define this macro if it would have the value of zero.
6323
+ *
6324
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
6325
+ * value in the register, therefore this value should be zero, the default.
6326
+ */
6327
+
6328
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
6329
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
6330
+ * more than the width of the mode.
6331
+ *
6332
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
6333
+ * This is the case for the ZipCPU as well.
6334
+ */
6335
+
6336
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
6337
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
6338
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
6339
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
6340
+ *
6341
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
6342
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
6343
+ */
6344
+#undef TRULY_NOOP_TRUNCATION
6345
+#define TRULY_NOOP_TRUNCATION(O,I)     1
6346
+
6347
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
6348
+ * mode can be such that the values are always extended to a wider integral
6349
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
6350
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
6351
+ * use zero-extended.
6352
+ *
6353
+ */
6354
+// #undef      TARGET_MODE_REP_EXTENDED
6355
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
6356
+
6357
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
6358
+ * comparison operator with an integral mode and stored by a store-flag
6359
+ * instruction (cstoremode4) when the condition is true.  This description
6360
+ * must apply to all the cstoremode4 patterns and all the comparison operators
6361
+ * whose results have MODE_INT mode.
6362
+ *
6363
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
6364
+ */
6365
+
6366
+/* FLOAT_STORE_FLAG_VALUE
6367
+ *
6368
+ * ZipCPU
6369
+ */
6370
+
6371
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
6372
+ * comparison operations that return a vector result ...
6373
+ *
6374
+ * ZipCPU---Doesn't support vector operations.
6375
+ */
6376
+
6377
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6378
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6379
+ *
6380
+ * A C expression that indicates whetther the architecture defines a value for
6381
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
6382
+ * 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
6383
+ * entry, then the macro should evaluate to 2.  In cases where the value is
6384
+ * defined, value should be set to this value.
6385
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
6386
+ * be undefined.
6387
+ *
6388
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
6389
+ */
6390
+
6391
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
6392
+ * define this to be the integer mode corresponding to the width of a
6393
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
6394
+ * On some machines you must define this to be one of the partial
6395
+ * integer modes, such as PSImode.
6396
+ */
6397
+#undef Pmode
6398
+#define        Pmode   SImode
6399
+
6400
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
6401
+ * function being called, in call RTL expressions.  On most CISC machines, where
6402
+ * an instruction can begin at any byte address, this should be QImode.  On most
6403
+ * RISC machines, where all instructions have fixed size and alignment, this
6404
+ * should be a mode with the same size and alignment as the machine instruction
6405
+ * words--typically SImode or HImode.
6406
+ *
6407
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
6408
+ * addresses on the ZipCPU.
6409
+ */
6410
+#undef FUNCTION_MODE
6411
+#define        FUNCTION_MODE   SImode
6412
+
6413
+/* STDC_0_IN_SYSTEM_HEADERS
6414
+ */
6415
+
6416
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
6417
+ * file to be included at the start of all compilations, as if it had been
6418
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
6419
+ * or if the header is not found, or if the user specifies -ffreestanding or
6420
+ * -nostdinc, no header is included.
6421
+ *
6422
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
6423
+ * as NULL.
6424
+ */
6425
+#undef TARGET_C_PREINCLUDE
6426
+#define        TARGET_C_PREINCLUDE     NULL
6427
+
6428
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
6429
+ * specific C++ implicit extern C functions.  If this function returns true
6430
+ * for the name of a file-scope function, that function implicitly gets extern
6431
+ * "C" linkage rather than whatever linkage the declaration would normally have.
6432
+ * An example of such function is WinMain on Win32 targets.
6433
+ *
6434
+ * ZipCPU---Not ready to deal with this yet.
6435
+ */
6436
+
6437
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
6438
+ * support C++ as well as C.  This macro inhibits the usual method of using
6439
+ * system header files in C++, which is to pretend that the file's contents
6440
+ * are enclosed in 'extern "C" {...}'.
6441
+ *
6442
+ *
6443
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
6444
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
6445
+ */
6446
+
6447
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
6448
+ * target specific pragmas.
6449
+ *
6450
+ * ZipCPU --- let's not.
6451
+ */
6452
+
6453
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
6454
+ * expanded in the arguments of #pragma pack().
6455
+ *
6456
+ * ZipCPU ... why?
6457
+ */
6458
+
6459
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
6460
+ * default other than 0 (meaning the machine default), define this macro to
6461
+ * the necessary value (in bytes).  This must be a value that would also be
6462
+ * valid to use with #pragma pack() (that is a small power of two.
6463
+ */
6464
+
6465
+/* DOLLARS_IN_IDENTIFIERS
6466
+ * ZipCPU --- Default (not changing C)
6467
+ */
6468
+
6469
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
6470
+ * is nonzero if it is safe for the delay slot schedule to place instructions
6471
+ * in the delay slot of INSN, even if they appear to use a resource set or
6472
+ * clobbered in INSN.  INSN is always a ...
6473
+ *
6474
+ * ZipCPU --- You need not define this macro if it would always return zero.
6475
+ */
6476
+
6477
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
6478
+ * that is nonzero if it is safe for the delay slot schedule to place
6479
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
6480
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
6481
+ * machines where some insn or jump_insn is really a function call and ...
6482
+ *
6483
+ * ZipCPU --- You need not define this macro if it would always return zero.
6484
+ */
6485
+
6486
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
6487
+ * nonzero if, in some cases, global symbols from one translation unit may not
6488
+ * be bound to undefined symbols in another translation unit without user
6489
+ * intervention.  For instance, under Microsoft Windows symbols must be
6490
+ * explicitly imported from shared libraries (DLLs).
6491
+ *
6492
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
6493
+ * so we won't.
6494
+ */
6495
+
6496
+/* TARGET_MD_ASM_ADJUST
6497
+ */
6498
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6499
+ * define this macro if the default of "m" is wrong.
6500
+ *
6501
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6502
+ * works doesn't sound like a problem.  Let's not define this.
6503
+ */
6504
+
6505
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6506
+ * variable that specifies where the linker should look for libraries.
6507
+ *
6508
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6509
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6510
+ * libraries.
6511
+ */
6512
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6513
+
6514
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6515
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6516
+ *
6517
+ * ZipCPU does not.
6518
+ */
6519
+
6520
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6521
+ * instructions to execute via conditional execution instructions instead of a
6522
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6523
+ * cc0 and 1 if it does use cc0.
6524
+ *
6525
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6526
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6527
+ * something else, so let's keep looking into this.
6528
+ */
6529
+
6530
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6531 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6532 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6533
+ * structure, struct ce_if_block, which contains information about the currently
6534
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6535
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6536
+ * or FALSE to a null pointer if the tests cannot be converted.
6537
+ *
6538
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6539
+ * execution and conditional testing capabilities.
6540
+ */
6541 122 dgisselq
+#define        IFCVT_MODIFY_TESTS(CI,TR,FL)    zip_ifcvt_modify_tests(CI,&TR,&FL)
6542 102 dgisselq
+
6543
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6544
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6545
+ * into conditions combined by and and or operations.  BB contains the basic
6546
+ * block that contains the test that is currently being processed and about to
6547
+ * be turned into a condition.
6548
+ *
6549
+ *
6550
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6551
+ * execution and conditional testing capabilities.
6552
+ */
6553
+// #warning "Need to come back to this."
6554 122 dgisselq
+#define        IFCVT_MODIFY_MULTIPLE_TESTS(CI,BB,TR,FL) TR=NULL_RTX
6555 102 dgisselq
+
6556
+
6557
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6558
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6559
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6560
+ * information about the currently processed blocks.
6561
+ *
6562
+ *
6563
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6564
+ * execution and conditional testing capabilities.
6565
+ */
6566 142 dgisselq
+#define        IFCVT_MODIFY_INSN(CE,PATRN,INSN) zip_ifcvt_modify_insn(CE,PATRN,INSN)
6567 102 dgisselq
+
6568
+
6569
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6570
+ * machine dependent modifications in converting code to conditional
6571
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6572
+ * structure pointed to be CEINFO.
6573
+ *
6574
+ *
6575
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6576
+ * execution and conditional testing capabilities.
6577
+ */
6578
+// #warning "Need to come back to this."
6579 122 dgisselq
+#define        IFCVT_MODIFY_FINAL(CEINFO)      zip_ifcvt_modify_final(CEINFO)
6580 102 dgisselq
+
6581
+
6582
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6583
+ * dependent modifications in converting code to conditional execution.  The
6584
+ * involved basic blocks can be found in the struct ce_if_block structure that
6585
+ * is pointed to by CEINFO.
6586
+ *
6587
+ *
6588
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6589
+ * execution and conditional testing capabilities.
6590
+ */
6591
+// #warning "Need to come back to this."
6592 122 dgisselq
+#define        IFCVT_MODIFY_CANCEL(CEINFO)     zip_ifcvt_modify_cancel(CEINFO)
6593 102 dgisselq
+
6594
+
6595
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6596
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6597
+ * that is pointed by CEINFO.
6598
+ *
6599
+ *
6600
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6601
+ * execution and conditional testing capabilities.
6602
+ */
6603
+// #warning "Need to come back to this."
6604 122 dgisselq
+#define        IFCVT_MACHDEP_INIT(CEINFO)      zip_ifcvt_machdep_init(CEINFO)
6605 102 dgisselq
+
6606
+
6607
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6608
+ * target specific pass over the instruction stream.  The compiler will run it
6609
+ * at all optimization levels, just before the point at which it normally does
6610
+ * delayed branch scheduling.
6611
+ *
6612
+ * You need not implement the hook if it has nothing to do.
6613
+ *
6614
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6615
+ * just get us started.
6616
+ */
6617
+
6618
+
6619
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6620
+ * specific builtin functions that need to be defined.  It should be a function
6621
+ * that performs the necessary setup.  Machine specific builtin functions can be
6622
+ * useful to expand special machine instructions that would otherwise not
6623
+ * normally be generated because they have no equivalent in the source language.
6624
+ *
6625
+ * To create a built in function, call the function lang_hooks.builtin_function
6626
+ * which is defined by the language front end.  You can use any type nodes
6627
+ * set up by build_common_tree_nodes; only language front ends that use those
6628
+ * two functions will call "TARGET_INIT_BUILTINS".
6629
+ *
6630
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6631
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6632
+ * restore_context(cstackregno).
6633
+ *
6634
+ */
6635
+#undef TARGET_INIT_BUILTINS
6636
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6637
+
6638
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6639
+ * machine specific builtin functions that need to be defined.  It should be a
6640
+ * function that returns the builtin function declaration for the builtin
6641
+ * function code code.  If there is no such builtin and it cannot be initialized
6642
+ * at this time if INITP is true the function should return NULL_TREE.  If
6643
+ * CODE is out of range the fucntion should return error-mark_node.
6644
+ *
6645
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6646
+ */
6647
+#undef TARGET_BUILTIN_DECL
6648
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6649
+
6650
+
6651
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6652
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6653
+ * TREE is the expression for the function call; the result should go to
6654
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6655
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6656
+ * non-zero if the value is to be ignored.  This function should return the
6657
+ * result of the call to the built-in function.
6658
+ *
6659
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6660
+ */
6661
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6662
+
6663
+
6664
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6665
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6666
+ *
6667
+ * ZipCPU --- not interested.
6668
+ */
6669
+/* TARGET_CHKP_BOUND_TYPE
6670
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6671
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6672
+ *
6673
+ * ZipCPU --- Same as last one.
6674
+ */
6675
+
6676
+
6677
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6678
+ * for a machine specific built-in function that was set up by
6679
+ * TARGET_INIT_BUILTINS.
6680
+ *
6681
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6682
+ * to then overload it?
6683
+ */
6684
+
6685
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6686
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6687
+ * is the declaration of the built-in function.  NARGS is the number of
6688
+ * arguments passed to the function; the arguments themselves are pointed to by
6689
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6690
+ * containing as simplified expression for the call's result.  If IGNORE is
6691
+ * true the value will be ignored.
6692
+ *
6693
+ * ZipCPU --- You know, this and the previous couple sound like something
6694
+ * whereby I might be able replace bit-reversal code with my bit reverse
6695
+ * instruction.  That would be very useful, but not necessary to get me
6696
+ * started.
6697
+ */
6698
+
6699
+/* TARGET_GIMPLE_FOLD_BUILTIN
6700
+ * TARGET_COMPARE_VERSION_PRIORITY
6701
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6702
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6703
+ * TARGET_CAN_USE_DOLOOP_P
6704
+ * TARGET_INVALID_WITHIN_DOOLOOP
6705
+ * TARGET_LEGITIMATE_COMBINED_INSN
6706
+ * TARGET_CAN_FOLLOW_JUMP
6707
+ * TARGET_COMMUTATIVE_P
6708
+ */
6709
+
6710
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6711
+ * register has been copied in a pseudo register, it is often not necessary
6712
+ * ...
6713
+ */
6714
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6715
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6716
+ * can use this hook to enhance precision of analysis for unspec and
6717
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6718
+ * elements of RTX in which case flags should be passed along.
6719
+ */
6720
+
6721
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6722
+ * it changes its current function context (CFUN).  You can define this
6723
+ * function if the back end needs to perform any initialization or reset
6724
+ * actions on a per-function basis.  For example, it may be used to implement
6725
+ * function attributes that affect register usage or code generation patterns.
6726
+ */
6727
+
6728
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6729
+ * suffix for object files on your target machine.  If you do not define this
6730
+ * macro, GCC will use ".o" as the suffix for object files.
6731
+ */
6732
+#define        TARGET_OBJECT_SUFFIX    ".o"
6733
+
6734
+/* TARGET_EXECUTABLE_SUFFIX
6735
+ */
6736
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6737
+
6738
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6739
+ * files specified on its command line and create an export list for the linker.
6740
+ * Define this macro for systems like AIX, where the linker discards object
6741
+ * files that are not referenced from main and uses export lists.
6742
+ *
6743
+ * ZipCPU --- shoudln't need this.
6744
+ */
6745
+
6746
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6747
+ * representing a variant of the method call mdecl, if Java Native Interface
6748
+ * (JNI) methods must be invoked differently from other methods on your
6749
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6750
+ * using the stdcall calling convention and this macro is then ...
6751
+ *
6752
+ * ZipCPU----Don't need this.  (yet)
6753
+ */
6754
+
6755
+
6756
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6757
+ * point in which a new jump instructions could be created.  On machines that
6758
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6759
+ * would typically be reload, so thiss target hook should be defined to a
6760
+ * function such as:
6761
+ *
6762 117 dgisselq
+ * ZipCPU --- I don't get what this is for.
6763
+ *     Actually, in hind sight, ZipCPU needs this.  Without this, the
6764
+ * compiler will try to reorder basic blocks, shuffling logic around and so
6765
+ * fortch, preventing our comparison optimizations from being used.  By setting
6766
+ * this function appropriately, we can prevent it from reversing conditions into
6767
+ * conditions we don't support.
6768 102 dgisselq
+ */
6769 117 dgisselq
+#define        TARGET_CANNOT_MODIFY_JUMPS_P    zip_cannot_modify_jumps_p
6770 102 dgisselq
+
6771
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6772
+ * class for which branch target register optimizations should be applied.  All
6773
+ * registers in this class should be usable interchangably.  After reload,
6774
+ * registers in this class will be re-allocated and loads will be hoisted out of
6775
+ * loops and be subjected to inter-block scheduling.
6776
+ *
6777
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6778
+ */
6779
+
6780
+
6781
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6782
+ * optimization will by default exclude callee-saved registers that are not
6783
+ * already live during the current function.  If this target hook returns true,
6784
+ * they will be included.  The target code must then make sure that all target
6785
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6786
+ * be saved are saaved.
6787
+ *
6788
+ * ZipCPU---
6789
+ */
6790
+
6791
+
6792
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6793
+ * if the target supports conditional execution.  This target hook is required
6794
+ * only when the target has several different modes and they have different
6795
+ * conditional execution capability, such as ARM.
6796
+ *
6797
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6798
+ * long version load immediate ...)
6799
+ */
6800
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6801
+
6802
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6803
+ * emit a comparison instruction for the first compare in a sequence of
6804
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6805
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6806
+ * compare are saved in prep_seq and the compare instructions are saved in
6807
+ * gen_seq.  They will be emitted when all the compares in the conditional
6808
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6809
+ * for op0 and op1.
6810
+ *
6811
+ *
6812
+ * ZipCPU---???
6813
+ */
6814
+
6815
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6816
+ * prepares to emit a conditional comparison within a sequence of conditional
6817
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6818
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6819
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6820
+ * emitted when all the compares in the conditional comparison are generated
6821
+ * without error.  The pPREV expression is the result of a prior call to either
6822
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6823
+ * PREV and this comparison is not supported, otherwise the result must be the
6824
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6825
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6826
+ * on the compares.
6827
+ *
6828
+ *
6829
+ * ZipCPU --- ???
6830
+ */
6831
+
6832
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6833
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6834
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6835
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6836
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6837
+ *
6838
+ *
6839
+ * ZipCPU -- ???
6840
+ */
6841
+
6842
+
6843
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6844
+ * C expression that specifies the maximum number of floating point
6845
+ * multiplications that should be emitted when expanding exponentiation by an
6846
+ * integer constant inline.  When this value is defined, exponentiation
6847
+ * requiring more than this number of multiplications is implemented by calling
6848
+ * the system library's pow, powf, or powl routines.  The default value
6849
+ places no upper bound on the multiplication count.
6850
+ *
6851
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6852
+ * ready for this macro.
6853
+ */
6854
+
6855
+
6856
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6857
+ * register any extra include files for the target.  The parameter stdinc
6858
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6859
+ * system root directory.  The parameter PFX is the prefix for the GCC
6860
+ * directoiry.
6861
+ *
6862
+ *
6863
+ * ZipCPU---None yet.
6864
+ */
6865
+
6866
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6867
+ * register any extrra include files for the target before any standard headers.
6868
+ * The parameter stdinc indicates if normal include files are present.
6869
+ *
6870
+ * ZipCPU --- None.
6871
+ */
6872
+
6873
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6874
+ * for the target.  The parameter path is the integer to register.  On Darwin
6875
+ * systems, this is used for Framework includes, which have semantics that are
6876
+ * different from -I.
6877
+ *
6878
+ *
6879
+ * ZipCPU --- None.
6880
+ */
6881
+
6882
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6883
+ * safe to use a local alias for a virtual function FN when constructing
6884
+ * thunks, false otherwise.  By default, the macro returns true for all
6885
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6886
+ * false otherwise.
6887
+ *
6888
+ *
6889
+ * ZipCPU --- ???
6890
+ */
6891
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6892
+
6893
+
6894
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6895
+ * variable containing target-specific format checking information for the
6896
+ * -Wformat option.  The default is to have no target-specific format checks.
6897
+ *
6898
+ * ZipCPU --- Default
6899
+ */
6900
+
6901
+/* TARGET_N_FORMAT_TYPES
6902
+ *
6903
+ * ZipCPU --- Default
6904
+ */
6905
+
6906
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6907
+ * a global variable containing target-specific format overrides for the
6908
+ * -Wformat option.  The default is to have no target specific format overrides.
6909
+ *
6910
+ * ZipCPU --- Default
6911
+ */
6912
+
6913
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6914
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6915
+ *
6916
+ * If defined, the (first) macro is the name of a global variable containing
6917
+ * target-specific format overrides for the -Wformat option.
6918
+ */
6919
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6920
+ * optional initialization routine for target specific customizations of the
6921
+* system printf and scanf formatter settings.
6922
+ */
6923
+
6924
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6925
+ * macro returns the diagnostic message when it is illegal to pass an argument
6926
+ * VAL to function FN with prototype TLIST.
6927
+ *
6928
+ * ZipCPU---Default.
6929
+ */
6930
+
6931
+/* TARGET_INVALID_CONVERSION
6932
+ * TARGET_INVALID_UNARY_OP
6933
+ * TARGET_INVALID_BINARY_OP
6934
+ * TARGET_INVALID_PARAMETER_TYPE
6935
+ * TARGET_INVALID_RETURN_TYPE
6936
+ * TARGET_PROMOTED_TYPE
6937
+ * TARGET_CONVERT_TO_TYPE
6938
+ * TARGET_USE_JCR_SECTION_TYPE
6939
+ * OBJC_JBLEN
6940
+ * LIBGCC2_UNWIND_ATTRIBUTE
6941
+ * TARGET_UPDATE_STACK_BOUNDARY
6942
+ * TARGET_GET_DRAP_RTX
6943
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6944
+ */
6945
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6946
+ * instructions to synthesize a constant. If there is another constant already
6947
+ * in a register that is close enough in value then it is preferable that the
6948
+ * new constant is computed from the register using immediate addition or
6949
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6950
+ * constant we also add a lower and an upper constant anchor to the available
6951
+ * expressions.  These are then queried when encountering new constants.  The
6952
+ * anchors are computed by rounding the constant up and down to a multiple of
6953
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6954
+ * positive value accepted by immediate-add plus one.  We currently assume that
6955
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6956
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6957
+ * to 0x8000.  The default value is zero, which disables this optimization.
6958
+ *
6959
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6960
+ * access registers plus immediates.  To use this, we *need* this capability.
6961
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6962
+ * signed immediate offsets)
6963
+ *
6964
+ * On ZipCPU---2^17
6965
+ */
6966
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
6967
+
6968
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
6969
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
6970
+ * if address Sanitizer is not supported by the target.
6971
+ */
6972
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
6973
+
6974
+/* TARGET_MEMMODEL_CHECK
6975
+ */
6976
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
6977
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
6978
+ */
6979
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
6980
+ * functions.  The support includes the assembler, linker, and dynamic linker.
6981
+ * The default value of this hook is based on target's libc.
6982
+ */
6983
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
6984
+
6985
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
6986
+ * an appropriate alignment in bits for an atomic object of machine mode
6987
+ * MODE.  If 0 is returned then the default alignment for the specified mode
6988
+ * is used.
6989
+ *
6990
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
6991
+ */
6992
+
6993
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
6994
+ * assignments that may raise floating-point exceptions to raise exceptions
6995
+ * corresponding to the arithmetic operation whose result was successfully
6996
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
6997
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
6998
+ * appropriate points in the compare-and-exchange sequence.  This hook should
6999
+ * set *hold to an expression equivalent
7000
+ *
7001
+ * ZipCPU --- ???
7002
+ */
7003
+
7004
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
7005
+ * the compilation unit and no named sections are available.  It is called once
7006
+ * for each symbol that must be recorded in the offload function and variable
7007
+ * table.
7008
+ *
7009
+ * ZipCPU --- Offloaded functions?
7010
+ */
7011
+
7012
+/* TARGET_OFFLOAD_OPTIONS
7013
+ *
7014
+ * ZipCPU---none defined
7015
+ */
7016
+
7017
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
7018
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
7019
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
7020
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
7021
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
7022
+ * HOST_WIDE_INT representation.
7023
+ *
7024
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
7025
+ * are wider than DImode ...)
7026
+ */
7027
+#define        TARGET_SUPPORTS_WIDE_INT        0
7028
+
7029
+
7030
+/* Now, for the prototype functions ...*/
7031
+// These have been moved to zip-protos.h
7032
+
7033
+// extern void zip_init_builtins(void);
7034
+// extern void zip_asm_output_anchor(rtx x);
7035
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
7036
+// extern void zip_asm_trampoline_template(FILE *);
7037
+// extern void zip_initial_elimination_offset(int from, int to);
7038
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
7039
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
7040
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
7041
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
7042
+// extern      int zip_address_operand(rtx op);
7043
+// extern      int zip_const_address_operand(rtx op);
7044
+// extern void zip_expand_prologue(void);
7045
+// extern void zip_expand_epilogue(void);
7046
+// extern bool zip_gen_move_rtl(rtx, rtx);
7047
+// extern bool zip_load_address_lod(rtx, rtx);
7048
+// extern bool zip_load_address_sto(rtx, rtx);
7049
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
7050
+// extern void zip_print_operand_address(FILE *fp, rtx x);
7051
+// extern bool zip_use_return_insn(void);
7052
+
7053 111 dgisselq
+#define        UQQmode USQmode
7054
+#define        UHQmode USQmode
7055
+#define        UHAmode USAmode
7056
+#define        QQmode  SQmode
7057
+#define        HQmode  SQmode
7058 102 dgisselq
+#define        QImode  SImode
7059
+#define        HImode  SImode
7060 111 dgisselq
+#define        QAmode  SAmode
7061
+#define        HAmode  SAmode
7062 102 dgisselq
+
7063
+#include "insn-modes.h"
7064
+#include "zip-protos.h"
7065
+
7066
+#endif /* GCC_ZIP_H */
7067
+
7068
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
7069
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
7070 146 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-05-12 15:59:38.583777436 -0400
7071 142 dgisselq
@@ -0,0 +1,3238 @@
7072 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7073
+;;
7074
+;; Filename:   zip.md
7075
+;;
7076
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
7077
+;;
7078
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
7079
+;;             GNU compiler collection (GCC).
7080
+;;
7081
+;;
7082
+;; Creator:    Dan Gisselquist, Ph.D.
7083
+;;             Gisselquist Technology, LLC
7084
+;;
7085
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7086
+;;
7087
+;; Copyright (C) 2015, Gisselquist Technology, LLC
7088
+;;
7089
+;; This program is free software (firmware): you can redistribute it and/or
7090
+;; modify it under the terms of  the GNU General Public License as published
7091
+;; by the Free Software Foundation, either version 3 of the License, or (at
7092
+;; your option) any later version.
7093
+;;
7094
+;; This program is distributed in the hope that it will be useful, but WITHOUT
7095
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
7096
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7097
+;; for more details.
7098
+;;
7099
+;; License:    GPL, v3, as defined and found on www.gnu.org,
7100
+;;             http://www.gnu.org/licenses/gpl.html
7101
+;;
7102
+;;
7103
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7104
+;;
7105
+;;
7106
+;; - Immediate integer operand constraints
7107
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
7108
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
7109
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
7110
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
7111
+;;     'R'     0...31                                          (Shift value)
7112
+;; - Memory constraints
7113 111 dgisselq
+;;     "Q"     Op-B capable references to memory
7114
+;;     "S"     References to constant memory
7115 102 dgisselq
+;; - Address constraints
7116 111 dgisselq
+;;     "U"     Op-B capable address that references to memory
7117
+;;     "T"     Constant memory addresses
7118 102 dgisselq
+(define_constraint "M"
7119
+  "An 13-bit signed immediate such as a MOV instruction can handle"
7120
+  (and (match_code "const_int")
7121
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
7122
+(define_constraint "N"
7123
+  "An 14-bit signed immediate offset such as an Op-B register offset"
7124
+  (and (match_code "const_int")
7125
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
7126
+(define_constraint "O"
7127
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
7128
+  (and (match_code "const_int")
7129
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
7130
+(define_constraint "R"
7131
+  "Bits that a value may be shifted"
7132
+  (and (match_code "const_int")
7133
+       (match_test "(ival < 32) && (ival >= 0)")))
7134
+;;
7135
+;
7136
+;
7137
+; Our builtin functions, by identifier
7138
+;
7139
+(define_constants
7140 117 dgisselq
+       [(UNSPEC_RTU             1)
7141
+       (UNSPEC_HALT             2)
7142
+       (UNSPEC_IDLE             3)
7143
+       (UNSPEC_SYSCALL          4)
7144
+       (UNSPEC_SAVE_CONTEXT     5)
7145
+       (UNSPEC_RESTORE_CONTEXT  6)
7146
+       (UNSPEC_BITREV           7)
7147
+       (UNSPEC_GETUCC           8)
7148
+       (UNSPEC_GETCC            9)
7149
+       (UNSPEC_LDILO           10)
7150 127 dgisselq
+       ; (UNSPEC_RAW_CALL      11)
7151 102 dgisselq
+       ])
7152
+;
7153
+;
7154
+; Registers by name
7155
+(define_constants
7156
+  [(RTN_REG            0)      ; Return address register
7157
+   (RTNV_REG           1)      ; Subroutine return value register
7158
+   (AP_REG             10)     ; Hopefully never used
7159
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
7160
+   (FP_REG             12)
7161
+   (SP_REG             13)
7162
+   (CC_REG             14)
7163
+   (PC_REG             15)
7164
+  ])
7165
+;
7166
+;
7167
+;
7168
+
7169
+;; Predicates
7170
+(define_predicate "zip_const_address_operand_p"
7171
+       (match_code "symbol_ref,const,label_ref,code_label")
7172
+{
7173
+       return zip_const_address_operand(op);
7174
+})
7175
+
7176
+(define_predicate "zip_address_operand_p"
7177
+       (match_code "reg,plus")
7178
+{
7179 111 dgisselq
+       return zip_pd_opb_operand(op);
7180 102 dgisselq
+})
7181
+
7182 111 dgisselq
+(define_predicate "zip_opb_operand_p"
7183 122 dgisselq
+       (match_code "reg,plus,const_int,subreg")
7184 111 dgisselq
+{
7185
+       return zip_pd_opb_operand(op);
7186
+})
7187
+
7188 122 dgisselq
+(define_predicate "zip_opb_immv_p"
7189
+       (match_code "const_int")
7190
+{
7191
+       return (INTVAL(op)<((1<<13)-1))&&(INTVAL(op)>=-((1<<13)));
7192
+})
7193
+
7194 111 dgisselq
+(define_predicate "zip_opb_single_operand_p"
7195 122 dgisselq
+       (match_code "reg,subreg,const_int")
7196 111 dgisselq
+{
7197
+       return zip_pd_opb_operand(op);
7198
+})
7199
+
7200 102 dgisselq
+(define_predicate "zip_mov_operand_p"
7201
+       (match_code "reg,plus")
7202
+{
7203
+       return zip_pd_mov_operand(op);
7204
+})
7205
+
7206
+(define_predicate "zip_memory_operand_p"
7207
+       (match_code "mem")
7208
+{
7209 111 dgisselq
+       return zip_pd_opb_operand(XEXP(op,0));
7210 102 dgisselq
+})
7211
+
7212 111 dgisselq
+(define_predicate "zip_imm_operand_p"
7213
+       (match_code "const_int")
7214
+{
7215
+       return zip_pd_imm_operand(op);
7216
+})
7217
+
7218
+(define_predicate "zip_mvimm_operand_p"
7219
+       (match_code "const_int")
7220
+{
7221
+       return zip_pd_mvimm_operand(op);
7222
+})
7223
+
7224
+(define_predicate "zip_movdst_operand_p"
7225
+       (match_code "mem,reg,subreg")
7226
+{
7227
+       if (MEM_P(op)) // Check for valid store address
7228
+               return zip_pd_opb_operand(XEXP(op,0));
7229 122 dgisselq
+       else if (SUBREG_P(op))
7230
+               return 1;
7231
+       else if ((REG_P(op))||(SUBREG_P(op)))
7232
+               return register_operand(op, GET_MODE(op));
7233 111 dgisselq
+       return 1;
7234
+})
7235
+
7236
+(define_predicate "zip_movsrc_operand_p"
7237
+       (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
7238
+{
7239
+       if (MEM_P(op))
7240
+               return zip_pd_opb_operand(XEXP(op,0));
7241
+       else if (GET_CODE(op)==PLUS)
7242
+               return zip_pd_opb_operand(op);
7243 122 dgisselq
+       else if (SUBREG_P(op)) {
7244
+               //; As far as predicates are concerned, subregs must be valid.
7245
+               //; The details of them are settled within the constraints.
7246
+               return 1;
7247
+       } else if ((REG_P(op))||(SUBREG_P(op)))
7248
+               return register_operand(op,SImode);
7249
+       else if (CONST_INT_P(op))
7250
+               return 1;
7251 111 dgisselq
+       return 1;
7252
+})
7253
+
7254 102 dgisselq
+;; Constraints
7255
+;
7256
+(define_memory_constraint "S"
7257
+       "Any memory referenced by a constant address, possibly unknown at compile time"
7258
+       (and (match_code "mem")
7259
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
7260
+(define_memory_constraint "Q"
7261
+       "Any memory addressed suitably for a load or store instruction"
7262
+       (and (match_code "mem")
7263
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
7264
+(define_address_constraint "U"
7265
+       "An address suitable for a load or store instruction"
7266
+       (and (match_code "reg,plus")
7267
+               (match_test "zip_ct_address_operand(op)")))
7268
+(define_address_constraint "T"
7269
+       "Any constant address, to include those made by symbols unknown at compile time"
7270
+       (and (match_code "label_ref,code_label,symbol_ref,const")
7271
+               (match_test "zip_ct_const_address_operand(op)")))
7272
+;
7273
+;
7274
+;; Attributes
7275
+;
7276
+(define_attr "predicable"  "no,yes" (const_string "yes"))
7277
+(define_attr "conditional" "no,yes" (const_string "no"))
7278
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
7279
+;
7280
+; Mode attributes
7281
+; (define_mode_iterator ZI [QI HI SI])
7282
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
7283
+(define_mode_iterator ZI [SI])
7284
+(define_mode_attr zipa [(SI "")])
7285
+;
7286
+;
7287
+;
7288
+;; Instructions
7289
+;
7290
+; (define_insn
7291
+;      optional name
7292
+;      RTL template -- a vector of incomplete RTL expressions describing the
7293
+;              semantics of the instruction.  It is incomplete because it may
7294
+;              contain match_operand, match_operator, and match_dup expressions
7295
+;      The condition --- contains a C expression, may be an empty string
7296
+;      output template or output statement--fragment of C code returning a str
7297
+;      Attributes --
7298
+;      )
7299
+;
7300
+; (match_operand:m n predicate constraint)
7301
+;      Placeholder for operand #n of the instruction
7302
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
7303
+;                              (expression, machine mode)
7304
+;              we can build functions:
7305
+;                      "isregister"    to describe a register
7306
+;                      "isimmediate"   to describe an immediate
7307
+;                      "offsetreg"     to describe a register plus offset
7308
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
7309
+;              But ... functions "address_operand", "immediate_operand",
7310
+;                      "register_operand", "indirect_operand"
7311
+;              "comparison_operatot" and "ordered_comparison_operator"
7312
+;              are also available--be aware, they include more comparisons
7313
+;              than Zip CPU can do.
7314
+;
7315
+;
7316
+;
7317
+;
7318
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7319
+;;
7320
+;; Move instructions: both
7321
+;      (arbitrary) from variables to variables, but this gets
7322
+;              expanded into:
7323
+;      from registers to registers
7324
+;      from immediates to registers
7325
+;;
7326
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7327
+;
7328
+;
7329
+;
7330
+(define_expand "mov<mode>"
7331 111 dgisselq
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "")
7332
+               (match_operand:ZI 1 "general_operand" ""))]
7333 102 dgisselq
+       ""
7334 111 dgisselq
+       {//; Everything except mem=const or mem=mem can be done easily
7335
+       //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
7336
+       //; fprintf(stderr, "ZIP-GEN-MOVE\n");
7337
+       //; zip_debug_rtx_pfx("FROM: ", operands[1]);
7338
+       //; zip_debug_rtx_pfx("TO  : ", operands[0]);
7339
+
7340
+       //; Need to load into a register between memory slots
7341
+       if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
7342
+               //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
7343
+               if (can_create_pseudo_p()) {
7344
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
7345
+                       emit_insn(gen_movsi(tmp,operands[1]));
7346
+                       operands[1] = tmp;
7347
+               }
7348 102 dgisselq
+       }
7349 111 dgisselq
+
7350
+       //; Op[0] has a bad address, need to legitimize it
7351
+       if ((MEM_P(operands[0]))&&
7352
+               ((zip_const_address_operand(XEXP(operands[0],0)))
7353
+               ||(!zip_pd_opb_operand(XEXP(operands[0],0))))
7354
+               )
7355
+               {
7356
+               //; fprintf(stderr, "GEN-MOVSI: Not to a MEM(REG)\n");
7357
+               if (can_create_pseudo_p()) {
7358
+                       rtx tmp = gen_reg_rtx(Pmode);
7359
+                       //; Load the address into a register
7360
+                       emit_insn(gen_movsi(tmp,XEXP(operands[0],0)));
7361
+                       XEXP(operands[0],0) = tmp;
7362
+                       mark_reg_pointer(tmp,1);
7363
+               }
7364
+       }
7365
+       //; Op[1] is a constant.  Need to load into a register before we can
7366
+       //; place it into memory.
7367
+       if ((MEM_P(operands[0]))&&
7368
+               ((CONSTANT_P(operands[1]))
7369
+               ||(CONST_INT_P(operands[1])))) {
7370
+               //; fprintf(stderr, "GEN-MOVSI: CONST -> MEM\n");
7371
+               //; zip_debug_rtx_pfx("MEM  : ", operands[0]);
7372
+               //; zip_debug_rtx_pfx("CONST: ", operands[1]);
7373
+               if (can_create_pseudo_p()) {
7374
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[0]));
7375
+                       emit_insn(gen_movsi(tmp,operands[1]));
7376
+                       operands[1] = tmp;
7377
+               }
7378
+       }
7379
+       //; Op[1] has a bad address, need to legitimize it
7380
+       if ((MEM_P(operands[1]))&&
7381
+               //; (!REG_P(XEXP(operands[1],0)))
7382
+               ((zip_const_address_operand(XEXP(operands[1],0)))
7383 122 dgisselq
+               ||(!zip_pd_opb_operand(XEXP(operands[1],0))))) {
7384 111 dgisselq
+               //; fprintf(stderr, "GEN-MOVSI: Not from a MEM(REG)\n");
7385
+               if (can_create_pseudo_p()) {
7386
+                       rtx tmp = gen_reg_rtx(Pmode);
7387
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7388
+                       XEXP(operands[1],0) = tmp;
7389
+               } else if (REG_P(operands[0])) { //; Can we steal Op[0]'s reg?
7390
+                       rtx tmp = operands[0];
7391
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7392
+                       XEXP(operands[1],0) = tmp;
7393
+               }
7394
+       }
7395
+       }
7396 102 dgisselq
+       [(set_attr "ccresult" "unchanged")])
7397 111 dgisselq
+(define_insn "movsi_raw"
7398
+       [(set (match_operand:SI 0 "zip_movdst_operand_p" "=r,Q,r,r")
7399
+               (match_operand:SI 1 "zip_movsrc_operand_p" "r,r,Q,i"))]
7400 122 dgisselq
+       "(register_operand(operands[0],SImode))||(register_operand(operands[1],SImode))"
7401 111 dgisselq
+       "@
7402
+       MOV\t%1,%0
7403
+       STO\t%1,%0
7404
+       LOD\t%1,%0
7405
+       LDI\t%1,%0"
7406
+       [(set_attr "ccresult" "unchanged")])
7407 102 dgisselq
+(define_insn "mov<mode>_reg"   ; Register to register move
7408
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7409
+               (match_operand:ZI 1 "register_operand" "r"))]
7410
+       ""
7411
+       "MOV    %1,%0"
7412
+       [(set_attr "ccresult" "unchanged")])
7413 124 dgisselq
+(define_insn "mov<mode>_reg_off" ; Register to register move, used by prologue
7414 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7415
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7416 111 dgisselq
+                       (match_operand:ZI 2 "zip_mvimm_operand_p" "M")))
7417
+               ]
7418 102 dgisselq
+       ""
7419
+       "MOV    %2(%1),%0"
7420
+       [(set_attr "ccresult" "unchanged")])
7421 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
7422
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
7423
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7424
+;      ""
7425
+;      "LOD    %1,%0"
7426
+;      [(set_attr "ccresult" "unchanged")])
7427
+;(define_insn "mov<mode>_sto"  ; Store into memory
7428
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7429
+;              (match_operand:ZI 1 "register_operand" "r"))]
7430
+;      ""
7431
+;      "STO    %1,%0"
7432
+;      [(set_attr "ccresult" "unchanged")])
7433
+(define_expand "mov<mode>_lod" ; Load from memory
7434 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7435
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7436 103 dgisselq
+       "")
7437
+(define_insn "*movsi_lod"
7438
+       [(set (match_operand:SI 0 "register_operand" "=r")
7439 111 dgisselq
+               (match_operand:SI 1 "zip_memory_operand_p" ""))]
7440 102 dgisselq
+       ""
7441 103 dgisselq
+       "LOD\t%1,%0"
7442
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7443 124 dgisselq
+(define_insn "movsi_lod_off" ; used by epilogue code
7444
+       [(set (match_operand:SI 0 "register_operand" "=r")
7445
+               (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
7446
+                       (match_operand:SI 2 "const_int_operand" "N"))))]
7447
+       ""
7448
+       "LOD\t%2(%1),%0"
7449
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7450 103 dgisselq
+(define_expand "mov<mode>_sto" ; Store into memory
7451 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7452
+               (match_operand:ZI 1 "register_operand" "r"))]
7453 103 dgisselq
+       "")
7454
+(define_insn "*movsi_sto"
7455 111 dgisselq
+       [(set (match_operand:SI 0 "zip_memory_operand_p" "=Q")
7456 103 dgisselq
+               (match_operand:SI 1 "register_operand" "r"))]
7457 102 dgisselq
+       ""
7458 111 dgisselq
+       "STO\t%1,%0"
7459 103 dgisselq
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7460 124 dgisselq
+(define_insn "movsi_sto_off" ; used by prologue code
7461
+       [(set (mem:SI (plus:SI
7462
+                       (match_operand:SI 0 "register_operand" "r")
7463
+                       (match_operand:SI 1 "const_int_operand" "N")))
7464
+               (match_operand:SI 2 "register_operand" "r"))]
7465
+       ""
7466
+       "STO\t%2,%1(%0)"
7467
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7468 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
7469
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7470
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
7471
+       ""
7472
+       "LDI    %1,%0"
7473
+       [(set_attr "ccresult" "unchanged")])
7474
+;
7475
+;
7476
+;
7477
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7478
+;;
7479
+;; Load and store multiple values
7480
+;;
7481
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7482
+;
7483
+; So far, from the code I've seen from GCC's output,
7484
+; these instructions do not appear to be necessary.
7485
+;
7486
+;(define_insn "load_multiple"
7487
+;      for(a=0; a<%2; a++)
7488
+;              LOD a(%1),%0+a
7489
+;(define_insn "store_multiple"
7490
+;      for(a=0; a<%2; a++)
7491
+;              STO %0+a,a(%1)
7492
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
7493
+;
7494
+;
7495
+;
7496
+;
7497
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7498
+;;
7499 127 dgisselq
+;; Substitution Pattern
7500
+;;
7501
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7502
+;
7503
+;
7504
+(define_subst "cc_substitution"
7505
+       ; The pattern may not have any match_dup expressions.
7506
+       [(set (match_operand:SI 0 "" "") (match_operand:SI 1 "" ""))
7507
+               (clobber (reg:CC CC_REG))]
7508
+       ""
7509
+       [(set (match_dup 0) (match_dup 1))
7510
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))
7511
+       ])
7512
+;
7513
+(define_subst_attr "cc_subst" "cc_substitution" "_raw" "_clobber")
7514
+;
7515
+;
7516
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7517
+;;
7518 102 dgisselq
+;; General arithmetic instructions
7519
+;;
7520
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7521
+;
7522
+;
7523
+;
7524
+;
7525 111 dgisselq
+(define_expand "add<mode>3" ; Fastest/best instruction always goes first
7526 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7527 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7528 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7529 127 dgisselq
+       ])
7530
+(define_insn_and_split "add<mode>3_split_reg"
7531
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7532
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7533
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7534
+       ""
7535
+       "#"     ; This code means the instruction *must* be split
7536
+       "(reload_completed)&&(REG_P(operands[0]))&&(REG_P(operands[1]))&&(REGNO(operands[0])==REGNO(operands[1]))"
7537
+       [(parallel [(set (match_dup 0) (plus:ZI (match_dup 1) (match_dup 2)))
7538
+               (clobber (reg:CC CC_REG))])]
7539
+       ""
7540
+       [(set_attr "predicable" "yes")])
7541
+(define_insn_and_split "add<mode>3_split_off"
7542
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7543
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7544
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7545
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7546
+       ""
7547
+       "#"     ; This code means the instruction *must* be split
7548
+       "(reload_completed)&&(REG_P(operands[0]))&&(REG_P(operands[1]))&&(REGNO(operands[0])==REGNO(operands[1]))"
7549
+       [(parallel [(set (match_dup 0) (plus:ZI (match_dup 1)
7550
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7551
+               (clobber (reg:CC CC_REG))])]
7552
+       ""
7553
+       [(set_attr "predicable" "yes")])
7554
+(define_insn "addsi3_reg_clobber"
7555 122 dgisselq
+       [(set (match_operand:SI 0 "register_operand" "=r")
7556
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7557
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7558 127 dgisselq
+       (clobber (reg:CC CC_REG))]
7559
+       ""
7560
+       "ADD    %2,%0"
7561
+       [(set_attr "ccresult" "set")])
7562
+(define_insn "addsi3_reg_raw"
7563
+       [(set (match_operand:SI 0 "register_operand" "=r")
7564
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7565
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7566 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7567 102 dgisselq
+       ""
7568
+       "ADD    %2,%0"
7569
+       [(set_attr "ccresult" "set")])
7570 127 dgisselq
+(define_insn "add<mode>3_off_raw"
7571 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7572 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7573
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7574 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7575
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7576 102 dgisselq
+       ""
7577
+       "ADD    %3+%2,%0"
7578
+       [(set_attr "ccresult" "set")])
7579 127 dgisselq
+(define_insn "add<mode>3_off_clobber"
7580
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7581
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7582
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7583
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7584
+       (clobber (reg:CC CC_REG))]
7585
+       ""
7586
+       "ADD    %3+%2,%0"
7587
+       [(set_attr "ccresult" "set")])
7588 102 dgisselq
+;
7589
+;
7590
+;
7591 103 dgisselq
+(define_expand "sub<mode>3"
7592 138 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7593 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7594 138 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7595 127 dgisselq
+(define_insn_and_split "sub<mode>3_split_reg"
7596 103 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7597
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7598 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7599
+       ""
7600
+       "#"
7601
+       "(reload_completed)"
7602
+       [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1) (match_dup 2)))
7603
+       (clobber (reg:CC CC_REG))])]
7604
+       ""
7605 138 dgisselq
+       [(set_attr "ccresult" "set") (set_attr "predicable" "yes")])
7606 127 dgisselq
+(define_insn "sub<mode>3_reg_raw"
7607
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7608
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7609 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7610 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7611 102 dgisselq
+       ""
7612
+       "SUB    %2,%0"
7613
+       [(set_attr "ccresult" "set")])
7614 127 dgisselq
+(define_insn "sub<mode>3_reg_clobber"
7615 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7616 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7617 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7618
+       (clobber (reg:CC CC_REG))]
7619
+       ""
7620
+       "SUB    %2,%0"
7621
+       [(set_attr "ccresult" "set")])
7622
+(define_insn_and_split "sub<mode>3_off_split"
7623
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7624
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7625 103 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7626 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7627
+       ""
7628
+       "#"
7629
+       "(reload_completed)"
7630
+       [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1)
7631
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7632
+       (clobber (reg:CC CC_REG))])]
7633
+       ""
7634
+       [(set_attr "ccresult" "set")])
7635
+(define_insn "sub<mode>3_off_raw"
7636
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7637
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7638
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7639 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7640
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7641 102 dgisselq
+       ""
7642
+       "SUB    %3+%2,%0"
7643
+       [(set_attr "ccresult" "set")])
7644 127 dgisselq
+(define_insn "sub<mode>3_off_clobber"
7645
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7646
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7647
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7648
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7649
+       (clobber (reg:CC CC_REG))]
7650
+       ""
7651
+       "SUB    %3+%2,%0"
7652
+       [(set_attr "ccresult" "set")])
7653 138 dgisselq
+(define_insn "mul<mode>3_oldstyle"
7654 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7655
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
7656
+                       (match_operand:ZI 2 "register_operand" "r")))
7657 122 dgisselq
+       (clobber (match_scratch:ZI 3 "=r"))
7658
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7659 102 dgisselq
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7660 138 dgisselq
+       "(!ZIP_LONGMPY)"
7661 102 dgisselq
+       "MOV    %1,%0
7662
+       MPYS    %2,%0
7663
+       MOV     %1,%3
7664
+       ROL     16,%3
7665
+       MPYS    %2,%3
7666
+       ROL     16,%3
7667
+       AND     0x0ffff,%3
7668
+       ADD     %3,%0
7669
+       MOV     %2,%3
7670
+       ROL     16,%3
7671
+       MPYS    %1,%3
7672
+       ROL     16,%3
7673
+       AND     0x0ffff,%3
7674
+       ADD     %3,%0"
7675
+       [(set_attr "ccresult" "unknown")])
7676 138 dgisselq
+;
7677
+;
7678
+(define_expand "mul<mode>3"
7679
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7680
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7681
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))]
7682
+       "(ZIP_LONGMPY)")
7683
+(define_insn_and_split "mul<mode>3_split_reg"
7684
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7685
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7686
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7687
+       "(ZIP_LONGMPY)"
7688
+       "#"
7689
+       "(reload_completed)"
7690
+       [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1) (match_dup 2)))
7691
+       (clobber (reg:CC CC_REG))])]
7692
+       ""
7693
+       [(set_attr "ccresult" "set")])
7694
+(define_insn_and_split "mul<mode>3_split_off"
7695
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7696
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7697
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7698
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7699
+       "(ZIP_LONGMPY)"
7700
+       "#"
7701
+       "(reload_completed)"
7702
+       [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1)
7703
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7704
+       (clobber (reg:CC CC_REG))])]
7705
+       ""
7706
+       [(set_attr "ccresult" "set")])
7707
+(define_insn "mul<mode>3_reg_clobber"
7708
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7709
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7710
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7711
+       (clobber (reg:CC CC_REG))]
7712
+       "(ZIP_LONGMPY)"
7713
+       "MPY\t%2,%0"
7714
+       [(set_attr "ccresult" "set")])
7715
+(define_insn "mul<mode>3_reg_raw"
7716
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7717
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7718
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7719
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7720
+       "(ZIP_LONGMPY)"
7721
+       "MPY\t%2,%0"
7722
+       [(set_attr "ccresult" "set")])
7723
+(define_insn "mul<mode>3_off_raw"
7724
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7725
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7726
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7727
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7728
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7729
+       "(ZIP_LONGMPY)"
7730
+       "MPY\t%3+%2,%0"
7731
+       [(set_attr "ccresult" "set")])
7732
+(define_insn "mul<mode>3_off_clobber"
7733
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7734
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7735
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7736
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7737
+       (clobber (reg:CC CC_REG))]
7738
+       "(ZIP_LONGMPY)"
7739
+       "MPY\t%3+%2,%0"
7740
+       [(set_attr "ccresult" "set")])
7741
+;
7742
+;
7743
+(define_expand "smulsi3_highpart"
7744
+       [(set (match_operand:SI 0 "register_operand" "=r")
7745
+           (truncate:SI (ashiftrt:DI (mult:DI
7746
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7747
+               (sign_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
7748
+               (const_int 32))))]
7749
+       "(ZIP_LONGMPY)")
7750
+(define_insn_and_split "smulsi3_highpart_split_reg"
7751
+       [(set (match_operand:SI 0 "register_operand" "=r")
7752
+           (truncate:SI (ashiftrt:DI (mult:DI
7753
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7754
+               (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7755
+               (const_int 32))))]
7756
+       "(ZIP_LONGMPY)"
7757
+       "#"
7758
+       "(reload_completed)"
7759
+       [(parallel [(set (match_dup 0)
7760
+               (truncate:SI (ashiftrt:DI
7761
+                       (mult:DI
7762
+                               (sign_extend:DI (match_dup 1))
7763
+                               (sign_extend:DI (match_dup 2)))
7764
+                       (const_int 32))))
7765
+       (clobber (reg:CC CC_REG))])]
7766
+       ""
7767
+       [(set_attr "ccresult" "set")])
7768
+(define_insn_and_split "smulsi3_highpart_split_off"
7769
+       [(set (match_operand:SI 0 "register_operand" "=r")
7770
+          (truncate:SI (ashift:DI (mult:DI
7771
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7772
+               (sign_extend:DI
7773
+                       (plus:SI (match_operand:SI 2 "register_operand" "r")
7774
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7775
+                       (const_int 32))))]
7776
+       "(ZIP_LONGMPY)"
7777
+       "#"
7778
+       "(reload_completed)"
7779
+       [(parallel [(set (match_dup 0)
7780
+               (truncate:SI (ashiftrt:DI
7781
+                       (mult:SI
7782
+                               (sign_extend:DI (match_dup 1))
7783
+                               (sign_extend:DI
7784
+                                       (plus:SI (match_dup 2) (match_dup 3))))
7785
+                       (const_int 32))))
7786
+       (clobber (reg:CC CC_REG))])]
7787
+       ""
7788
+       [(set_attr "ccresult" "set")])
7789
+(define_insn "smulsi3_highpart_reg_clobber"
7790
+       [(set (match_operand:SI 0 "register_operand" "=r")
7791
+            (truncate:SI (ashiftrt:DI
7792
+               (mult:SI
7793
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7794
+                 (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7795
+               (const_int 32))))
7796
+       (clobber (reg:CC CC_REG))]
7797
+       "(ZIP_LONGMPY)"
7798
+       "MPYSHI\t%2,%0"
7799
+       [(set_attr "ccresult" "set")])
7800
+(define_insn "smulsi3_highpart_reg_raw"
7801
+       [(set (match_operand:SI 0 "register_operand" "=r")
7802
+           (truncate:SI (ashiftrt:DI
7803
+               (mult:SI
7804
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7805
+                 (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7806
+               (const_int 32))))
7807
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7808
+       "(ZIP_LONGMPY)"
7809
+       "MPYSHI\t%2,%0"
7810
+       [(set_attr "ccresult" "set")])
7811
+(define_insn "smulsi3_highpart_off_raw"
7812
+       [(set (match_operand:SI 0 "register_operand" "=r")
7813
+           (truncate:SI (ashiftrt:DI
7814
+               (mult:SI
7815
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7816
+                 (sign_extend:DI (plus:SI
7817
+                               (match_operand:SI 2 "register_operand" "r")
7818
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7819
+               (const_int 32))))
7820
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7821
+       "(ZIP_LONGMPY)"
7822
+       "MPYSHI\t%3+%2,%0"
7823
+       [(set_attr "ccresult" "set")])
7824
+(define_insn "smulsi3_highpart_off_clobber"
7825
+       [(set (match_operand:SI 0 "register_operand" "=r")
7826
+           (truncate:SI (ashiftrt:DI
7827
+               (mult:SI
7828
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7829
+                 (sign_extend:DI (plus:SI
7830
+                       (match_operand:SI 2 "register_operand" "r")
7831
+                       (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7832
+               (const_int 32))))
7833
+       (clobber (reg:CC CC_REG))]
7834
+       "(ZIP_LONGMPY)"
7835
+       "MPYSHI\t%3+%2,%0"
7836
+       [(set_attr "ccresult" "set")])
7837
+;
7838
+;
7839
+(define_expand "umulsi3_highpart"
7840
+       [(set (match_operand:SI 0 "register_operand" "=r")
7841
+           (truncate:SI (ashiftrt:DI (mult:DI
7842
+               (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7843
+               (zero_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
7844
+               (const_int 32))))]
7845
+       "(ZIP_LONGMPY)")
7846
+(define_insn_and_split "umulsi3_highpart_split_reg"
7847
+       [(set (match_operand:SI 0 "register_operand" "=r")
7848
+           (truncate:SI (ashiftrt:DI (mult:DI
7849
+               (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7850
+               (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7851
+               (const_int 32))))]
7852
+       "(ZIP_LONGMPY)"
7853
+       "#"
7854
+       "(reload_completed)"
7855
+       [(parallel [(set (match_dup 0)
7856
+               (truncate:SI (ashiftrt:DI
7857
+                       (mult:SI
7858
+                               (zero_extend:DI (match_dup 1))
7859
+                               (zero_extend:DI (match_dup 2)))
7860
+                       (const_int 32))))
7861
+       (clobber (reg:CC CC_REG))])]
7862
+       ""
7863
+       [(set_attr "ccresult" "set")])
7864
+(define_insn_and_split "umulsi3_highpart_split_off"
7865
+       [(set (match_operand:SI 0 "register_operand" "=r")
7866
+               (truncate:SI (ashiftrt:DI
7867
+               (mult:DI
7868
+                 (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7869
+                 (zero_extend:DI
7870
+                       (plus:SI (match_operand:SI 2 "register_operand" "r")
7871
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7872
+               (const_int 32))))]
7873
+       "(ZIP_LONGMPY)"
7874
+       "#"
7875
+       "(reload_completed)"
7876
+       [(parallel [(set (match_dup 0)
7877
+               (truncate:SI (ashiftrt:DI
7878
+                       (mult:DI
7879
+                               (zero_extend:DI (match_dup 1))
7880
+                               (zero_extend:DI
7881
+                                       (plus:SI (match_dup 2) (match_dup 3))))
7882
+                       (const_int 32))))
7883
+       (clobber (reg:CC CC_REG))])]
7884
+       ""
7885
+       [(set_attr "ccresult" "set")])
7886
+(define_insn "umulsi3_highpart_reg_clobber"
7887
+       [(set (match_operand:SI 0 "register_operand" "=r")
7888
+           (truncate:SI (ashiftrt:DI
7889
+               (mult:DI
7890
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7891
+                   (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7892
+               (const_int 32))))
7893
+       (clobber (reg:CC CC_REG))]
7894
+       "(ZIP_LONGMPY)"
7895
+       "MPYSHI\t%2,%0"
7896
+       [(set_attr "ccresult" "set")])
7897
+(define_insn "umulsi3_highpart_reg_raw"
7898
+       [(set (match_operand:SI 0 "register_operand" "=r")
7899
+           (truncate:SI (ashiftrt:DI
7900
+               (mult:DI
7901
+                  (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7902
+                  (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7903
+               (const_int 32))))
7904
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7905
+       "(ZIP_LONGMPY)"
7906
+       "MPYSHI\t%2,%0"
7907
+       [(set_attr "ccresult" "set")])
7908
+(define_insn "umulsi3_highpart_off_raw"
7909
+       [(set (match_operand:SI 0 "register_operand" "=r")
7910
+           (truncate:SI (ashiftrt:DI
7911
+               (mult:DI
7912
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7913
+                   (zero_extend:DI (plus:SI
7914
+                               (match_operand:SI 2 "register_operand" "r")
7915
+                               (match_operand:DI 3 "zip_opb_immv_p" "N"))))
7916
+               (const_int 32))))
7917
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7918
+       "(ZIP_LONGMPY)"
7919
+       "MPYSHI\t%3+%2,%0"
7920
+       [(set_attr "ccresult" "set")])
7921
+(define_insn "umulsi3_highpart_off_clobber"
7922
+       [(set (match_operand:SI 0 "register_operand" "=r")
7923
+           (truncate:SI (ashiftrt:DI
7924
+               (mult:DI
7925
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7926
+                   (zero_extend:DI (plus:SI
7927
+                       (match_operand:SI 2 "register_operand" "r")
7928
+                       (match_operand:DI 3 "zip_opb_immv_p" "N"))))
7929
+               (const_int 32))))
7930
+       (clobber (reg:CC CC_REG))]
7931
+       "(ZIP_LONGMPY)"
7932
+       "MPYSHI\t%3+%2,%0"
7933
+       [(set_attr "ccresult" "set")])
7934
+;
7935
+;
7936 111 dgisselq
+(define_expand "div<mode>3"
7937 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7938 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7939 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7940
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7941 111 dgisselq
+       "(ZIP_DIVIDE)")
7942
+(define_insn "div<mode>3_reg"
7943
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7944
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7945 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7946
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7947 111 dgisselq
+       "(ZIP_DIVIDE)"
7948 102 dgisselq
+       "DIVS   %2,%0"
7949
+       [(set_attr "ccresult" "set")])
7950
+(define_insn "div<mode>3_off"
7951
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7952 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7953
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7954 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7955
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7956 111 dgisselq
+       "(ZIP_DIVIDE)"
7957 102 dgisselq
+       "DIVS   %3+%2,%0"
7958
+       [(set_attr "ccresult" "set")])
7959 111 dgisselq
+(define_expand "udiv<mode>3"
7960 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7961 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7962 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7963
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7964 111 dgisselq
+       "(ZIP_DIVIDE)")
7965
+(define_insn "udiv<mode>3_reg"
7966
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7967
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7968 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7969
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7970 111 dgisselq
+       "(ZIP_DIVIDE)"
7971 102 dgisselq
+       "DIVU   %2,%0"
7972
+       [(set_attr "ccresult" "set")])
7973
+(define_insn "udiv<mode>3_off"
7974
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7975 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7976
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7977 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7978
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7979 111 dgisselq
+       "(ZIP_DIVIDE)"
7980 102 dgisselq
+       "DIVU   %3+%2,%0"
7981
+       [(set_attr "ccresult" "set")])
7982
+;;
7983
+;; modsi3
7984
+;; umodsi3
7985
+;;
7986
+(define_insn "umin<mode>3"
7987
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7988
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
7989
+                       (match_operand:ZI 2 "register_operand" "r")))
7990 122 dgisselq
+       (clobber (reg:CC CC_REG))
7991 102 dgisselq
+       ]
7992
+       ""
7993
+       "CMP    %0,%2
7994
+       MOV.C   %2,%0"
7995
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
7996
+(define_insn "umax<mode>3"
7997
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7998
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
7999
+                       (match_operand:ZI 2 "register_operand" "r")))
8000 122 dgisselq
+       (clobber (reg:CC CC_REG))
8001 102 dgisselq
+       ]
8002
+       ""
8003
+       "CMP    %2,%0
8004
+       MOV.C   %2,%0"
8005
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8006
+(define_insn "smin<mode>3"
8007
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8008
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
8009
+                       (match_operand:ZI 2 "register_operand" "r")))
8010 122 dgisselq
+       (clobber (reg:CC CC_REG))
8011 102 dgisselq
+       ]
8012
+       ""
8013
+       "CMP    %2,%0
8014
+       MOV.GT  %2,%0"
8015
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8016
+(define_insn "smax<mode>3"
8017
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8018
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
8019
+                       (match_operand:ZI 2 "register_operand" "r")))
8020 122 dgisselq
+       (clobber (reg:CC CC_REG))
8021 102 dgisselq
+       ]
8022
+       ""
8023
+       "CMP    %0,%2
8024
+       MOV.LT  %2,%0"
8025
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8026 127 dgisselq
+;
8027
+;
8028 111 dgisselq
+(define_expand "and<mode>3"
8029 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8030 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8031 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
8032
+(define_insn_and_split "and<mode>3_reg_split"
8033 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8034
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8035 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8036
+       ""
8037
+       "#"
8038
+       "(reload_completed)"
8039
+       [(parallel [(set (match_dup 0) (and:ZI (match_dup 1) (match_dup 2)))
8040
+       (clobber (reg:CC CC_REG))])]
8041
+       ""
8042
+       [(set_attr "ccresult" "set")])
8043
+(define_insn "and<mode>3_reg_raw"
8044
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8045
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8046 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8047
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8048 102 dgisselq
+       ""
8049
+       "AND    %2,%0"
8050
+       [(set_attr "ccresult" "set")])
8051 127 dgisselq
+(define_insn "and<mode>3_reg_clobber"
8052 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8053 127 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8054
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8055
+       (clobber (reg:CC CC_REG))]
8056
+       ""
8057
+       "AND    %2,%0"
8058
+       [(set_attr "ccresult" "set")])
8059
+(define_insn_and_split "and<mode>3_off_split"
8060
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8061 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8062
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8063 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8064
+       ""
8065
+       "#"
8066
+       "(reload_completed)"
8067
+       [(parallel [(set (match_dup 0) (and:ZI (match_dup 1)
8068
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8069
+       (clobber (reg:CC CC_REG))])]
8070
+       ""
8071
+       [(set_attr "ccresult" "set")])
8072
+(define_insn "and<mode>3_off_raw"
8073
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8074
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8075
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8076 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8077
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8078 102 dgisselq
+       ""
8079
+       "AND    %3+%2,%0"
8080
+       [(set_attr "ccresult" "set")])
8081 127 dgisselq
+(define_insn "and<mode>3_off_clobber"
8082
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8083
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8084
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8085
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8086
+       (clobber (reg:CC CC_REG))]
8087
+       ""
8088
+       "AND    %3+%2,%0"
8089
+       [(set_attr "ccresult" "set")])
8090
+;
8091
+;
8092 111 dgisselq
+(define_expand "ior<mode>3"
8093 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8094 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8095 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
8096
+(define_insn_and_split "ior<mode>3_reg_split"
8097 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8098
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8099 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8100
+       ""
8101
+       "#"
8102
+       "(reload_completed)"
8103
+       [(parallel [(set (match_dup 0) (ior:ZI (match_dup 1) (match_dup 2)))
8104
+       (clobber (reg:CC CC_REG))])]
8105
+       ""
8106
+       [(set_attr "ccresult" "set")])
8107
+(define_insn "ior<mode>3_reg_raw"
8108
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8109
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8110 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8111
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8112 102 dgisselq
+       ""
8113
+       "OR     %2,%0"
8114
+       [(set_attr "ccresult" "set")])
8115 127 dgisselq
+(define_insn "ior<mode>3_reg_clobber"
8116 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8117 127 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8118
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8119
+       (clobber (reg:CC CC_REG))]
8120
+       ""
8121
+       "OR     %2,%0"
8122
+       [(set_attr "ccresult" "set")])
8123
+(define_insn_and_split "ior<mode>3_off_split"
8124
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8125 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8126
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8127 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8128
+       ""
8129
+       "#"
8130
+       "(reload_completed)"
8131
+       [(parallel [(set (match_dup 0) (ior:ZI (match_dup 1)
8132
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8133
+       (clobber (reg:CC CC_REG))])]
8134
+       ""
8135
+       [(set_attr "ccresult" "set")])
8136
+(define_insn "ior<mode>3_off_raw"
8137
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8138
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8139
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8140 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8141
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8142 102 dgisselq
+       ""
8143
+       "OR     %3+%2,%0"
8144
+       [(set_attr "ccresult" "set")])
8145 127 dgisselq
+(define_insn "ior<mode>3_off_clobber"
8146
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8147
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8148
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8149
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8150
+       (clobber (reg:CC CC_REG))]
8151
+       ""
8152
+       "OR     %3+%2,%0"
8153
+       [(set_attr "ccresult" "set")])
8154
+;
8155
+;
8156
+;
8157 111 dgisselq
+(define_expand "xor<mode>3"
8158 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
8159 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8160 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
8161
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
8162
+       "")
8163 127 dgisselq
+(define_insn_and_split "xor<mode>3_reg_split"
8164 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8165
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8166 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8167
+       ""
8168
+       "#"
8169
+       "(reload_completed)"
8170
+       [(parallel [(set (match_dup 0) (xor:ZI (match_dup 1) (match_dup 2)))
8171
+       (clobber (reg:CC CC_REG))])]
8172
+       ""
8173
+       [(set_attr "ccresult" "set")])
8174
+(define_insn "xor<mode>3_reg_raw"
8175
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8176
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8177 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8178
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8179 102 dgisselq
+       ""
8180
+       "XOR    %2,%0"
8181
+       [(set_attr "ccresult" "set")])
8182 127 dgisselq
+(define_insn "xor<mode>3_reg_clobber"
8183 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8184 127 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8185
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8186
+       (clobber (reg:CC CC_REG))]
8187
+       ""
8188
+       "XOR    %2,%0"
8189
+       [(set_attr "ccresult" "set")])
8190
+(define_insn_and_split "xor<mode>3_off_split"
8191
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8192 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8193
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8194 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8195
+       ""
8196
+       "#"
8197
+       "(reload_completed)"
8198
+       [(parallel [(set (match_dup 0) (xor:ZI (match_dup 1)
8199
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8200
+       (clobber (reg:CC CC_REG))])]
8201
+       ""
8202
+       [(set_attr "ccresult" "set")])
8203
+(define_insn "xor<mode>3_off_raw"
8204
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8205
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8206
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8207 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8208
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8209 102 dgisselq
+       ""
8210
+       "XOR    %3+%2,%0"
8211
+       [(set_attr "ccresult" "set")])
8212 127 dgisselq
+(define_insn "xor<mode>3_off_clobber"
8213
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8214
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8215
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8216
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8217
+       (clobber (reg:CC CC_REG))]
8218
+       ""
8219
+       "XOR    %3+%2,%0"
8220
+       [(set_attr "ccresult" "set")])
8221 102 dgisselq
+;(define_insn "addv<mode>4"
8222
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
8223
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
8224
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
8225 122 dgisselq
+       ;(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
8226 102 dgisselq
+                       ;(label_ref (match_operand 3))
8227
+                       ;(pc)))]
8228
+       ;""
8229
+       ;"MOV   %1,%0
8230
+       ;ADD    %2,%0
8231
+       ;BV     %3"
8232
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8233
+;;(define_insn "subvsi4"
8234
+;;     MOV     %1,%0
8235
+;;     SUB     %2,%0
8236
+;;     BV      %3
8237
+;;(mulvsi4)
8238
+;;(define_insn "uaddvsi4"
8239
+;;     ADD     %2,%0
8240
+;;     BC      %3
8241
+;;(define_insn "usubvsi4"
8242
+;;     MOV     %1,%0
8243
+;;     SUB     %2,%0
8244
+;;     BC      %3
8245
+;;
8246
+;; (define_insn "umulvsi4"
8247
+;;     ... ???)
8248
+;;
8249 127 dgisselq
+(define_expand "ashr<mode>3"
8250 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8251
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8252 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8253
+(define_insn_and_split "ashr<mode>3_split"
8254
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8255
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8256
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8257
+       ""
8258
+       "#"
8259
+       "(reload_completed)"
8260
+       [(parallel [(set (match_dup 0) (ashiftrt:ZI (match_dup 1) (match_dup 2)))
8261
+       (clobber (reg:CC CC_REG))])]
8262
+       ""
8263
+       [(set_attr "ccresult" "set")])
8264
+(define_insn "ashr<mode>3_raw"
8265
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8266
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8267 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8268
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8269 102 dgisselq
+       ""
8270
+       "ASR    %2,%0"
8271
+       [(set_attr "ccresult" "set")])
8272 127 dgisselq
+(define_insn "ashr<mode>3_clobber"
8273 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8274 127 dgisselq
+               (ashiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8275
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8276
+       (clobber (reg:CC CC_REG))]
8277
+       ""
8278
+       "ASR    %2,%0"
8279
+       [(set_attr "ccresult" "set")])
8280
+;
8281
+;
8282
+(define_expand "ashl<mode>3"
8283
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8284 111 dgisselq
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8285 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8286
+(define_insn_and_split "ashl<mode>3_split"
8287
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8288
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8289
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8290
+       ""
8291
+       "#"
8292
+       "(reload_completed)"
8293
+       [(parallel [(set (match_dup 0) (ashift:ZI (match_dup 1) (match_dup 2)))
8294
+       (clobber (reg:CC CC_REG))])]
8295
+       ""
8296
+       [(set_attr "ccresult" "set")])
8297
+(define_insn "ashl<mode>3_raw"
8298
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8299
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8300 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8301
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8302 111 dgisselq
+       ""
8303 122 dgisselq
+       "LSL    %2,%0"
8304 111 dgisselq
+       [(set_attr "ccresult" "set")])
8305 127 dgisselq
+(define_insn "ashl<mode>3_clobber"
8306 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8307 127 dgisselq
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8308
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8309
+       (clobber (reg:CC CC_REG))]
8310
+       ""
8311
+       "LSL    %2,%0"
8312
+       [(set_attr "ccresult" "set")])
8313
+;
8314
+;
8315
+(define_expand "lshr<mode>3"
8316
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8317 102 dgisselq
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8318 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8319
+(define_insn_and_split "lshr<mode>3_split"
8320
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8321
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8322
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8323
+       ""
8324
+       "#"
8325
+       "(reload_completed)"
8326
+       [(parallel [(set (match_dup 0) (lshiftrt:ZI (match_dup 1) (match_dup 2)))
8327
+       (clobber (reg:CC CC_REG))])]
8328
+       ""
8329
+       [(set_attr "ccresult" "set")])
8330
+(define_insn "lshr<mode>3_raw"
8331
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8332
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8333
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8334 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8335 102 dgisselq
+       ""
8336
+       "LSR    %2,%0"
8337
+       [(set_attr "ccresult" "set")])
8338 127 dgisselq
+(define_insn "lshr<mode>3_clobber"
8339 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8340 127 dgisselq
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8341
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8342
+       (clobber (reg:CC CC_REG))]
8343
+       ""
8344
+       "LSR    %2,%0"
8345
+       [(set_attr "ccresult" "set")])
8346
+;
8347
+;
8348
+(define_expand "rotl<mode>3"
8349
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8350 102 dgisselq
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8351 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8352
+(define_insn_and_split "rotl<mode>3_split"
8353
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8354
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8355
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8356
+       ""
8357
+       "#"
8358
+       "(reload_completed)"
8359
+       [(parallel [(set (match_dup 0) (rotate:ZI (match_dup 1) (match_dup 2)))
8360
+       (clobber (reg:CC CC_REG))])]
8361
+       ""
8362
+       [(set_attr "ccresult" "set")])
8363
+(define_insn "rotl<mode>3_raw"
8364
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8365
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8366 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8367
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8368 102 dgisselq
+       ""
8369
+       "ROL    %2,%0"
8370
+       [(set_attr "ccresult" "set")])
8371 127 dgisselq
+(define_insn "rotl<mode>3_clobber"
8372
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8373
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8374
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8375
+       (clobber (reg:CC CC_REG))]
8376
+       ""
8377
+       "ROL    %2,%0"
8378
+       [(set_attr "ccresult" "set")])
8379 102 dgisselq
+;
8380 127 dgisselq
+;
8381
+;
8382 102 dgisselq
+(define_insn "neg<mode>2"
8383
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8384
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
8385 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8386 102 dgisselq
+       ""
8387
+       "NEG    %1,%0"
8388
+       [(set_attr "ccresult" "validzn")])
8389
+(define_insn "abs<mode>2"
8390
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8391
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
8392 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8393 102 dgisselq
+       ""
8394
+       "TEST   %0
8395
+       NEG.LT  %0"
8396
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8397
+(define_insn "popcount<mode>2"
8398
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8399
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
8400 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8401 102 dgisselq
+       ""
8402
+       "POPC   %1,%0"
8403
+       [(set_attr "ccresult" "set")])
8404
+(define_expand "parity<mode>2"
8405 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
8406 102 dgisselq
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
8407 127 dgisselq
+               (clobber (reg:CC CC_REG))])
8408 122 dgisselq
+       (parallel [
8409
+               (set (match_dup 0) (and:ZI (match_dup 0) (const_int -2)))
8410
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
8411 102 dgisselq
+       ])
8412
+(define_insn "one_cmpl<mode>2"
8413
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8414
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
8415 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8416 102 dgisselq
+       ""
8417
+       "XOR    -1,%0"
8418
+       [(set_attr "ccresult" "set")])
8419
+;
8420
+;
8421
+;
8422
+;
8423 117 dgisselq
+;
8424 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8425
+;;
8426
+;; General arithmetic instructions -- double words
8427
+;;
8428
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8429
+;
8430
+;
8431
+;
8432 111 dgisselq
+(define_expand "movdi3"
8433
+       [(set (match_operand:DI 0 "nonimmediate_operand" "")
8434
+               (match_operand:DI 1 "general_operand" ""))])
8435
+(define_insn "movdi_lod"
8436
+       [(set (match_operand:DI 0 "register_operand" "=r")
8437 122 dgisselq
+               (mem:DI (match_operand:SI 1 "zip_opb_operand_p" "")))]
8438 111 dgisselq
+       ""
8439
+       {
8440 122 dgisselq
+               if (REG_P(operands[1]))
8441 111 dgisselq
+                       return "LOD\t(%1),%H0\n\tLOD\t1(%1),%L0";
8442 122 dgisselq
+               else if (GET_CODE(operands[1])==PLUS) {
8443
+                       if ((REG_P(XEXP(operands[1],0)))
8444
+                               &&(CONST_INT_P(XEXP(operands[1],1)))) {
8445 111 dgisselq
+                               static  char    buf[64];
8446
+                               sprintf(buf,
8447
+                                       "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
8448 138 dgisselq
+                                       (long)INTVAL(XEXP(operands[1],1)),
8449
+                                       (long)INTVAL(XEXP(operands[1],1)+1));
8450 111 dgisselq
+                               return buf;
8451
+                       }
8452 122 dgisselq
+               } return "BREAK";
8453 111 dgisselq
+       }
8454
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8455
+(define_insn "movdi_sto"
8456
+       [(set (mem:DI (match_operand:SI 0 "zip_opb_operand_p" ""))
8457
+               (match_operand:DI 1 "register_operand" "r"))]
8458
+       ""
8459
+       {
8460
+               if (REG_P(operands[0]))
8461
+                       return "STO\t%H0,(%1)\n\tSTO\t%L0,1(%1)";
8462
+               else if (GET_CODE(operands[0])==PLUS) {
8463
+                       if ((REG_P(XEXP(operands[0],0)))
8464
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
8465
+                               static  char    buf[64];
8466
+                               sprintf(buf,
8467
+                                       "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
8468 138 dgisselq
+                                       (long)INTVAL(XEXP(operands[0],1)),
8469
+                                       (long)INTVAL(XEXP(operands[0],1)+1));
8470 111 dgisselq
+                               return buf;
8471
+                       }
8472 127 dgisselq
+               } return "BREAK";
8473 111 dgisselq
+       }
8474
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8475
+(define_insn "movdi_ldi"
8476
+       [(set (match_operand:DI 0 "register_operand" "=r")
8477
+               (match_operand:DI 1 "immediate_operand" "i"))]
8478
+       ""
8479
+       "LDI\t%H1,%H0\n\tLDI\t%L1,%L0"
8480
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8481 102 dgisselq
+(define_insn "adddi3" ; Fastest/best instruction always goes first
8482
+       [(set (match_operand:DI 0 "register_operand" "=r")
8483 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
8484 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
8485 122 dgisselq
+       (clobber (reg:CC CC_REG))
8486 102 dgisselq
+       ]
8487
+       ""
8488
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
8489
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8490
+;
8491
+(define_insn "subdi3"
8492
+       [(set (match_operand:DI 0 "register_operand" "=r")
8493 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
8494 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
8495 122 dgisselq
+       (clobber (reg:CC CC_REG))
8496 102 dgisselq
+       ]
8497
+       ""
8498
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
8499
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8500
+;
8501
+(define_insn "anddi3"
8502
+       [(set (match_operand:DI 0 "register_operand" "=r")
8503
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
8504
+                       (match_operand:DI 2 "register_operand" "r")))
8505 122 dgisselq
+       (clobber (reg:CC CC_REG))
8506 102 dgisselq
+       ]
8507
+       ""
8508
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
8509
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8510
+;
8511
+(define_insn "iordi3"
8512
+       [(set (match_operand:DI 0 "register_operand" "=r")
8513
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
8514
+                       (match_operand:DI 2 "register_operand" "r")))
8515 122 dgisselq
+       (clobber (reg:CC CC_REG))
8516 102 dgisselq
+       ]
8517
+       ""
8518
+       "OR     %2,%0\n\tOR\t%H2,%H0"
8519
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8520
+;
8521
+(define_insn "xordi3"
8522
+       [(set (match_operand:DI 0 "register_operand" "=r")
8523
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
8524
+                       (match_operand:DI 2 "register_operand" "r")))
8525 122 dgisselq
+       (clobber (reg:CC CC_REG))
8526 102 dgisselq
+       ]
8527
+       ""
8528
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
8529
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8530
+;
8531
+(define_insn "negdi2"
8532
+       [(set (match_operand:DI 0 "register_operand" "=r")
8533 122 dgisselq
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))
8534
+       (clobber (reg:CC CC_REG))
8535
+       ]
8536 102 dgisselq
+       ""
8537
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
8538
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8539
+;
8540
+(define_insn "absdi2"
8541 122 dgisselq
+       [(set (match_operand:DI 0 "register_operand" "=r")
8542
+               (abs:DI (match_operand:DI 1 "register_operand" "0")))
8543
+       (clobber (match_scratch:SI 2 "=r"))
8544
+       (clobber (reg:CC CC_REG))
8545
+       ]
8546 102 dgisselq
+       ""
8547
+       "CLR    %2
8548
+       TEST    %H0             ; Problem, we can't tell conditions
8549
+       LDILO.LT        1,%2
8550
+       XOR.LT  -1,%L0
8551
+       XOR.LT  -1,%H0
8552
+       ADD     %2,%L0
8553 122 dgisselq
+       ADD.C   1,%H0"
8554 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8555
+(define_insn "one_cmpldi2"
8556
+       [(set (match_operand:DI 0 "register_operand" "=r")
8557
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
8558 122 dgisselq
+       (clobber (reg:CC CC_REG))
8559 102 dgisselq
+       ]
8560
+       ""
8561
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
8562
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8563
+(define_insn "umindi3"
8564
+       [(set (match_operand:DI 0 "register_operand" "=r")
8565
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
8566
+                       (match_operand:DI 2 "register_operand" "r")))
8567 122 dgisselq
+       (clobber (reg:CC CC_REG))
8568 102 dgisselq
+       ]
8569
+       ""
8570
+       "CMP    %H0,%H2
8571
+       CMP.Z   %L0,%L2
8572
+       MOV.C   %H2,%H0
8573
+       MOV.C   %L2,%L0"
8574
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8575
+(define_insn "umaxdi3"
8576
+       [(set (match_operand:DI 0 "register_operand" "=r")
8577
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
8578
+                       (match_operand:DI 2 "register_operand" "r")))
8579 122 dgisselq
+       (clobber (reg:CC CC_REG))
8580 102 dgisselq
+       ]
8581
+       ""
8582
+       "CMP    %H2,%H0
8583
+       CMP.Z   %L2,%L0
8584
+       MOV.C   %H2,%H0
8585
+       MOV.C   %L2,%L0"
8586
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8587
+(define_insn "popcountdi2"
8588
+       [(set (match_operand:SI 0 "register_operand" "=r")
8589 122 dgisselq
+               (popcount:SI (match_operand:DI 1 "register_operand" "r")))
8590 102 dgisselq
+       (clobber (match_scratch:SI 2 "=r"))
8591 122 dgisselq
+       (clobber (reg:CC CC_REG))
8592 102 dgisselq
+       ]
8593
+       ""
8594
+       "POPC   %L1,%0
8595
+       POPC    %H1,%2
8596
+       ADD     %2,%0"
8597
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8598
+(define_expand "paritydi2"
8599
+       [(set (match_operand:SI 0 "register_operand" "=r")
8600
+               (popcount (match_operand:DI 1 "register_operand" "r")))
8601
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
8602
+       ])
8603 117 dgisselq
+;(define_insn "extendsidi2"
8604
+;      [(set (match_operand:DI 0 "register_operand" "=r")
8605
+;              (sign_extend:DI (match_operand:SI 0 "register_operand" "r")))]
8606
+;      ""
8607
+;      "TEST\t%1\nMOV\t%1,%L0\nCLR\t%L1\nLDI.LT\t-1,%L1"
8608
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8609
+;(define_insn "mulsidi3"
8610
+;      [(set (match_operand:DI 0 "register_operand" "=r")
8611
+;              (mult:SI (match_operand:SI 1 "register_operand" "%r")
8612
+;                      (match_operand:SI 2 "register_operand" "r")))
8613
+;      (clobber (match_scratch:SI 3 "=r"))]
8614
+;      ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
8615
+;      ""
8616
+;      "MOV    %1,%L0
8617
+;      MPYS    %2,%L0                  ; L0 = R2 * R1
8618
+;      MOV     %1,%3                   ; R3 = R1
8619
+;      ROL     16,%3                   ; R3 = (R1 <<< 16)
8620
+;      MPYS    %2,%3                   ; R3 = (R1 <<< 16) * R2
8621
+;      ROL     16,%3                   ; R3 = upper bits of (R1<<<16)*R2
8622
+;      AND     0x0ffff,%3
8623
+;      ADD     %3,%L0                  ; L0 = L0 + R3 = L0  + (R1>>16)*R2
8624
+;      MOV     %2,%3
8625
+;      ROL     16,%3
8626
+;      MPYS    %1,%3
8627
+;      ROL     16,%3
8628
+;      AND     0x0ffff,%3
8629
+;      ADD     %3,%0"
8630
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8631
+
8632 102 dgisselq
+;
8633
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
8634
+;      mult:di, div:di, divu:di
8635
+;
8636
+;
8637
+;
8638
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8639
+;;
8640
+;; Conditional arithmetic instructions
8641
+;;
8642
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8643
+;
8644
+;
8645
+;
8646
+;
8647
+(define_expand "cstore<mode>4" ; Store 0 or 1 in %0 based on cmp between %2&%3
8648 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 2 "register_operand" "r")
8649
+               (match_operand:ZI 3 "zip_opb_operand_p" "rO")))
8650 102 dgisselq
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8651
+                       (match_operator 1 "ordered_comparison_operator"
8652 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
8653 102 dgisselq
+                       (const_int 1) (const_int 0)))]
8654
+       ""
8655
+       )
8656
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
8657
+       [(set (match_operand:SI 0 "register_operand" "=r")
8658
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
8659 122 dgisselq
+                       [(match_operand:DI 2 "register_operand" "r")
8660
+                               (match_operand:DI 3 "register_operand" "r")])
8661
+                       (const_int 1) (const_int 0)))
8662
+       (clobber (reg:CC CC_REG))]
8663 102 dgisselq
+       ""
8664
+       {
8665
+               switch(GET_CODE(operands[1])) {
8666
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
8667
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
8668
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
8669
+               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";
8670
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
8671
+               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";
8672
+               default:
8673
+                       gcc_unreachable();
8674
+               }
8675
+       }
8676
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8677
+;
8678
+;
8679
+;
8680
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8681
+;;
8682
+;; Comparison instructions, both compare and test
8683
+;;
8684
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8685
+;
8686
+;
8687
+;
8688
+;; This will only work so well, since the direction of the compare is
8689
+;; important in unsigned compares.
8690
+;;
8691 122 dgisselq
+(define_expand "cmp<mode>"
8692
+       [(set (reg:CC CC_REG) (compare:CC
8693
+               (match_operand:ZI 0 "register_operand" "r")
8694
+               (match_operand:ZI 1 "nonmemory_operand" "")))]
8695 102 dgisselq
+       ""
8696 122 dgisselq
+       {
8697
+               if (!zip_opb_operand_p(operands[1],SImode)) {
8698
+                       if (can_create_pseudo_p()) {
8699
+                               //; fprintf(stderr, "Generating pseudo register for compare\n");
8700
+                               rtx tmp = gen_reg_rtx(SImode);
8701
+                               emit_insn(gen_movsi(tmp,operands[1]));
8702
+                               operands[1] = tmp;
8703
+                       } else FAIL;
8704
+               }
8705
+       })
8706
+(define_insn "cmp<mode>_reg"
8707
+       [(set (reg:CC CC_REG) (compare:CC
8708
+               (match_operand:ZI 0 "register_operand" "r")
8709
+               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO")))]
8710
+       ""
8711 102 dgisselq
+       "CMP\t%1,%0"
8712
+       [(set_attr "ccresult" "set")])
8713
+(define_insn "cmp<mode>_off"
8714 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8715
+               (match_operand:ZI 0 "register_operand" "r")
8716 146 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
8717 122 dgisselq
+                       (match_operand 2 "zip_opb_immv_p" "N"))))]
8718 102 dgisselq
+       ""
8719
+       "CMP\t%2+%1,%0"
8720
+       [(set_attr "ccresult" "set")])
8721
+(define_insn "test<mode>"
8722 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_operand:ZI 0 "register_operand" "r")
8723
+                               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO"))
8724 102 dgisselq
+                       (const_int 0)))]
8725
+       ""
8726
+       "TEST   %1,%0"
8727
+       [(set_attr "ccresult" "set")])
8728
+(define_insn "test<mode>_off"
8729 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8730
+               (and:ZI (match_operand:ZI 0 "register_operand" "r")
8731
+                       (plus:ZI
8732
+                               (match_operand:ZI 1 "register_operand" "r")
8733
+                               (match_operand:ZI 2 "zip_opb_immv_p" "N")))
8734
+               (const_int 0)))]
8735 102 dgisselq
+       ""
8736
+       "TEST   %2+%1,%0"
8737
+       [(set_attr "ccresult" "set")])
8738
+(define_insn "nop"
8739
+       [(const_int 0)]
8740
+       ""
8741
+       "NOOP"
8742
+       [(set_attr "ccresult" "unchanged")])
8743
+;
8744
+;
8745
+;
8746
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8747
+;;
8748
+;; Conditional execution predicates
8749
+;;
8750
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8751
+;
8752
+; Sadly, these aren't complete like they should be.  Although these are all of
8753
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
8754
+; other conditions then these.  That is, (cond_exec ...) is not as well
8755
+; recognized as (if_then_else ...).  So we have to duplicate things to support
8756
+; both methods.
8757
+;
8758
+(define_cond_exec
8759 122 dgisselq
+       [(ne (reg:CC CC_REG) (const_int 0))]
8760 102 dgisselq
+       ""
8761
+       "(NZ)"
8762
+       [(set_attr "conditional" "yes")])
8763
+(define_cond_exec
8764 122 dgisselq
+       [(lt (reg:CC CC_REG) (const_int 0))]
8765 102 dgisselq
+       ""
8766
+       "(LT)"
8767
+       [(set_attr "conditional" "yes")])
8768
+(define_cond_exec
8769 122 dgisselq
+       [(eq (reg:CC CC_REG) (const_int 0))]
8770 102 dgisselq
+       ""
8771
+       "(Z)"
8772
+       [(set_attr "conditional" "yes")])
8773
+(define_cond_exec
8774 122 dgisselq
+       [(gt (reg:CC CC_REG) (const_int 0))]
8775 102 dgisselq
+       ""
8776
+       "(GT)"
8777
+       [(set_attr "conditional" "yes")])
8778
+(define_cond_exec
8779 122 dgisselq
+       [(ge (reg:CC CC_REG) (const_int 0))]
8780 102 dgisselq
+       ""
8781
+       "(GE)"
8782
+       [(set_attr "conditional" "yes")])
8783
+(define_cond_exec
8784 122 dgisselq
+       [(ltu (reg:CC CC_REG) (const_int 0))]
8785 102 dgisselq
+       ""
8786
+       "(C)"
8787
+       [(set_attr "conditional" "yes")])
8788
+;
8789
+;
8790
+;
8791
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8792
+;;
8793
+;; Conditional move instructions, since these won't accept conditional
8794
+;;     execution RTL
8795
+;;
8796
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8797
+;
8798
+; // Look for #define HAVE_conditional_move to understand how these might be
8799
+; // used.
8800
+;
8801
+(define_insn "set_zero_or_one<mode>"
8802
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8803
+                       (match_operator 1 "ordered_comparison_operator"
8804 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
8805 102 dgisselq
+                       (const_int 1) (const_int 0)))]
8806
+       ""
8807
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
8808
+       }
8809
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8810 127 dgisselq
+(define_expand "mov<mode>cc"
8811 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8812 127 dgisselq
+               (if_then_else:ZI (match_operand 1 "comparison_operator")
8813 102 dgisselq
+                       (match_operand:ZI 2 "general_operand" "rio")
8814
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
8815
+       ""
8816
+       {
8817 142 dgisselq
+       if (zip_expand_movsicc(operands[0], operands[1], operands[2], operands[3]))
8818
+               DONE;
8819
+       else
8820
+               FAIL;
8821 127 dgisselq
+       })
8822
+(define_insn_and_split "movsicc_bare"
8823
+       [(set (match_operand:SI 0 "register_operand" "=r")
8824
+               (if_then_else (match_operator 1 "ordered_comparison_operator"
8825
+                               [(reg:CC CC_REG) (const_int 0)])
8826
+                       (match_operand:SI 2 "general_operand" "rio")
8827
+                       (match_operand:SI 3 "register_operand" "0")))]
8828
+       "(zip_supported_condition(GET_CODE(operands[1])))"
8829
+       "#"
8830
+       "(reload_completed)"
8831
+       [(cond_exec (match_operator 1 "ordered_comparison_operator"
8832
+                               [(reg:CC CC_REG) (const_int 0)])
8833
+                       (set (match_dup 0) (match_dup 2)))]
8834
+       "" [(set_attr "predicable" "no")])
8835 102 dgisselq
+(define_insn "add<mode>cc"
8836
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
8837
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
8838 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8839 102 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
8840
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
8841
+                       (match_dup 0)))]
8842
+       ""
8843
+       {
8844
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
8845
+       }
8846
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8847
+;
8848
+;
8849
+;
8850
+; While an interesting approach, the following suffers from problems when the
8851
+; move amount is constant.  At anything less than four, moves should not require
8852
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
8853
+; are not required and should result in a hardcoded result.  Practically,
8854
+; though, this should really be a define_expand instruction, calling on the
8855 127 dgisselq
+; RTX's of all the respective subinstructions found below.  Or, perhaps, it is
8856
+; better as a subroutine?
8857 102 dgisselq
+;
8858
+;(define_insn "movmemSI"
8859
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
8860
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
8861
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
8862
+;              (match_operand 3 "" "")                 ;Alignment
8863
+;              (clobber (match_scratch:SI 4 "=r"))
8864
+;              (clobber (match_scratch:SI 5 "=r"))
8865
+;              (clobber (match_scratch:SI 6 "=r"))
8866
+;              (clobber (match_scratch:SI 7 "=r"))]
8867
+;      ""
8868
+;      "TEST\t1,%2
8869
+;      LOD.NZ\t%1,%4
8870
+;      STO.NZ\t%4,%0
8871
+;      ADD.NZ\t1,%0
8872
+;      ADD.NZ\t1,%1
8873
+;      TEST\t2,%2
8874
+;      LOD.NZ\t%1,%4
8875
+;      LOD.NZ\t1(%1),%5
8876
+;      STO.NZ\t%4,(%0)
8877
+;      STO.NZ\t%4,1(%0)
8878
+;      ADD.NZ\t2,%0
8879
+;      ADD.NZ\t2,%1
8880
+;      AND\t-4,%2
8881
+;      BZ\t.Lskp%=\n.Ltop%=:
8882
+;      LOD\t(%1),%4
8883
+;      LOD\t1(%1),%5
8884
+;      LOD\t2(%1,%6
8885
+;      LOD\t3(%1),%7
8886
+;      STO\t%4,(%1)
8887
+;      STO\t%5,1(%1)
8888
+;      STO\t%6,2(%1)
8889
+;      STO\t%7,3(%1)
8890
+;      SUB\t4,%2
8891
+;      BZ\t%.Lskp%=
8892
+;      BRA\t.Ltop%=\n.Lskp%=:"
8893
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8894
+;(define_insn "setmemsi"
8895
+;      [(parallel
8896
+;              [(set (mem:BLK
8897
+;                      (match_operand 0 "register_operand" "+r")); Destination
8898
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
8899
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
8900
+;              (match_operand 3 "" "")]
8901
+;      ""
8902
+;      "TEST\t1,%1
8903
+;      STO.NZ\t%2,(%0)
8904
+;      ADD.NZ\t1,%0
8905
+;      TEST\t2,%1
8906
+;      STO.NZ\t%2,(%0)
8907
+;      STO.NZ\t%2,1(%0)
8908
+;      ADD.NZ\t2,%0
8909
+;      AND\t-4,%1
8910
+;      BZ\t.Lskp%=\n.Ltop%=:\n
8911
+;      STO\t%2,(%0)
8912
+;      STO\t%2,1(%0)
8913
+;      STO\t%2,2(%0)
8914
+;      STO\t%2,3(%0)
8915
+;      SUB\t%4,%0
8916
+;      BZ\t.Lskp%=
8917
+;      BRA\t.Ltop%=\n.Lskp%=:"
8918
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8919
+;;
8920
+;
8921
+;
8922
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8923
+;;
8924
+;; Control flow instructions
8925
+;;
8926
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8927
+;
8928
+;
8929
+;
8930
+(define_expand "jump"
8931
+       [(set (pc)
8932
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
8933 127 dgisselq
+(define_insn "jump_const"
8934
+       [(set (pc)
8935 102 dgisselq
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
8936
+       ""
8937
+       "BRA    %0"
8938
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8939
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
8940
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8941
+               (label_ref (match_operand 0 "" "")))]
8942
+       ""
8943
+       "BRA    %0"
8944
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8945
+;
8946
+; This is really the same thing as an indirect jump ... the big difference
8947
+; is that the zip_address_operand_p checks for an "N" type condition, not an
8948
+; "M" type condition ... a bug, but one that works for now.  (The assembler
8949
+; should be able to catch and except on it ...)
8950
+;
8951
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8952
+(define_insn "jump_variable"
8953
+       [(set (pc)
8954
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
8955
+       ""
8956
+       "JMP    %0"
8957
+       [(set_attr "ccresult" "unchanged")])
8958
+;
8959
+; Indirect jumps ... both to registers, and registers plus offsets
8960
+;
8961
+(define_insn "indirect_jump"
8962
+       [(set (pc)
8963
+               (match_operand:SI 0 "register_operand" "r"))]
8964
+       ""
8965
+       "JMP    %0"
8966
+       [(set_attr "ccresult" "unchanged")])
8967
+(define_insn "indirect_jump_mem"
8968
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
8969
+       ""
8970
+       "LOD    %0,PC"
8971
+       [(set_attr "ccresult" "unchanged")])
8972
+(define_insn "indirect_jump_off"
8973
+       [(set (pc)
8974
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
8975
+                       (match_operand:SI 1 "const_int_operand" "M")))]
8976
+       ""
8977
+       "JMP    %1(%0)"
8978
+       [(set_attr "ccresult" "unchanged")])
8979
+;;
8980
+; cbranchsi4
8981
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
8982
+;;     Op 1&2 the operands of the compare instruction
8983
+;;     Op 3 is the jump label
8984
+;;
8985
+;;
8986
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
8987
+;;
8988
+(define_expand "cbranch<mode>4"
8989 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 1 "register_operand" "r")
8990
+               (match_operand:ZI 2 "zip_opb_operand_p" "rO")))
8991 102 dgisselq
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
8992 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8993 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
8994
+                       (pc)))]
8995
+       ""
8996
+       {
8997 125 dgisselq
+               if (true) {
8998 117 dgisselq
+               extern void zip_debug_rtx_pfx(const char *, const_rtx);
8999 102 dgisselq
+               //; Two branches give us no end of difficulty when implementing.
9000
+               //; Let's check for these two branch codes, and swap the
9001
+               //; comparison to simplify them.
9002 122 dgisselq
+               //; fprintf(stderr, "CBRANCH\n");
9003
+               //; zip_debug_rtx_pfx("- CMP: ", operands[0]);
9004
+               //; zip_debug_rtx_pfx("- A  : ", operands[1]);
9005
+               //; zip_debug_rtx_pfx("- B  : ", operands[2]);
9006
+               //; zip_debug_rtx_pfx("- JMP: ", operands[3]);
9007 117 dgisselq
+               //; Can we do better if we reverse some compares?
9008 102 dgisselq
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
9009 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
9010
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
9011 102 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9012
+                       DONE;
9013
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
9014 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
9015
+                       emit_insn(gen_cmpsi_off(operands[2], operands[1],
9016
+                                       GEN_INT(1)));
9017
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9018 102 dgisselq
+                       DONE;
9019 117 dgisselq
+               } else if ((GET_CODE(operands[0])==LE)&&(REG_P(operands[2]))) {
9020 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(LE,?,REG,?)\n");
9021 117 dgisselq
+                       //; Swap operands, turn into a GTE compare
9022 122 dgisselq
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
9023 117 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ge(operands[3]));
9024
+                       DONE;
9025 102 dgisselq
+               } // ; Otherwise ... just handle the branch normally
9026
+
9027
+               //; Except ... we can do better for some instructions, such as
9028
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
9029
+               //; would be difficult to explain to users why MIN_INT didn't
9030
+               //; compare properly.  Hence we only adjust constant integers.
9031
+               //;
9032 122 dgisselq
+               if (GET_CODE(operands[0])==LE) {
9033
+                       if ((CONST_INT_P(operands[2]))
9034 117 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
9035 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
9036
+                               emit_insn(gen_cmpsi(operands[1],
9037
+                                               GEN_INT(INTVAL(operands[2])+1)));
9038
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9039
+                               DONE;
9040
+                       //; Now for the controversial ones--where we add one
9041
+                       //; when it may or may not be permissable.  For now, we
9042
+                       //; just do it anyway and postpone the philosophical
9043
+                       //; discussion for later.
9044
+                       } else if (REG_P(operands[2])) {
9045
+                               emit_insn(gen_cmpsi_off(operands[1],
9046
+                                               operands[2],GEN_INT(1)));
9047
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9048
+                               DONE;
9049
+                       } else if ((GET_CODE(operands[2])==PLUS)
9050
+                               &&(REG_P(XEXP(operands[2],0)))
9051
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
9052
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
9053
+                               emit_insn(gen_cmpsi_off(operands[1],
9054
+                                               XEXP(operands[2],0),
9055
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
9056
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9057
+                               DONE;
9058
+                       }
9059
+               } else if (GET_CODE(operands[0])==LEU) {
9060
+                       if ((CONST_INT_P(operands[2]))
9061 102 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
9062 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
9063
+                               emit_insn(gen_cmpsi(operands[1],
9064
+                                               GEN_INT(INTVAL(operands[2])+1)));
9065
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9066
+                               DONE;
9067
+                       //; Now for the controversial ones--this time having
9068
+                       //; to do with unsigned compares.
9069
+                       } else if (REG_P(operands[2])) {
9070
+                               emit_insn(gen_cmpsi_off(operands[1],
9071
+                                                       operands[2],GEN_INT(1)));
9072
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9073
+                               DONE;
9074
+                       } else if ((GET_CODE(operands[2])==PLUS)
9075
+                               &&(REG_P(XEXP(operands[2],0)))
9076
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
9077
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
9078
+                               emit_insn(gen_cmpsi_off(operands[1],
9079
+                                       XEXP(operands[2],0),
9080
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
9081
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9082
+                               DONE;
9083
+                       }
9084 124 dgisselq
+               }}
9085 102 dgisselq
+       })
9086
+(define_insn "cbranch_jmp_eq"
9087 122 dgisselq
+       [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
9088 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9089
+                (pc)))]
9090
+       ""
9091
+       "BZ\t%0"
9092
+       [(set_attr "predicable" "no")
9093
+               (set_attr "conditional" "yes")
9094
+               (set_attr "ccresult" "unchanged")])
9095
+(define_insn "cbranch_jmp_neq"
9096 122 dgisselq
+       [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
9097 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9098
+                (pc)))]
9099
+       ""
9100
+       "BNZ\t%0"
9101
+       [(set_attr "predicable" "no")
9102
+               (set_attr "conditional" "yes")
9103
+               (set_attr "ccresult" "unchanged")])
9104
+(define_insn "cbranch_jmp_lt"
9105 122 dgisselq
+       [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9106 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9107
+                (pc)))]
9108
+       ""
9109
+       "BLT\t%0"
9110
+       [(set_attr "predicable" "no")
9111
+               (set_attr "conditional" "yes")
9112
+               (set_attr "ccresult" "unchanged")])
9113
+(define_insn "cbranch_jmp_le"
9114 122 dgisselq
+       [(set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
9115 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9116
+                (pc)))]
9117
+       ""
9118
+       "BLT\t%0
9119
+       BZ\t%0"
9120
+       [(set_attr "predicable" "no")
9121
+               (set_attr "conditional" "yes")
9122
+               (set_attr "ccresult" "unchanged")])
9123
+(define_insn "cbranch_jmp_gt"
9124 122 dgisselq
+       [(set (pc) (if_then_else (gt (reg:CC CC_REG) (const_int 0))
9125 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9126
+                (pc)))]
9127
+       ""
9128
+       "BGT\t%0"
9129
+       [(set_attr "predicable" "no")
9130
+               (set_attr "conditional" "yes")
9131
+               (set_attr "ccresult" "unchanged")])
9132
+(define_insn "cbranch_jmp_ge"
9133 122 dgisselq
+       [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
9134 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9135
+                (pc)))]
9136
+       ""
9137
+       "BGE\t%0"
9138
+       [(set_attr "predicable" "no")
9139
+               (set_attr "conditional" "yes")
9140
+               (set_attr "ccresult" "unchanged")])
9141
+(define_insn "cbranch_jmp_ltu"
9142 122 dgisselq
+       [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9143 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9144
+                (pc)))]
9145
+       ""
9146
+       "BC\t%0"
9147
+       [(set_attr "predicable" "no")
9148
+               (set_attr "conditional" "yes")
9149
+               (set_attr "ccresult" "unchanged")])
9150
+(define_insn "cbranch_jmp_gtu"
9151 122 dgisselq
+       [(set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9152 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9153 122 dgisselq
+                (pc)))
9154
+       ;(clobber (reg:CC CC_REG))
9155
+       ]
9156 102 dgisselq
+       ""      ; Flip the condition, and then we can jump
9157 127 dgisselq
+       "BC\t.Lgtu%=\n\tBZ\t.Lgtu%=\n\tBRA\t%0\n.Lgtu%=:"
9158 102 dgisselq
+       [(set_attr "predicable" "no")
9159
+               (set_attr "conditional" "yes")
9160
+               (set_attr "ccresult" "unknown")])
9161
+(define_insn "cbranch_jmp_leu"
9162 122 dgisselq
+       [(set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9163 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9164
+                (pc)))]
9165
+       ""      ; Need to check for both LTU (i.e. C) and Z
9166
+       "BC\t%0
9167
+       BZ\t%0"
9168
+       [(set_attr "predicable" "no")
9169
+               (set_attr "conditional" "yes")
9170
+               (set_attr "ccresult" "unchanged")])
9171
+(define_insn "cbranch_jmp_geu"
9172 122 dgisselq
+       [(set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9173 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9174 122 dgisselq
+                (pc)))
9175
+       ;(clobber (reg:CC CC_REG))
9176
+       ]
9177 127 dgisselq
+       ""
9178
+       "BC\t.Lgeu%=\n\tBRA\t%0\n.Lgeu%=:"
9179 102 dgisselq
+       [(set_attr "predicable" "no")
9180
+               (set_attr "conditional" "yes")
9181
+               (set_attr "ccresult" "unknown")])
9182
+(define_insn "cbranchdi4"
9183
+       [(set (pc) (if_then_else
9184
+               (match_operator 0 "ordered_comparison_operator"
9185
+                       [(match_operand:DI 1 "register_operand" "r")
9186 122 dgisselq
+                               (match_operand:DI 2 "register_operand" "r")])
9187 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
9188
+                       (pc)))
9189 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9190 102 dgisselq
+       ""
9191
+       {
9192
+               switch(GET_CODE(operands[0])) {
9193
+               case EQ:
9194
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
9195
+               case NE:
9196
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
9197
+               case LE:
9198
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
9199
+               case GT:
9200
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
9201
+               case LT:
9202
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
9203
+               case GE:
9204
+                       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%=:";
9205
+               case LTU:
9206
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
9207
+               case LEU:
9208
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
9209
+               case GTU:
9210
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
9211
+               case GEU:
9212
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
9213
+               default:
9214
+                       gcc_unreachable();
9215
+               }
9216
+       }
9217
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9218
+;
9219
+;
9220
+;
9221
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9222
+;;
9223
+;; Subroutine call
9224
+;;
9225
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9226
+;
9227
+;
9228
+; There are two types of calls: "call" and "call_value".
9229
+;
9230
+; Each of these types of calls are then expanded into one of:
9231
+;
9232
+;      _const          - A call to a constant address, such as a symbol
9233
+;                      reference or a fixed location
9234
+;
9235
+;      _label          - This should be the same as _const, except that for
9236
+;                      some reason the RTL and matching rules are separate.
9237
+;                      Hence we have a separate rule for this.
9238
+;
9239
+;      _mem            - The memory address we wish to jump to is stored in
9240
+;                      memory somewhere, and we have only a pointer.  In this
9241
+;                      case, we load that pointer straight to the PC and go.
9242
+;
9243
+;      _var            - The address to jump to is given as an offset to a
9244
+;                      register, such as X+R3.  This is an indirect jump.
9245
+;                      Although we support it, it does require different RTL
9246
+;                      code.
9247
+;
9248
+(define_expand "call"
9249
+       [(call (match_operand 0 "" "")
9250
+               (match_operand 1 "" ""))]
9251
+       ""
9252
+       {
9253
+               if (MEM_P(operands[0])) {
9254
+                       // This should always be the case
9255
+                       rtx addr = XEXP(operands[0],0);
9256
+                       if (zip_const_address_operand_p(addr, SImode)) {
9257 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_void_call_const()\n");
9258 102 dgisselq
+                               emit_call_insn(gen_void_call_const(addr,
9259
+                                               operands[1]));
9260
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
9261
+                                                       XEXP(addr,0)))) {
9262
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
9263
+                                                                operands[1]));
9264
+                       } else {
9265
+                               emit_call_insn(gen_void_call_var(addr,
9266
+                                                                operands[1]));
9267
+                       }
9268
+                       DONE;
9269
+               }
9270
+       })
9271
+;
9272
+;
9273
+;
9274
+; How do we want to do this better?
9275
+;      Replace the RTL w/
9276
+;              return_label= gen_label_rtx();
9277
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
9278
+;                      gen_rtx_REG(zip_PC),return_label));
9279
+;              emit_jump(label_rtx(
9280
+;
9281
+;              emit_label(return_label);
9282
+;
9283
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
9284
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
9285
+; label gets removed and the call gets lost.  Hence we do it this way (below).
9286
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
9287
+; recognize as such, but for now we'll use .Lcall# as our label.
9288
+;
9289
+(define_insn "void_call_const"
9290 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9291 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9292 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9293
+               (clobber (reg:CC CC_REG))]
9294 102 dgisselq
+       ""
9295
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
9296
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9297
+(define_insn "void_call_mem"
9298 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9299 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9300 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9301
+               (clobber (reg:CC CC_REG))]
9302 102 dgisselq
+       ""
9303
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
9304
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9305
+;
9306
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9307
+(define_insn "void_call_var"
9308 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9309 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9310 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9311
+               (clobber (reg:CC CC_REG))]
9312 102 dgisselq
+       ""
9313
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
9314
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9315
+(define_expand "call_value"
9316 122 dgisselq
+       [(parallel [(set (reg:SI RTNV_REG)
9317 102 dgisselq
+               (call (match_operand:SI 1 "" "")
9318 111 dgisselq
+                       (match_operand 2 "const_int_operand" "n")))
9319 122 dgisselq
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))
9320
+       (clobber (reg:CC CC_REG))])]
9321 102 dgisselq
+       ""
9322
+       {
9323 122 dgisselq
+               //; extern void zip_debug_rtx(const_rtx);
9324
+               //; fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
9325
+               //; zip_debug_rtx(operands[1]);
9326 102 dgisselq
+               if (MEM_P(operands[1])) {
9327 122 dgisselq
+                       //; fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
9328
+                       //; zip_debug_rtx(operands[1]);
9329
+                       //; This should always be the case
9330 102 dgisselq
+                       rtx addr = XEXP(operands[1],0);
9331
+                       if (zip_const_address_operand_p(addr, SImode)) {
9332 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_reg_call_const()\n");
9333 102 dgisselq
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
9334
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
9335 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9336 102 dgisselq
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
9337
+                       } else {
9338 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9339 102 dgisselq
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
9340
+                       }
9341
+                       DONE;
9342
+               }
9343
+       })
9344
+(define_insn "reg_call_const"
9345 122 dgisselq
+       [(set (reg:SI RTNV_REG)
9346 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9347 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
9348 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9349
+               (clobber (reg:CC CC_REG))]
9350 102 dgisselq
+       ""
9351
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
9352
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9353
+(define_insn "reg_call_mem"
9354
+       [(set (reg:SI RTNV_REG)
9355 111 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9356
+                       (match_operand 1 "const_int_operand" "n")))
9357 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9358
+               (clobber (reg:CC CC_REG))]
9359 102 dgisselq
+       ""
9360 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tLOD\t%0,PC\n.Lcall%=:"
9361 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9362 111 dgisselq
+;
9363 102 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9364
+(define_insn "reg_call_var"
9365 122 dgisselq
+       [(set (reg:SI RTNV_REG)
9366 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9367 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
9368 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9369
+               (clobber (reg:CC CC_REG))]
9370 102 dgisselq
+       ""
9371 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tJMP\t%0\n.Lcall%=:"
9372 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9373
+;
9374
+;
9375
+;
9376
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9377
+;;
9378
+;; Frame manipulation RTX
9379
+;;
9380
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9381
+;
9382
+;
9383
+;
9384
+(define_expand "prologue"
9385
+       [(const_int 0)]
9386
+       ""
9387
+       "{ zip_expand_prologue(); DONE; }")
9388
+(define_expand "epilogue"
9389
+       [(return)]
9390
+       ""
9391
+       "{ zip_expand_epilogue(); DONE; }")
9392
+(define_expand "return" ; In order to use the function predicate, this *must*
9393
+       [(return)]      ; be a define_expand
9394
+       "zip_use_return_insn()")
9395
+       ; "JMP  R0"
9396
+       ; [(set_attr "ccresult" "unchanged")])
9397
+(define_insn "*return" ; A "*" -- means it cannot be called from C
9398
+       [(return)]
9399
+       ""
9400
+       "JMP    R0"
9401
+       [(set_attr "ccresult" "unchanged")])
9402
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
9403
+       [(simple_return)]
9404
+       ""
9405
+       "JMP    R0"
9406
+       [(set_attr "ccresult" "unchanged")])
9407
+;
9408
+;
9409
+;
9410
+;;;;;;;;;;;;;;;;;;;;;;;;;;
9411
+;;
9412
+;; Zip Builtin Functions
9413
+;;
9414
+;;;;;;;;;;;;;;;;;;;;;;;;;;
9415
+;
9416
+;
9417
+;
9418
+(define_insn "zip_rtu"
9419
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
9420 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9421 102 dgisselq
+       "(!ZIP_USER)"
9422
+       "RTU"
9423
+       [(set_attr "ccresult" "unknown")])
9424
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
9425
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
9426 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9427 102 dgisselq
+       "(!ZIP_USER)"
9428
+       "HALT"
9429
+       [(set_attr "ccresult" "unknown")])
9430
+(define_insn "zip_idle"
9431
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
9432 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9433 102 dgisselq
+       ""
9434
+       "WAIT"
9435
+       [(set_attr "ccresult" "unknown")])
9436
+(define_insn "zip_syscall"
9437
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
9438
+       ""
9439
+       "CLR\tCC"
9440
+       [(set_attr "ccresult" "unknown")])
9441
+;
9442
+;
9443
+; Operator "save_context"
9444
+;
9445 117 dgisselq
+;      Okay, so we're not really reading and writing operand 0, %0, however
9446
+;      if we don't list it as a "+r" register, the compiler may allocate it
9447
+;      among the other registers, thus we clobber it in the middle of the
9448
+;      operation before the task is complete.
9449 102 dgisselq
+;
9450
+(define_insn "zip_save_context"
9451 117 dgisselq
+       [(unspec_volatile
9452
+                       [ (match_operand:SI 0 "register_operand" "+r") ]
9453 102 dgisselq
+                       UNSPEC_SAVE_CONTEXT)
9454
+               (clobber (match_scratch:SI 1 "=r"))
9455
+               (clobber (match_scratch:SI 2 "=r"))
9456
+               (clobber (match_scratch:SI 3 "=r"))
9457 117 dgisselq
+               (clobber (match_scratch:SI 4 "=r"))]
9458 102 dgisselq
+       "(!ZIP_USER)"
9459
+       "MOV\tuR0,%1
9460
+       MOV\tuR1,%2
9461
+       MOV\tuR2,%3
9462
+       MOV\tuR3,%4
9463
+       STO\t%1,%0
9464
+       STO\t%2,1(%0)
9465
+       STO\t%3,2(%0)
9466
+       STO\t%4,3(%0)
9467
+       MOV\tuR4,%1
9468
+       MOV\tuR5,%2
9469
+       MOV\tuR6,%3
9470
+       MOV\tuR7,%4
9471
+       STO\t%1,4(%0)
9472
+       STO\t%2,5(%0)
9473
+       STO\t%3,6(%0)
9474
+       STO\t%4,7(%0)
9475
+       MOV\tuR8,%1
9476
+       MOV\tuR9,%2
9477
+       MOV\tuR10,%3
9478
+       MOV\tuR11,%4
9479
+       STO\t%1,8(%0)
9480
+       STO\t%2,9(%0)
9481
+       STO\t%3,10(%0)
9482
+       STO\t%4,11(%0)
9483
+       MOV\tuR12,%1
9484
+       MOV\tuSP,%2
9485
+       MOV\tuCC,%3
9486
+       MOV\tuPC,%4
9487
+       STO\t%1,12(%0)
9488
+       STO\t%2,13(%0)
9489
+       STO\t%3,14(%0)
9490
+       STO\t%4,15(%0)"
9491 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
9492 117 dgisselq
+;
9493
+; See the comment above about why operand 0, %0, *must* be a "+r" operand,
9494
+; even though we don't really read (or change) its value throughout this
9495
+; operation.
9496
+;
9497 102 dgisselq
+(define_insn "zip_restore_context"
9498
+       [(unspec_volatile [
9499 117 dgisselq
+               (match_operand:SI 0 "register_operand" "+r")] UNSPEC_RESTORE_CONTEXT)
9500 102 dgisselq
+       (clobber (match_scratch:SI 1 "=r"))
9501
+       (clobber (match_scratch:SI 2 "=r"))
9502
+       (clobber (match_scratch:SI 3 "=r"))
9503 117 dgisselq
+       (clobber (match_scratch:SI 4 "=r"))]
9504 102 dgisselq
+       "(!ZIP_USER)"
9505
+       "LOD\t0(%0),%1
9506
+       LOD\t1(%0),%2
9507
+       LOD\t2(%0),%3
9508
+       LOD\t3(%0),%4
9509
+       MOV\t%1,uR0
9510
+       MOV\t%2,uR1
9511
+       MOV\t%3,uR2
9512
+       MOV\t%4,uR3
9513
+       LOD\t4(%0),%1
9514
+       LOD\t5(%0),%2
9515
+       LOD\t6(%0),%3
9516
+       LOD\t7(%0),%4
9517
+       MOV\t%1,uR4
9518
+       MOV\t%2,uR5
9519
+       MOV\t%3,uR6
9520
+       MOV\t%4,uR7
9521
+       LOD\t8(%0),%1
9522
+       LOD\t9(%0),%2
9523
+       LOD\t10(%0),%3
9524
+       LOD\t11(%0),%4
9525
+       MOV\t%1,uR8
9526
+       MOV\t%2,uR9
9527
+       MOV\t%3,uR10
9528
+       MOV\t%4,uR11
9529
+       LOD\t12(%0),%1
9530
+       LOD\t13(%0),%2
9531
+       LOD\t14(%0),%3
9532
+       LOD\t15(%0),%4
9533
+       MOV\t%1,uR12
9534
+       MOV\t%2,uSP
9535
+       MOV\t%3,uCC
9536
+       MOV\t%4,uPC"
9537 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
9538 102 dgisselq
+(define_insn "zip_bitrev"
9539
+       [(set (match_operand:SI 0 "register_operand" "=r")
9540
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
9541
+       ]
9542
+       ""
9543
+       "BREV\t%1,%0"
9544 122 dgisselq
+       [(set_attr "ccresult" "unchanged")])
9545 102 dgisselq
+(define_insn "zip_cc"
9546
+       [(set (match_operand:SI 0 "register_operand" "=r")
9547
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9548
+       ""
9549
+       "MOV\tCC,%0"
9550
+       [(set_attr "ccresult" "unchanged")])
9551 117 dgisselq
+(define_insn "zip_ucc"
9552
+       [(set (match_operand:SI 0 "register_operand" "=r")
9553
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETUCC))]
9554
+       ""
9555
+       "MOV\tuCC,%0"
9556
+       [(set_attr "ccresult" "unchanged")])
9557 111 dgisselq
+(define_insn "zip_cc_sto"
9558
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
9559 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9560 111 dgisselq
+       ""
9561
+       "STO\tCC,(%0)"
9562
+       [(set_attr "ccresult" "unchanged")])
9563
+(define_insn "zip_cc_sto_off"
9564
+       [(set (mem:SI (plus:SI
9565
+                       (match_operand:SI 0 "register_operand" "r")
9566
+                       (match_operand:SI 1 "const_int_operand" "N")))
9567 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9568 111 dgisselq
+       ""
9569
+       "STO\tCC,%1(%0)"
9570
+       [(set_attr "ccresult" "unchanged")])
9571 102 dgisselq
+(define_insn "ldilo"
9572
+       [(set (match_operand:SI 0 "register_operand" "=r")
9573
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
9574
+       ""
9575
+       "LDILO  %1,%0"
9576
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9577
+
9578
+;
9579
+;
9580
+;
9581
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9582
+;;
9583
+;; Floating point Op-codes
9584
+;;
9585
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9586
+;
9587
+;
9588
+;
9589
+(define_insn "addsf3"
9590
+       [(set (match_operand:SF 0 "register_operand" "=r")
9591
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
9592 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9593
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9594 102 dgisselq
+       "(ZIP_FPU)"
9595
+       "FPADD  %2,%0"
9596
+       [(set_attr "ccresult" "unknown")])
9597
+(define_insn "subsf3"
9598
+       [(set (match_operand:SF 0 "register_operand" "=r")
9599
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
9600 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9601
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9602 102 dgisselq
+       "(ZIP_FPU)"
9603
+       "FPSUB  %2,%0"
9604
+       [(set_attr "ccresult" "unknown")])
9605
+(define_insn "mulsf3"
9606
+       [(set (match_operand:SF 0 "register_operand" "=r")
9607
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
9608 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9609
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9610 102 dgisselq
+       "(ZIP_FPU)"
9611
+       "FPMUL  %2,%0"
9612
+       [(set_attr "ccresult" "unknown")])
9613
+(define_insn "divsf3"
9614
+       [(set (match_operand:SF 0 "register_operand" "=r")
9615
+               (div:SF (match_operand:SF 1 "register_operand" "0")
9616 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9617
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9618 102 dgisselq
+       "(ZIP_FPU)"
9619
+       "FPDIV  %2,%0"
9620
+       [(set_attr "ccresult" "unknown")])
9621 111 dgisselq
+(define_expand "negsf2"
9622
+       [(set (match_operand:SF 0 "register_operand" "=r")
9623
+               (neg:SF (match_operand:SF 1 "register_operand" "0")))
9624
+       ]
9625
+       ""
9626
+       {
9627
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
9628
+               if (can_create_pseudo_p()) {
9629
+                       rtx tmp = gen_reg_rtx(SImode);
9630
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
9631 122 dgisselq
+                       emit_insn(gen_xorsi3(operands[0], operands[0], tmp));
9632 111 dgisselq
+                       DONE;
9633
+               } else {
9634
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9635 122 dgisselq
+                       emit_insn(gen_iorsi3(operands[0], operands[0],
9636
+                               gen_int_mode(1,SImode)));
9637 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9638
+                       DONE;
9639
+               }
9640
+       })
9641
+(define_expand "abssf2"
9642 122 dgisselq
+       [(set (match_operand:SF 0 "register_operand" "=r")
9643
+               (abs:SF (match_operand:SF 1 "register_operand" "0")))
9644 111 dgisselq
+       ]
9645
+       ""
9646
+       {
9647
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
9648
+               if (can_create_pseudo_p()) {
9649
+                       rtx tmp = gen_reg_rtx(SImode);
9650
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
9651 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0], tmp));
9652 111 dgisselq
+                       DONE;
9653
+               } else {
9654
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9655 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0],
9656
+                               gen_int_mode(-2,SImode)));
9657 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9658
+                       DONE;
9659
+               }
9660
+       })
9661 102 dgisselq
+;
9662
+;
9663
+;
9664
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9665
+;;
9666
+;; Trap Instruction
9667
+;;
9668
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9669
+;
9670
+;
9671
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
9672
+; *nothing* should ever trap, and so we should never get here.  However, the
9673
+; compiler seems to want a trap instruction for some reason.  (It keeps us
9674
+; from calling the abort() function, if we don't define these ...)  So let's
9675
+; just grab onto the break instruction and declare it to be a trap instruction
9676
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
9677
+; will work for both user and system instructions.
9678
+;
9679
+(define_insn "trap"
9680
+       [(trap_if (const_int 1) (const_int 0))]
9681
+       ""
9682
+       "BREAK"
9683
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9684
+;
9685
+(define_expand "ctrap<mode>4"
9686 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9687
+               (match_operand:ZI 1 "register_operand" "r")
9688
+               (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
9689 102 dgisselq
+       (trap_if (match_operator 0 "ordered_comparison_operator"
9690 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9691 102 dgisselq
+                       (match_operand 3 "const_int_operand" "O"))]
9692
+       ""
9693
+       )
9694
+(define_insn "trapif"
9695
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
9696 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9697 102 dgisselq
+                       (match_operand 1 "const_int_operand" "O"))]
9698
+       ""
9699
+       "BREAK\t%1"
9700
+       [(set_attr "predicable" "no")])
9701
+;
9702
+;
9703
+;
9704
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9705
+;;
9706
+;; Unimplemented (or not yet implemented) RTL Codes
9707
+;;
9708
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9709
+;
9710
+;
9711
+;
9712
+;(define_insn "sync_compare_and_swapsi"
9713
+;      [(set ...
9714
+;              )]
9715
+;      "(ZIP_ATMOC)"
9716
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
9717
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
9718
+;      CMP     %0,%2   DCD-valid
9719
+;      STO.Z   %2,%1   PF-valid
9720
+;
9721
+;(define_insn "sync_lock_test_and_setsi"
9722
+;      LOCK
9723
+;      LOD     %1,%0
9724
+;      STO     %0,%1
9725
+;
9726
+;(define_insn "sync_lock_releasesi"
9727
+;      STO     %1,%0
9728
+;
9729
+;
9730
+;(define_insn "negvsi3"
9731
+;      "MOV    %1,%0
9732
+;      XOR     -1,%0
9733
+;      ADD     1,%0
9734
+;      BV      %2"
9735
+;      "")
9736 124 dgisselq
+;
9737
+; Match:
9738
+;      CMP     R1,R0
9739
+;      BGTU    lbl
9740
+; Transform to:
9741
+;      CMP     R0,R1
9742
+;      BC      lbl
9743
+;
9744 117 dgisselq
+(define_peephole2
9745 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9746
+               (match_operand:SI 0 "register_operand")
9747
+               (match_operand:SI 1 "register_operand")))
9748
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9749
+                       (label_ref (match_operand 2 ""))
9750 117 dgisselq
+                       (pc)))]
9751 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9752 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1) (match_dup 0)))
9753
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9754 117 dgisselq
+                       (label_ref (match_dup 2))
9755
+                       (pc)))]
9756
+       "")
9757 127 dgisselq
+(define_peephole2
9758
+       [(match_scratch:SI 3 "=r")
9759
+       (set (reg:CC CC_REG) (compare:CC
9760
+               (match_operand:SI 0 "register_operand")
9761
+               (match_operand 1 "const_int_operand")))
9762
+       (match_dup 3)
9763
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9764
+                       (label_ref (match_operand 2 ""))
9765
+                       (pc)))]
9766
+       "(ZIP_PEEPHOLE)"
9767
+       [(set (match_dup 3) (match_dup 1))
9768
+       (set (reg:CC CC_REG) (compare:CC (match_dup 3) (match_dup 0)))
9769
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9770
+                       (label_ref (match_dup 2))
9771
+                       (pc)))]
9772
+       "")
9773
+;(define_peephole2
9774
+;      [(set (reg:CC CC_REG) (compare:CC
9775
+;              (match_operand:SI 0 "register_operand")
9776
+;              (match_operand 1 "const_int_operand")))
9777
+;      (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9778
+;                      (label_ref (match_operand 2 ""))
9779
+;                      (pc)))]
9780
+;      ""
9781
+;      [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9782
+;      (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9783
+;                      (label_ref (match_dup 2))
9784
+;                      (pc)))]
9785
+;      "operands[1] = GEN_INT(INTVAL(operands[1])-1);")
9786 124 dgisselq
+;
9787
+;
9788
+; Match:
9789
+;      CMP     R1,R0
9790
+;      BGEU    lbl
9791
+; Transform to:
9792
+;      CMP     1(R0),R1
9793
+;      BC      lbl
9794
+;
9795 117 dgisselq
+(define_peephole2
9796 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9797
+               (match_operand:SI 0 "register_operand")
9798
+               (match_operand:SI 1 "register_operand")))
9799
+       (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9800
+                       (label_ref (match_operand 2 ""))
9801 117 dgisselq
+                       (pc)))]
9802 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9803 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9804 146 dgisselq
+               (match_dup 1) (plus:SI (match_dup 0) (const_int 1))))
9805 122 dgisselq
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9806 117 dgisselq
+                       (label_ref (match_dup 2))
9807
+                       (pc)))]
9808
+       "")
9809 124 dgisselq
+;
9810
+;
9811
+; Match:
9812
+;      CMP     R1,R0
9813
+;      BGE     lbl
9814
+; Transform to:
9815
+;      CMP     1(R0),R1
9816
+;      BLT     lbl
9817 142 dgisselq
+; ... why?  when we support a BGE instruction?
9818
+;(define_peephole2
9819
+       ;[(set (reg:CC CC_REG) (compare:CC
9820
+               ;(match_operand:SI 0 "register_operand")
9821
+               ;(match_operand:SI 1 "register_operand")))
9822
+       ;(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
9823
+                       ;(label_ref (match_operand 2 ""))
9824
+                       ;(pc)))]
9825
+       ;"(ZIP_PEEPHOLE)"
9826
+       ;[(set (reg:CC CC_REG) (compare:CC (match_dup 1)
9827
+                       ;(plus:SI (match_dup 0) (const_int 1))))
9828
+       ;(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9829
+                       ;(label_ref (match_dup 2))
9830
+                       ;(pc)))]
9831
+       ;"")
9832 124 dgisselq
+;
9833
+;
9834
+; Match:
9835
+;      CMP     R1,R0
9836
+;      BLEU    lbl
9837
+; Transform to:
9838
+;      CMP     1(R1),R0
9839 142 dgisselq
+;      BC      lbl
9840 124 dgisselq
+;
9841 117 dgisselq
+(define_peephole2
9842 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9843
+               (match_operand:SI 0 "register_operand" "")
9844 117 dgisselq
+               (match_operand:SI 1 "register_operand" "")))
9845 122 dgisselq
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9846 117 dgisselq
+                       (label_ref (match_operand 2 "" ""))
9847
+                       (pc)))]
9848 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9849 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
9850 146 dgisselq
+                       (plus:SI (match_dup 1) (const_int 1))))
9851 122 dgisselq
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9852 117 dgisselq
+                       (label_ref (match_dup 2))
9853
+                       (pc)))]
9854
+       "")
9855
+;
9856 142 dgisselq
+;
9857
+;
9858
+; Match:
9859
+;      CMP     R1,R0
9860
+;      BLE     lbl
9861
+; Transform to:
9862
+;      CMP     1(R1),R0
9863
+;      BLT     lbl
9864
+;
9865 127 dgisselq
+(define_peephole2
9866
+       [(set (reg:CC CC_REG)
9867
+               (compare:CC (match_operand:SI 0 "register_operand" "")
9868
+                       (match_operand:SI 1 "const_int_operand" "")))
9869
+       (set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
9870
+                       (label_ref (match_operand 2 "" ""))
9871
+                       (pc)))]
9872
+       "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
9873
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9874
+       (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9875
+                       (label_ref (match_dup 2))
9876
+                       (pc)))]
9877
+       "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
9878 142 dgisselq
+;
9879
+; Match:
9880
+;      CMP     R1,R0
9881
+;      BLEU    lbl
9882
+; Transform to:
9883
+;      CMP     1(R1),R0
9884
+;      BC(LTU) lbl
9885
+;
9886 127 dgisselq
+(define_peephole2
9887
+       [(set (reg:CC CC_REG)
9888
+               (compare:CC (match_operand:SI 0 "register_operand" "")
9889
+                       (match_operand:SI 1 "const_int_operand" "")))
9890
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9891
+                       (label_ref (match_operand 2 "" ""))
9892
+                       (pc)))]
9893
+       "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
9894
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
9895 142 dgisselq
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9896 127 dgisselq
+                       (label_ref (match_dup 2))
9897
+                       (pc)))]
9898
+       "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
9899 102 dgisselq
+;
9900 117 dgisselq
+;
9901
+;
9902
+;
9903 127 dgisselq
+; Match:
9904
+;      (parallel [(set () ()) (clobber (CC))])
9905
+;      (compare () ())
9906
+; Transform to:
9907
+;      (parallel [(set () ()) (set (CC) (0))]
9908
+;      (compare () ())
9909 117 dgisselq
+;
9910 127 dgisselq
+(define_peephole2
9911
+       [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
9912
+               (clobber (reg:CC CC_REG))])
9913
+       (set (reg:CC CC_REG) (compare:CC (match_operand:SI 2 "")
9914
+                       (match_operand:SI 3 "")))]
9915
+       "(ZIP_PEEPHOLE)&&zip_insn_sets_cc(insn)"
9916
+       [(parallel [(set (match_dup 0) (match_dup 1))
9917
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9918
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (match_dup 3)))]
9919
+       "")
9920
+;
9921
+;
9922
+;
9923 122 dgisselq
+; Match:
9924 127 dgisselq
+;      (parallel [(set () ()) (clobber (CC))])
9925
+;      (set () ())
9926
+;      (compare () ())
9927
+; Transform to:
9928
+;      (parallel [(set () ()) (set (CC) (0))]
9929
+;      (set () ())
9930
+;      (compare () ())
9931
+;
9932
+(define_peephole2
9933
+       [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
9934
+               (clobber (reg:CC CC_REG))])
9935
+       (set (match_operand 2 "") (match_operand 3 ""))
9936
+       (set (reg:CC CC_REG) (compare:CC (match_operand:SI 4 "")
9937
+                       (match_operand:SI 5 "")))]
9938
+       "(ZIP_PEEPHOLE)&&(zip_insn_sets_cc(insn))&&((!REG_P(operands[2]))||(REGNO(operands[2])!=CC_REG))"
9939
+       [(parallel [(set (match_dup 0) (match_dup 1))
9940
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9941
+       (set (match_dup 2) (match_dup 3))
9942
+       (set (reg:CC CC_REG) (compare:CC (match_dup 4) (match_dup 5)))]
9943
+       "")
9944
+;
9945
+;
9946
+;
9947
+; Match:
9948 122 dgisselq
+;      MOV A(R1),R3
9949
+;      CMP R3,R0
9950
+;      (R3 is dead)
9951
+; Transform to:
9952
+;      CMP A(R1),R0
9953
+;
9954
+(define_peephole2
9955
+       [(set (match_operand:SI 3 "register_operand")
9956
+               (plus:SI (match_operand:SI 1 "register_operand")
9957
+                       (match_operand:SI 2 "zip_mvimm_operand_p")))
9958
+       (set (reg:CC CC_REG)
9959
+               (compare:CC (match_operand:SI 0 "register_operand")
9960
+                       (match_dup 3)))]
9961 127 dgisselq
+       "(ZIP_PEEPHOLE)&&peep2_regno_dead_p(2, REGNO(operands[3]))"
9962 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
9963
+               (plus:SI (match_dup 1) (match_dup 2))))]
9964
+       "")
9965
+;
9966
+;
9967
+; Match:
9968
+;      ALU OpB,R0
9969
+;      CMP 0,R0
9970
+; Transform to:
9971
+;      ALU OpB,R0
9972
+;
9973
+(define_peephole2
9974 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9975
+                       (match_operand:SI 1 ""))
9976 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9977
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9978 127 dgisselq
+       "(ZIP_PEEPHOLE)"
9979 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
9980
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9981
+       ])
9982
+;
9983
+;
9984
+; Match:
9985
+;      ALU OpB,R0
9986
+;      MOV R1,R2       // Can be LDI, LOD, STO, etc.
9987 127 dgisselq
+;      CMP 0,R0
9988 122 dgisselq
+; Transform to:
9989
+;      ALU OpB,R0
9990
+;      MOV R0,R1
9991
+;
9992
+(define_peephole2
9993 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
9994
+                       (match_operand:SI 1 ""))
9995 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
9996 124 dgisselq
+       (set (match_operand:SI 2 "nonimmediate_operand") (match_operand:SI 3 ""))
9997 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9998 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))))"
9999 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
10000
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10001
+       (set (match_dup 2) (match_dup 3))
10002
+       ])
10003
+;
10004
+;
10005
+; Match:
10006
+;      ALU OpB,R0
10007
+;      MOV R0,R1
10008
+;      CMP 0,R1
10009
+; Transform to:
10010
+;      ALU OpB,R0
10011
+;      MOV R0,R1
10012
+;
10013
+(define_peephole2
10014 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10015
+                       (match_operand:SI 1 ""))
10016 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10017 124 dgisselq
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))
10018 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))]
10019 127 dgisselq
+       "(ZIP_PEEPHOLE)"
10020 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
10021
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10022
+       (set (match_dup 2) (match_dup 3))
10023
+       ])
10024
+;
10025 124 dgisselq
+;
10026
+; Match:
10027
+;      MOV R1,R0
10028
+;      ADD $x,R0
10029
+;      (CCREG is dead, and x is within range ...)
10030
+; Transform to:
10031 127 dgisselq
+;      MOV $x(R1),R0
10032 124 dgisselq
+(define_peephole2
10033
+       [(set (match_operand:SI 0 "register_operand")
10034
+               (match_operand:SI 1 "register_operand"))
10035
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
10036
+                               (match_operand 2 "zip_mvimm_operand_p")))
10037
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10038
+       ]
10039 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))"
10040 124 dgisselq
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
10041
+;
10042 127 dgisselq
+; Match:
10043
+;      MOV A(R0),R0
10044
+;      ADD $x,R1
10045
+;      (CCREG is dead, and (A+x) is within range ...)
10046
+; Transform to:
10047
+;      MOV $x(R1),R0
10048 124 dgisselq
+;
10049 127 dgisselq
+(define_peephole2
10050
+       [(set (match_operand:SI 0 "register_operand")
10051
+               (plus:SI (match_operand:SI 1 "register_operand")
10052
+                       (match_operand 2 "zip_mvimm_operand_p")))
10053
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
10054
+                               (match_operand 3 "zip_mvimm_operand_p")))
10055
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10056
+       ]
10057
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
10058
+               &&(INTVAL(operands[2])+INTVAL(operands[3])<((1<<17)))
10059
+               &&(INTVAL(operands[2])+INTVAL(operands[3])>=-(1<<17))"
10060
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
10061
+       "operands[2]=GEN_INT(INTVAL(operands[2])+INTVAL(operands[3]));")
10062 124 dgisselq
+;
10063 127 dgisselq
+;
10064
+;
10065 124 dgisselq
+; Match:
10066
+;      ADD $x,R0
10067
+;      MOV R0,R1
10068
+;      (CCREG is dead, and R0 is dead)
10069
+; Transform to:
10070
+;      MOV (A+$x)(R0),R1
10071
+; ... again, how do I build this plus?
10072
+;
10073
+(define_peephole2
10074
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10075
+                       (plus:SI (match_dup 0)
10076
+                               (match_operand 1 "zip_mvimm_operand_p")))
10077
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10078
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))]
10079 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2, REGNO(operands[0])))&&(peep2_regno_dead_p(2,CC_REG))"
10080 124 dgisselq
+       [(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))])
10081
+;
10082
+;
10083 127 dgisselq
+;
10084 124 dgisselq
+; Match:
10085 127 dgisselq
+;      ADD $x,R0
10086
+;      MOV A(R0),R1
10087
+;      (CCREG is dead, and R0 is dead)
10088
+; Transform to:
10089
+;      MOV (A+$x)(R0),R1
10090
+;
10091
+(define_peephole2
10092
+       [(parallel [
10093
+               (set (match_operand:SI 0 "register_operand")
10094
+                       (plus:SI (match_dup 0)
10095
+                               (match_operand 1 "zip_mvimm_operand_p")))
10096
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10097
+       (set (match_operand:SI 2 "register_operand")
10098
+               (plus:SI (match_dup 0)
10099
+                       (match_operand 3 "zip_mvimm_operand_p")))
10100
+       ]
10101
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
10102
+               &&(peep2_regno_dead_p(1,REGNO(operands[0])))
10103
+               &&(INTVAL(operands[1])+INTVAL(operands[3])<((1<<17)))
10104
+               &&(INTVAL(operands[1])+INTVAL(operands[3])>=-(1<<17))"
10105
+       [(set (match_dup 0) (plus:SI (match_dup 2) (match_dup 3)))]
10106
+       "operands[3]=GEN_INT(INTVAL(operands[1])+INTVAL(operands[3]));")
10107
+;
10108
+;
10109
+;
10110
+; Match:
10111 124 dgisselq
+;      ADD     $x,R0
10112
+;      ADD     R0,Rn
10113
+;      (R0 is dead, if R0 is not Rn)
10114
+; Transform to:
10115
+;      ADD     $x(R0),Rn
10116
+;
10117
+(define_peephole2
10118
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10119
+                       (plus:SI (match_dup 0)
10120
+                               (match_operand 1 "zip_opb_immv_p")))
10121
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10122
+       (parallel [(set (match_operand:SI 2 "register_operand")
10123
+                       (plus:SI (match_dup 2) (match_dup 0)))
10124
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
10125
+       ]
10126 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[2]))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
10127 124 dgisselq
+       [(parallel [(set (match_dup 2)
10128
+                       (plus:SI (match_dup 2)
10129
+                               (plus:SI (match_dup 0)
10130
+                                       (match_dup 1))))
10131
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
10132
+       ])
10133
+;
10134
+; Match:
10135
+;      ADD     $x,R0
10136
+;      LOD     -x(R0),R1
10137
+; Transform to:
10138
+;      LOD     (R0),R1
10139
+;      ADD     $x,R0
10140
+;
10141
+(define_peephole2
10142
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10143
+                       (plus:SI (match_dup 0)
10144
+                               (match_operand 1 "zip_opb_immv_p")))
10145
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10146
+       (set (match_operand:SI 3 "register_operand")
10147
+               (mem:SI (plus:SI (match_dup 0)
10148
+                       (match_operand 2 "zip_opb_immv_p"))))
10149
+       ]
10150 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10151 124 dgisselq
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
10152
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10153
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10154
+       ])
10155 127 dgisselq
+(define_peephole2
10156
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10157
+                       (plus:SI (match_dup 0)
10158
+                               (match_operand 1 "zip_opb_immv_p")))
10159
+               (clobber (reg:CC CC_REG))])
10160
+       (set (match_operand:SI 3 "register_operand")
10161
+               (mem:SI (plus:SI (match_dup 0)
10162
+                       (match_operand 2 "zip_opb_immv_p"))))
10163
+       ]
10164
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10165
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
10166
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10167
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10168
+       ])
10169 124 dgisselq
+;
10170
+;
10171
+;
10172
+; Match:
10173
+;      ADD     $x,R0
10174
+;      STO     R1,-x(R0)
10175
+; Transform to:
10176
+;      STO     R1,(R0)
10177
+;      ADD     $x,R0
10178
+;
10179
+(define_peephole2
10180
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10181
+                       (plus:SI (match_dup 0)
10182
+                               (match_operand 1 "zip_opb_immv_p")))
10183
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10184
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
10185
+               (match_operand:SI 3 "register_operand"))
10186
+       ]
10187 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10188 124 dgisselq
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
10189
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10190
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10191
+       ])
10192 127 dgisselq
+(define_peephole2
10193
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10194
+                       (plus:SI (match_dup 0)
10195
+                               (match_operand 1 "zip_opb_immv_p")))
10196
+               (clobber (reg:CC CC_REG))])
10197
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
10198
+               (match_operand:SI 3 "register_operand"))
10199
+       ]
10200
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10201
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
10202
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10203
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10204
+       ])
10205 124 dgisselq
+;
10206
+;
10207
+; Match:
10208
+;      ADD     $x,R0
10209
+;      ANY     R1,R2 (destination is not R0, source does not reference R0)
10210
+;      ADD     R0,Rn (could be 1 or 2, not 0)
10211
+;      (R0 is dead)
10212
+; Transform to:
10213
+;      ANY     R1,R2
10214
+;      ADD     $x(R0),Rn
10215
+;
10216
+;
10217
+;
10218 127 dgisselq
+; Match:
10219
+;      MOV     R1,R0
10220
+;      AND     #/R2,R0
10221
+;      (Ry dead ...)
10222
+; Transform to:
10223
+;      TEST    #/Rz,Rx
10224 124 dgisselq
+;
10225 127 dgisselq
+(define_peephole2
10226
+       [(set (match_operand:SI 0 "register_operand")
10227
+               (match_operand:SI 1 "register_operand"))
10228
+       (parallel [(set (match_dup 0)
10229
+                       (and:SI (match_dup 0)
10230
+                               (match_operand:SI 2 "zip_opb_single_operand_p")))
10231
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10232
+       ]
10233
+       "((1)||(ZIP_PEEPHOLE))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
10234
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_dup 1) (match_dup 2))
10235
+                       (const_int 0)))])
10236
+;
10237
+; Match:
10238
+;      (call ...
10239
+;      (set (pc) (label))
10240
+;  or (in asm)
10241
+;      MOV     .Lcallx(PC),R0
10242
+;      BRA     (somewhere)
10243
+; .Lcallx
10244
+;      BRA     (somewhere-else)
10245
+; Transform to:
10246
+;
10247
+;      (sequence [(call ...
10248
+;              (set (pc) (label))])
10249
+;   or (in asm)
10250
+;      "LDI    (somewhere-else),R0
10251
+;      BRA     subroutine"
10252
+;
10253
+; While the following looks good, it doesnt work.  My guess is that the reason
10254
+; why it doesnt work is that the jump at the end crosses basic block boundaries.
10255
+;
10256
+;(define_insn "void_call_mem_unspec"
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" "n"))
10259
+;              (clobber (reg:SI RTN_REG))
10260
+;              (clobber (reg:CC CC_REG))]
10261
+;      ""
10262
+;      "BRA\t%0,PC"
10263
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
10264
+;(define_peephole2
10265
+;      [(parallel [(call (mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))
10266
+;                      (match_operand 1 "const_int_operand"))
10267
+;              (clobber (reg:SI RTN_REG))
10268
+;              (clobber (reg:CC CC_REG))])
10269
+;      ; The match operand for the (set (pc) ...) cannot have anything but
10270
+;      ; VOIDmode, or it wont match.
10271
+;      (set (pc) (match_operand:VOID 2 "zip_const_address_operand_p"))]
10272
+;      ""
10273
+;      [(set (reg:SI RTN_REG) (match_dup 2))
10274
+;      (call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))] UNSPEC_RAW_CALL)
10275
+;                      (match_operand 1 "const_int_operand"))
10276
+;              (use (reg:SI RTN_REG))
10277
+;              (clobber (reg:SI RTN_REG))
10278
+;              (clobber (reg:CC CC_REG))]
10279
+;      "fprintf(stderr, \"CALL-JUMP Matched\");")
10280
+;
10281
+;
10282
+;
10283
+; So, the following *should* have worked as well.  However, this falls apart
10284
+; because the 'final' routine can't tell if we are calling a subroutine in this
10285
+; function or not.
10286
+;
10287
+;(define_peephole
10288
+       ;[(parallel [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p"))
10289
+                       ;(match_operand 1 "const_int_operand"))
10290
+               ;(clobber (reg:SI RTN_REG))
10291
+               ;(clobber (reg:CC CC_REG))])
10292
+       ;(set (pc) (label_ref (match_operand 2 "")))]
10293
+       ;""
10294
+       ;"LDI\t%2,R0\;BRA\t%0"
10295
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
10296
+;
10297 124 dgisselq
+; and for
10298
+;      BRA target
10299
+;      BRA target ; two branches to the same identical target in a row ...
10300
+;
10301
+;
10302
+;
10303 102 dgisselq
+; STILL MISSING:
10304
+;      SYSCALL(ID)
10305
+;              MOV %ID,R0
10306
+;              CLR     CC
10307
+;      cmove   ... the conditional move, created from a
10308
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
10309
+;      pattern
10310
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
10311
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
10312 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-08 12:10:21.982586940 -0500
10313
@@ -0,0 +1,23 @@
10314 102 dgisselq
+/*
10315
+ * Commends in C-long comment form
10316
+ * class
10317
+ *     Mode = "SI"
10318
+ *     PRECISION, BYTESIZE, COUNT ??
10319
+ *     FORMAT
10320
+ *     EXPR
10321 111 dgisselq
+ *
10322
+ * The manual says I need to define BITS_PER_UNIT here.
10323 102 dgisselq
+ */
10324
+// INT_MODE(QI, 1);
10325
+// INT_MODE(HI, 1);
10326
+// INT_MODE(SI, 1);
10327
+// INT_MODE(DI, 2);
10328
+
10329
+// FLOAT_MODE(SF, 1, ieee_single_format);
10330
+// FLOAT_MODE(DF, 2, ieee_single_format);
10331
+
10332
+// We cannot override machmodes.def from here.  Thus, even though our QI,
10333
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
10334
+// change needed to be made in machmodes.def.  Hence, here is a target
10335
+// configuration change--in machmodes.def--that properly belonged in the
10336
+// config directory.
10337
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
10338
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
10339 142 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-05-09 11:16:54.734258166 -0400
10340
@@ -0,0 +1,83 @@
10341 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
10342
+//
10343
+// Filename:   zip-protos.h
10344
+//
10345
+// Project:    Zip CPU backend for the GNU Compiler Collection
10346
+//
10347
+// Purpose:
10348
+//
10349
+// Creator:    Dan Gisselquist, Ph.D.
10350
+//             Gisselquist Technology, LLC
10351
+//
10352
+////////////////////////////////////////////////////////////////////////////////
10353
+//
10354
+// Copyright (C) 2016, Gisselquist Technology, LLC
10355
+//
10356
+// This program is free software (firmware): you can redistribute it and/or
10357
+// modify it under the terms of  the GNU General Public License as published
10358
+// by the Free Software Foundation, either version 3 of the License, or (at
10359
+// your option) any later version.
10360
+//
10361
+// This program is distributed in the hope that it will be useful, but WITHOUT
10362
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
10363
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
10364
+// for more details.
10365
+//
10366
+// You should have received a copy of the GNU General Public License along
10367
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
10368
+// target there if the PDF file isn't present.)  If not, see
10369
+// <http://www.gnu.org/licenses/> for a copy.
10370
+//
10371
+// License:    GPL, v3, as defined and found on www.gnu.org,
10372
+//             http://www.gnu.org/licenses/gpl.html
10373
+//
10374
+//
10375
+////////////////////////////////////////////////////////////////////////////////
10376
+#ifndef        ZIP_PROTOS_H
10377
+#define        ZIP_PROTOS_H
10378
+
10379 127 dgisselq
+extern bool    zip_supported_condition(int c);
10380 102 dgisselq
+extern void    zip_expand_prologue(void);
10381
+extern void    zip_expand_epilogue(void);
10382 142 dgisselq
+extern bool    zip_expand_movsicc(rtx,rtx,rtx,rtx);
10383 102 dgisselq
+extern int     zip_initial_elimination_offset(int, int);
10384
+extern void    zip_print_operand(FILE *, rtx, int);
10385
+extern void    zip_print_operand_address(FILE *, rtx);
10386
+extern enum    reg_class       zip_reg_class(int);
10387
+extern rtx     zip_return_addr_rtx(int, rtx);
10388
+extern int     zip_num_arg_regs(enum machine_mode, tree);
10389
+
10390
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
10391 122 dgisselq
+
10392
+#ifdef HAVE_cc0
10393 102 dgisselq
+extern void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
10394 122 dgisselq
+#else
10395
+extern void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
10396
+#endif
10397 102 dgisselq
+extern int     zip_address_operand(rtx op);
10398
+extern int     zip_const_address_operand(rtx op);
10399
+extern bool    zip_gen_move_rtl(rtx, rtx);
10400
+extern bool    zip_use_return_insn(void);
10401
+extern const char *zip_set_zero_or_one(rtx, rtx);
10402
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
10403
+
10404 127 dgisselq
+extern int     zip_insn_sets_cc(rtx_insn *insn);
10405
+extern int     zip_is_conditional(rtx_insn *insn);
10406 102 dgisselq
+extern int     zip_ct_address_operand(rtx op);
10407 111 dgisselq
+extern int     zip_pd_opb_operand(rtx op);
10408 102 dgisselq
+extern int     zip_pd_mov_operand(rtx op);
10409 111 dgisselq
+extern int     zip_pd_imm_operand(rtx op);
10410
+extern int     zip_pd_mvimm_operand(rtx op);
10411 102 dgisselq
+extern int     zip_ct_const_address_operand(rtx op);
10412
+extern int     zip_pd_const_address_operand(rtx op);
10413
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
10414
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
10415
+
10416 122 dgisselq
+extern void    zip_ifcvt_machdep_init(struct ce_if_block *ceinfo);
10417
+extern void    zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo);
10418
+extern void    zip_ifcvt_modify_final(struct ce_if_block *ceinfo);
10419
+extern void    zip_ifcvt_modify_tests(struct ce_if_block *ceinfo, rtx *true_expr, rtx *false_expr);
10420 142 dgisselq
+extern void    zip_ifcvt_modify_insn(struct ce_if_block *ceinfo, rtx pattern, rtx_insn *insn);
10421 122 dgisselq
+
10422 102 dgisselq
+#endif
10423
+
10424
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
10425
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
10426
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
10427
@@ -479,6 +479,10 @@
10428
 tilepro*-*-*)
10429
        cpu_type=tilepro
10430
        ;;
10431
+zip*)
10432
+       cpu_type=zip
10433
+       tmake_file=zip/t-zip
10434
+       ;;
10435
 esac
10436
 
10437
 tm_file=${cpu_type}/${cpu_type}.h
10438
@@ -2972,6 +2976,15 @@
10439
        c_target_objs="m32c-pragma.o"
10440
        cxx_target_objs="m32c-pragma.o"
10441
        ;;
10442
+zip-*-netbsd*)
10443
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
10444
+       tmake_file="${tmake_file} zip/t-zip"
10445
+       ;;
10446
+zip*)
10447
+       target_has_targetm_common=yes
10448
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
10449
+       tmake_file="${tmake_file} zip/t-zip"
10450
+       ;;
10451
 *)
10452
        echo "*** Configuration ${target} not supported" 1>&2
10453
        exit 1
10454
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
10455
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
10456 138 dgisselq
+++ gcc-5.3.0-zip/gcc/cse.c     2016-05-04 11:07:38.874831028 -0400
10457
@@ -70,6 +70,7 @@
10458
 #include "dbgcnt.h"
10459
 #include "rtl-iter.h"
10460
 
10461
+
10462
 /* The basic idea of common subexpression elimination is to go
10463
    through the code, keeping a record of expressions that would
10464
    have the same value at the current scan point, and replacing
10465
@@ -634,6 +635,16 @@
10466 102 dgisselq
 
10467
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
10468
 
10469 111 dgisselq
+// #define     DO_ZIP_DEBUGS
10470 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
10471
+#include <stdio.h>
10472 138 dgisselq
+extern void    zip_debug_rtx(const_rtx);
10473
+extern void    zip_debug_rtx_pfx(char *, const_rtx);
10474 102 dgisselq
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
10475
+#else
10476
+#define        ZIP_DEBUG_LINE(STR,RTX)
10477
+#endif
10478
+
10479
 static bool
10480
 fixed_base_plus_p (rtx x)
10481
 {
10482 138 dgisselq
@@ -2898,6 +2909,7 @@
10483 102 dgisselq
          validate_canon_reg (&XVECEXP (x, i, j), insn);
10484
     }
10485
 
10486
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
10487
   return x;
10488
 }
10489
 
10490 138 dgisselq
@@ -3125,6 +3137,8 @@
10491
   rtx new_rtx = 0;
10492
   int changed = 0;
10493
 
10494
+ZIP_DEBUG_LINE("CSE:FOLD-RTX", insn);
10495
+
10496
   /* Operands of X.  */
10497
   /* Workaround -Wmaybe-uninitialized false positive during
10498
      profiledbootstrap by initializing them.  */
10499
@@ -3144,14 +3158,16 @@
10500 102 dgisselq
   if (x == 0)
10501
     return x;
10502
 
10503
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
10504
   /* Try to perform some initial simplifications on X.  */
10505
   code = GET_CODE (x);
10506
   switch (code)
10507
     {
10508
     case MEM:
10509
     case SUBREG:
10510
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
10511
-        return new_rtx;
10512
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
10513
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
10514
+        return new_rtx; }
10515
       return x;
10516
 
10517
     case CONST:
10518 138 dgisselq
@@ -3208,6 +3224,8 @@
10519 102 dgisselq
        rtx folded_arg = XEXP (x, i), const_arg;
10520
        machine_mode mode_arg = GET_MODE (folded_arg);
10521
 
10522
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
10523
+
10524
        switch (GET_CODE (folded_arg))
10525
          {
10526
          case MEM:
10527 138 dgisselq
@@ -3317,6 +3335,7 @@
10528 102 dgisselq
        }
10529
 
10530
       apply_change_group ();
10531
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
10532
     }
10533
 
10534
   /* If X is an arithmetic operation, see if we can simplify it.  */
10535 138 dgisselq
@@ -4203,6 +4222,7 @@
10536 102 dgisselq
 {
10537
   rtx dest = SET_DEST (set);
10538
   rtx src = SET_SRC (set);
10539
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
10540
 
10541
   if (REG_P (dest)
10542
       && REG_P (src) && ! HARD_REGISTER_P (src)
10543 138 dgisselq
@@ -4258,6 +4278,7 @@
10544 102 dgisselq
            }
10545
        }
10546
     }
10547
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
10548
 }
10549
 
10550
 /* Record all the SETs in this instruction into SETS_PTR,
10551 138 dgisselq
@@ -4351,6 +4372,7 @@
10552 102 dgisselq
   rtx tem;
10553
   rtx x = PATTERN (insn);
10554
   int i;
10555
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
10556
 
10557
   if (CALL_P (insn))
10558
     {
10559 138 dgisselq
@@ -4364,6 +4386,7 @@
10560 102 dgisselq
       canon_reg (SET_SRC (x), insn);
10561
       apply_change_group ();
10562
       fold_rtx (SET_SRC (x), insn);
10563
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
10564
     }
10565
   else if (GET_CODE (x) == CLOBBER)
10566
     {
10567 138 dgisselq
@@ -4400,6 +4423,7 @@
10568 102 dgisselq
     canon_reg (PATTERN (insn), insn);
10569
   else if (GET_CODE (x) == PARALLEL)
10570
     {
10571
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
10572
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
10573
        {
10574
          rtx y = XVECEXP (x, 0, i);
10575 138 dgisselq
@@ -4491,6 +4515,7 @@
10576 102 dgisselq
 
10577
      The result of apply_change_group can be ignored; see canon_reg.  */
10578
 
10579
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
10580
   apply_change_group ();
10581
 }
10582
 
10583
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
10584
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
10585
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
10586
@@ -480,6 +480,8 @@
10587
 #define LOG2_BITS_PER_UNIT 3
10588
 #elif BITS_PER_UNIT == 16
10589
 #define LOG2_BITS_PER_UNIT 4
10590
+#elif BITS_PER_UNIT == 32
10591
+#define LOG2_BITS_PER_UNIT 5
10592
 #else
10593
 #error Unknown BITS_PER_UNIT
10594
 #endif
10595 127 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/df-scan.c gcc-5.3.0-zip/gcc/df-scan.c
10596
--- gcc-5.3.0-original/gcc/df-scan.c    2015-01-09 15:18:42.000000000 -0500
10597
+++ gcc-5.3.0-zip/gcc/df-scan.c 2016-04-14 16:12:03.614777002 -0400
10598
@@ -61,6 +61,14 @@
10599
 
10600
 typedef struct df_mw_hardreg *df_mw_hardreg_ptr;
10601
 
10602
+// #define     DO_ZIP_DEBUGS
10603
+#ifdef DO_ZIP_DEBUGS
10604
+extern void    zip_debug_rtx(const_rtx);
10605
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10606
+#else
10607
+#define        ZIP_DEBUG_LINE(STR,RTX)
10608
+#endif
10609
+
10610
 
10611
 #ifndef HAVE_epilogue
10612
 #define HAVE_epilogue 0
10613 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
10614
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
10615
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
10616
@@ -0,0 +1,214 @@
10617
+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
10618
+entering extended mode
10619
+ restricted \write18 enabled.
10620
+ file:line:error style messages enabled.
10621
+ %&-line parsing enabled.
10622
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
10623
+gcc.texi
10624
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
10625
+Loading texinfo [version 2013-09-11.11]:
10626
+\bindingoffset=\dimen16
10627
+\normaloffset=\dimen17
10628
+\pagewidth=\dimen18
10629
+\pageheight=\dimen19
10630
+\outerhsize=\dimen20
10631
+\outervsize=\dimen21
10632
+\cornerlong=\dimen22
10633
+\cornerthick=\dimen23
10634
+\topandbottommargin=\dimen24
10635
+\headlinebox=\box16
10636
+\footlinebox=\box17
10637
+\margin=\insert252
10638
+\EMsimple=\toks13
10639
+\groupbox=\box18
10640
+\groupinvalidhelp=\toks14
10641
+\mil=\dimen25
10642
+\exdentamount=\skip18
10643
+\inmarginspacing=\skip19
10644
+\centerpenalty=\count27
10645
+ pdf,
10646
+\tempnum=\count28
10647
+\lnkcount=\count29
10648
+\filename=\toks15
10649
+\filenamelength=\count30
10650
+\pgn=\count31
10651
+\toksA=\toks16
10652
+\toksB=\toks17
10653
+\toksC=\toks18
10654
+\toksD=\toks19
10655
+\boxA=\box19
10656
+\countA=\count32
10657
+\nopdfimagehelp=\toks20
10658
+ fonts,
10659
+\sffam=\fam8
10660
+\textleading=\dimen26
10661
+ markup,
10662
+\fontdepth=\count33
10663
+ glyphs,
10664
+\errorbox=\box20
10665
+
10666
+page headings,
10667
+\titlepagetopglue=\skip20
10668
+\titlepagebottomglue=\skip21
10669
+\evenheadline=\toks21
10670
+\oddheadline=\toks22
10671
+\evenfootline=\toks23
10672
+\oddfootline=\toks24
10673
+ tables,
10674
+\tableindent=\dimen27
10675
+\itemindent=\dimen28
10676
+\itemmargin=\dimen29
10677
+\itemmax=\dimen30
10678
+\itemno=\count34
10679
+\multitableparskip=\skip22
10680
+\multitableparindent=\skip23
10681
+\multitablecolspace=\dimen31
10682
+\multitablelinespace=\skip24
10683
+\colcount=\count35
10684
+\everytab=\toks25
10685
+ conditionals,
10686
+\doignorecount=\count36
10687
+ indexing,
10688
+\whatsitskip=\skip25
10689
+\whatsitpenalty=\count37
10690
+\secondaryindent=\skip26
10691
+\partialpage=\box21
10692
+\doublecolumnhsize=\dimen32
10693
+ sectioning,
10694
+\unnumberedno=\count38
10695
+\chapno=\count39
10696
+\secno=\count40
10697
+\subsecno=\count41
10698
+\subsubsecno=\count42
10699
+\appendixno=\count43
10700
+\absseclevel=\count44
10701
+\secbase=\count45
10702
+\chapheadingskip=\skip27
10703
+\secheadingskip=\skip28
10704
+\subsecheadingskip=\skip29
10705
+ toc,
10706
+\tocfile=\write0
10707
+\contentsrightmargin=\skip30
10708
+\savepageno=\count46
10709
+\lastnegativepageno=\count47
10710
+\tocindent=\dimen33
10711
+ environments,
10712
+\lispnarrowing=\skip31
10713
+\envskipamount=\skip32
10714
+\circthick=\dimen34
10715
+\cartouter=\dimen35
10716
+\cartinner=\dimen36
10717
+\normbskip=\skip33
10718
+\normpskip=\skip34
10719
+\normlskip=\skip35
10720
+\lskip=\skip36
10721
+\rskip=\skip37
10722
+\nonfillparindent=\dimen37
10723
+\tabw=\dimen38
10724
+\verbbox=\box22
10725
+
10726
+defuns,
10727
+\defbodyindent=\skip38
10728
+\defargsindent=\skip39
10729
+\deflastargmargin=\skip40
10730
+\defunpenalty=\count48
10731
+\parencount=\count49
10732
+\brackcount=\count50
10733
+ macros,
10734
+\paramno=\count51
10735
+\macname=\toks26
10736
+ cross references,
10737
+\auxfile=\write1
10738
+\savesfregister=\count52
10739
+\toprefbox=\box23
10740
+\printedrefnamebox=\box24
10741
+\infofilenamebox=\box25
10742
+\printedmanualbox=\box26
10743
+ insertions,
10744
+\footnoteno=\count53
10745
+\SAVEfootins=\box27
10746
+\SAVEmargin=\box28
10747
+
10748
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
10749
+This is `epsf.tex' v2.7.4 <14 February 2011>
10750
+\epsffilein=\read1
10751
+\epsfframemargin=\dimen39
10752
+\epsfframethickness=\dimen40
10753
+\epsfrsize=\dimen41
10754
+\epsftmp=\dimen42
10755
+\epsftsize=\dimen43
10756
+\epsfxsize=\dimen44
10757
+\epsfysize=\dimen45
10758
+\pspoints=\dimen46
10759
+)
10760
+\noepsfhelp=\toks27
10761
+ localization,
10762
+\nolanghelp=\toks28
10763
+\countUTFx=\count54
10764
+\countUTFy=\count55
10765
+\countUTFz=\count56
10766
+ formatting,
10767
+\defaultparindent=\dimen47
10768
+ and turning on texinfo input format.)
10769
+\openout1 = `gcc.aux'.
10770
+
10771
+@cpindfile=@write2
10772
+@fnindfile=@write3
10773
+@vrindfile=@write4
10774
+@tpindfile=@write5
10775
+@kyindfile=@write6
10776
+@pgindfile=@write7
10777
+texinfo.tex: doing @include of gcc-common.texi
10778
+
10779
+
10780
+./gcc.texi:25: I can't find file `gcc-common.texi'.
10781
+@temp ->@input gcc-common.texi
10782
+
10783
+@includezzz ...and @input #1 }@expandafter }@temp
10784
+                                                  @popthisfilestack
10785
+l.25 @include gcc-common.texi
10786
+
10787
+(Press Enter to retry, or Control-D to exit)
10788
+Please type another input file name: include/gcc-common.texi
10789
+(./include/gcc-common.texi
10790
+texinfo.tex: doing @include of gcc-vers.texi
10791
+
10792
+
10793
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
10794
+@temp ->@input gcc-vers.texi
10795
+
10796
+@includezzz ...and @input #1 }@expandafter }@temp
10797
+                                                  @popthisfilestack
10798
+l.11 @include gcc-vers.texi
10799
+
10800
+(Press Enter to retry, or Control-D to exit)
10801
+Please type another input file name: include/gcc-vers.texi
10802
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
10803
+@temp ->@input gcc-vers.texi
10804
+
10805
+@includezzz ...and @input #1 }@expandafter }@temp
10806
+                                                  @popthisfilestack
10807
+l.11 @include gcc-vers.texi
10808
+
10809
+(Press Enter to retry, or Control-D to exit)
10810
+Please type another input file name:
10811
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
10812
+@temp ->@input gcc-vers.texi
10813
+
10814
+@includezzz ...and @input #1 }@expandafter }@temp
10815
+                                                  @popthisfilestack
10816
+l.11 @include gcc-vers.texi
10817
+
10818
+(Press Enter to retry, or Control-D to exit)
10819
+Please type another input file name:
10820
+./include/gcc-common.texi:11: Emergency stop.
10821
+@temp ->@input gcc-vers.texi
10822
+
10823
+@includezzz ...and @input #1 }@expandafter }@temp
10824
+                                                  @popthisfilestack
10825
+l.11 @include gcc-vers.texi
10826
+
10827
+End of file on the terminal!
10828
+
10829
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
10830
+duced!
10831 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/emit-rtl.c gcc-5.3.0-zip/gcc/emit-rtl.c
10832
--- gcc-5.3.0-original/gcc/emit-rtl.c   2015-08-05 07:20:59.000000000 -0400
10833 138 dgisselq
+++ gcc-5.3.0-zip/gcc/emit-rtl.c        2016-05-02 07:48:47.925017436 -0400
10834 117 dgisselq
@@ -81,6 +81,15 @@
10835
 #include "builtins.h"
10836
 #include "rtl-iter.h"
10837
 
10838
+// #define     DO_ZIP_DEBUGS
10839
+#include <stdio.h>
10840
+#ifdef DO_ZIP_DEBUGS
10841
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10842
+extern void    zip_debug_rtx(const_rtx);
10843
+#else
10844
+#define        ZIP_DEBUG_LINE(STR,RTX)
10845
+#endif
10846
+
10847
 struct target_rtl default_target_rtl;
10848
 #if SWITCHABLE_TARGET
10849
 struct target_rtl *this_target_rtl = &default_target_rtl;
10850 127 dgisselq
@@ -2979,6 +2988,8 @@
10851 117 dgisselq
       break;
10852
     }
10853
 
10854
+ZIP_DEBUG_LINE("Before RTX_FLAG",x);
10855
+
10856
   /* This rtx may not be shared.  If it has already been seen,
10857
      replace it with a copy of itself.  */
10858
 
10859 127 dgisselq
@@ -2989,6 +3000,8 @@
10860 117 dgisselq
     }
10861
   RTX_FLAG (x, used) = 1;
10862
 
10863
+ZIP_DEBUG_LINE("Post RTX_FLAG",x);
10864
+
10865
   /* Now scan the subexpressions recursively.
10866
      We can store any replaced subexpressions directly into X
10867
      since we know X is not shared!  Any vectors in X
10868 127 dgisselq
@@ -3665,7 +3678,9 @@
10869
     split_branch_probability = XINT (note, 0);
10870
   probability = split_branch_probability;
10871
 
10872
+ZIP_DEBUG_LINE("Before split", trial);
10873
   seq = safe_as_a <rtx_insn *> (split_insns (pat, trial));
10874
+ZIP_DEBUG_LINE("After split", seq);
10875
 
10876
   split_branch_probability = -1;
10877
 
10878
@@ -3834,6 +3849,7 @@
10879
     if (! tem->deleted () && INSN_P (tem))
10880
       tem = try_split (PATTERN (tem), tem, 1);
10881
 
10882
+
10883
   /* Return either the first or the last insn, depending on which was
10884
      requested.  */
10885
   return last
10886 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
10887
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
10888 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
10889 102 dgisselq
@@ -7999,6 +7999,8 @@
10890
    the back of the caller.
10891
    The normal operating mode is to pass FALSE for this parameter.  */
10892
 
10893
+#include "print-tree.h"
10894
+
10895
 rtx
10896
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
10897
                  enum expand_modifier modifier, rtx *alt_rtl,
10898 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/final.c gcc-5.3.0-zip/gcc/final.c
10899
--- gcc-5.3.0-original/gcc/final.c      2015-01-15 08:28:42.000000000 -0500
10900 127 dgisselq
+++ gcc-5.3.0-zip/gcc/final.c   2016-04-20 20:52:07.186056061 -0400
10901 111 dgisselq
@@ -109,6 +109,14 @@
10902
 #include "wide-int-print.h"
10903
 #include "rtl-iter.h"
10904
 
10905 122 dgisselq
+// #define     DO_ZIP_DEBUGS
10906 111 dgisselq
+#ifdef DO_ZIP_DEBUGS
10907
+extern void zip_debug_rtx(const_rtx);
10908
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10909
+#else
10910
+#define        ZIP_DEBUG_LINE(STR,RTX)
10911
+#endif
10912
+
10913
 #ifdef XCOFF_DEBUGGING_INFO
10914
 #include "xcoffout.h"          /* Needed for external data
10915
                                   declarations for e.g. AIX 4.x.  */
10916
@@ -2071,6 +2079,8 @@
10917
   /* Output the insns.  */
10918
   for (insn = first; insn;)
10919
     {
10920
+       ZIP_DEBUG_LINE("final()\n", insn);
10921
+
10922
       if (HAVE_ATTR_length)
10923
        {
10924
          if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
10925 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
10926
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
10927
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
10928
@@ -330,7 +330,8 @@
10929
         the size of a CC mode is four units.  */
10930
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
10931
 
10932
-      m->bytesize = 4;
10933
+       /* For the ZipCPU, however, it is only one unit */
10934
+      m->bytesize = 1;
10935
       m->ncomponents = 1;
10936
       m->component = 0;
10937
       break;
10938
@@ -766,11 +767,12 @@
10939
 
10940
   /* So put the default value unless the target needs a non standard
10941
      value. */
10942
-#ifdef BITS_PER_UNIT
10943
-  bits_per_unit = BITS_PER_UNIT;
10944
-#else
10945
-  bits_per_unit = 8;
10946
-#endif
10947
+// #ifdef BITS_PER_UNIT
10948
+  // bits_per_unit = BITS_PER_UNIT;
10949
+// #else
10950
+  bits_per_unit = 32;
10951
+#warning "Is there a more automated way to set bits per unit?"
10952
+// #endif
10953
 
10954
 #ifdef MAX_BITSIZE_MODE_ANY_INT
10955
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
10956
@@ -1083,7 +1085,7 @@
10957
       first = modes[c];
10958
       last = 0;
10959
       for (m = first; m; last = m, m = m->next)
10960
-       ;
10961
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
10962
 
10963
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
10964
         end will try to use it for bitfields in structures and the
10965
@@ -1268,7 +1270,7 @@
10966
            continue;
10967
          if (m->precision != (unsigned int) -1)
10968
            {
10969
-             if (m2->precision != 2 * m->precision)
10970
+             if (m2->precision < 2 * m->precision)
10971
                continue;
10972
            }
10973
          else
10974
@@ -1323,7 +1325,6 @@
10975
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
10976
     else
10977
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
10978
-
10979
   puts ("#undef MODE_MASK");
10980
   print_closer ();
10981
 }
10982
@@ -1351,12 +1352,23 @@
10983
   int c;
10984
   struct mode_data *m;
10985
 
10986
+  puts(
10987
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
10988
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
10989
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
10990
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
10991
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
10992
+" * of the target word in size.  However, this tries to do a little something\n"
10993
+" * teach our compiler what we are doing.\n"
10994
+" */\n");
10995
   print_maybe_const_decl ("%sunsigned char",
10996
                          "mode_base_align", "NUM_MACHINE_MODES",
10997
                          alignment);
10998
 
10999
   for_all_modes (c, m)
11000
-    tagged_printf ("%u", m->alignment, m->name);
11001
+    tagged_printf ("%u", 4*m->bytesize,
11002
+               // m->alignment,
11003
+               m->name);
11004
 
11005
   print_closer ();
11006
 }
11007 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/jump.c gcc-5.3.0-zip/gcc/jump.c
11008
--- gcc-5.3.0-original/gcc/jump.c       2015-01-27 04:19:30.000000000 -0500
11009 122 dgisselq
+++ gcc-5.3.0-zip/gcc/jump.c    2016-04-06 14:06:50.207563805 -0400
11010 117 dgisselq
@@ -80,6 +80,14 @@
11011
 #include "target.h"
11012
 #include "rtl-iter.h"
11013
 
11014
+// #define     DO_ZIP_DEBUGS
11015
+#ifdef DO_ZIP_DEBUGS
11016
+#include <stdio.h>
11017
+#define        ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
11018
+extern void zip_debug_rtx(const_rtx);
11019
+#else
11020
+#define        ZIP_DEBUG_LINE(STR,RTX)
11021
+#endif
11022
 /* Optimize jump y; x: ... y: jumpif... x?
11023
    Don't know if it is worth bothering with.  */
11024
 /* Optimize two cases of conditional jump to conditional jump?
11025
@@ -1136,6 +1144,7 @@
11026
   int i;
11027
   const char *fmt;
11028
 
11029
+ZIP_DEBUG_LINE("Mark jump label",insn);
11030
   switch (code)
11031
     {
11032
     case PC:
11033
@@ -1248,6 +1257,8 @@
11034
       break;
11035
     }
11036
 
11037
+ZIP_DEBUG_LINE("Post case",insn);
11038
+
11039
   fmt = GET_RTX_FORMAT (code);
11040
 
11041
   /* The primary target of a tablejump is the label of the ADDR_VEC,
11042 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
11043
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
11044 111 dgisselq
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-08 11:56:45.375491523 -0500
11045 102 dgisselq
@@ -184,11 +184,11 @@
11046
    larger types, then corresponding modes must be added here.  The
11047
    name OI is reserved for a 256-bit type (needed by some back ends).
11048
     */
11049
-INT_MODE (QI, 1);
11050
-INT_MODE (HI, 2);
11051
-INT_MODE (SI, 4);
11052
-INT_MODE (DI, 8);
11053
-INT_MODE (TI, 16);
11054
+// INT_MODE (QI, 1);
11055
+// INT_MODE (HI, 1);
11056
+INT_MODE (SI, 1);
11057
+INT_MODE (DI, 2);
11058
+INT_MODE (TI, 4);
11059
 
11060
 /* No partial integer modes are defined by default.  */
11061
 
11062 111 dgisselq
@@ -206,35 +206,35 @@
11063 102 dgisselq
    These are the IEEE mappings.  They can be overridden with
11064
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
11065
 
11066
-FLOAT_MODE (SF, 4, ieee_single_format);
11067
-FLOAT_MODE (DF, 8, ieee_double_format);
11068
+FLOAT_MODE (SF, 1, ieee_single_format);
11069
+FLOAT_MODE (DF, 2, ieee_double_format);
11070
 
11071
 /* Basic CC modes.
11072
    FIXME define this only for targets that need it.  */
11073 111 dgisselq
 CC_MODE (CC);
11074 102 dgisselq
 
11075
 /* Fixed-point modes.  */
11076 111 dgisselq
-FRACT_MODE (QQ, 1, 7); /* s.7 */
11077 102 dgisselq
-FRACT_MODE (HQ, 2, 15); /* s.15 */
11078
-FRACT_MODE (SQ, 4, 31); /* s.31 */
11079
-FRACT_MODE (DQ, 8, 63); /* s.63 */
11080
-FRACT_MODE (TQ, 16, 127); /* s.127 */
11081 111 dgisselq
-
11082
-UFRACT_MODE (UQQ, 1, 8); /* .8 */
11083 102 dgisselq
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
11084
-UFRACT_MODE (USQ, 4, 32); /* .32 */
11085
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
11086
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
11087 111 dgisselq
-
11088
-ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
11089
-ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
11090
-ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
11091
-ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
11092
-
11093
-UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
11094
-UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
11095
-UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
11096
-UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
11097
+/* FRACT_MODE (QQ, 1, 7); /* s.7 */
11098
+/* FRACT_MODE (HQ, 1, 15); /* s.15 */
11099
+FRACT_MODE (SQ, 1, 31); /* s.31 */
11100
+FRACT_MODE (DQ, 2, 63); /* s.63 */
11101
+FRACT_MODE (TQ, 4, 127); /* s.127 */
11102
+
11103
+/* UFRACT_MODE (UQQ, 1, 8); /* .8 */
11104
+/* UFRACT_MODE (UHQ, 1, 16); /* .16 */
11105 102 dgisselq
+UFRACT_MODE (USQ, 1, 32); /* .32 */
11106
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
11107
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
11108 111 dgisselq
+
11109
+/* ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
11110
+ACCUM_MODE (SA, 1, 16, 15); /* s16.15 */
11111
+ACCUM_MODE (DA, 2, 32, 31); /* s32.31 */
11112
+ACCUM_MODE (TA, 4, 64, 63); /* s64.63 */
11113
+
11114
+/* UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
11115
+UACCUM_MODE (USA, 1, 16, 16); /* 16.16 */
11116
+UACCUM_MODE (UDA, 2, 32, 32); /* 32.32 */
11117
+UACCUM_MODE (UTA, 4, 64, 64); /* 64.64 */
11118 102 dgisselq
 
11119 111 dgisselq
 /* Allow the target to specify additional modes of various kinds.  */
11120
 #if HAVE_EXTRA_MODES
11121 102 dgisselq
@@ -246,9 +246,9 @@
11122
 COMPLEX_MODES (FLOAT);
11123
 
11124
 /* Decimal floating point modes.  */
11125
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
11126
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
11127
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
11128
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
11129
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
11130
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
11131
 
11132
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
11133
    The tm.h file specifies which one.  It is not a distinct mode.  */
11134
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
11135
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
11136
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
11137
@@ -180,13 +180,7 @@
11138
 /* Get the size in bytes and bits of an object of mode MODE.  */
11139
 
11140
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
11141
-#if GCC_VERSION >= 4001
11142
-#define GET_MODE_SIZE(MODE) \
11143
-  ((unsigned short) (__builtin_constant_p (MODE) \
11144
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
11145
-#else
11146
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
11147
-#endif
11148
 #define GET_MODE_BITSIZE(MODE) \
11149
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
11150
 
11151
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
11152
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
11153
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
11154
@@ -765,10 +765,14 @@
11155
        {
11156
          switch (TYPE_MODE (type))
11157
            {
11158
+#ifdef HAVE_QImode
11159
            case QImode:
11160
              charType = 'C'; break;
11161
+#endif
11162
+#ifdef HAVE_HImode
11163
            case HImode:
11164
              charType = 'S'; break;
11165
+#endif
11166
            case SImode:
11167
              {
11168
                if (type == long_unsigned_type_node)
11169
@@ -788,10 +792,14 @@
11170
        {
11171
          switch (TYPE_MODE (type))
11172
            {
11173
+#ifdef HAVE_QImode
11174
            case QImode:
11175
              charType = 'c'; break;
11176
+#endif
11177
+#ifdef HAVE_HImode
11178
            case HImode:
11179
              charType = 's'; break;
11180
+#endif
11181
            case SImode:
11182
              {
11183
                if (type == long_integer_type_node)
11184
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
11185
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
11186 111 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-24 21:30:23.402590035 -0400
11187
@@ -71,6 +71,14 @@
11188 102 dgisselq
 #include "df.h"
11189
 #include "dbgcnt.h"
11190
 
11191 111 dgisselq
+// #define     DO_ZIP_DEBUGS
11192 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
11193
+extern void zip_debug_rtx(const_rtx);
11194
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11195
+#else
11196
+#define        ZIP_DEBUG_LINE(STR,RTX)
11197
+#endif
11198
+
11199
 static int reload_cse_noop_set_p (rtx);
11200
 static bool reload_cse_simplify (rtx_insn *, rtx);
11201
 static void reload_cse_regs_1 (void);
11202 111 dgisselq
@@ -120,6 +128,8 @@
11203 102 dgisselq
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
11204
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
11205
 
11206
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
11207
+
11208
   if (GET_CODE (body) == SET)
11209
     {
11210
       int count = 0;
11211 111 dgisselq
@@ -147,6 +157,7 @@
11212 102 dgisselq
        apply_change_group ();
11213
       else
11214
        reload_cse_simplify_operands (insn, testreg);
11215
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
11216
     }
11217
   else if (GET_CODE (body) == PARALLEL)
11218
     {
11219 111 dgisselq
@@ -205,6 +216,7 @@
11220 102 dgisselq
        apply_change_group ();
11221
       else
11222
        reload_cse_simplify_operands (insn, testreg);
11223
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
11224
     }
11225
 
11226
 done:
11227 111 dgisselq
@@ -246,6 +258,7 @@
11228 102 dgisselq
          cfg_changed |= reload_cse_simplify (insn, testreg);
11229
 
11230
        cselib_process_insn (insn);
11231
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
11232
       }
11233
 
11234
   /* Clean up.  */
11235 111 dgisselq
@@ -276,6 +289,8 @@
11236 102 dgisselq
 #endif
11237
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
11238
 
11239
+
11240
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
11241
   dreg = true_regnum (SET_DEST (set));
11242
   if (dreg < 0)
11243
     return 0;
11244 111 dgisselq
@@ -427,6 +442,7 @@
11245 102 dgisselq
   /* Array of alternatives, sorted in order of decreasing desirability.  */
11246
   int *alternative_order;
11247
 
11248
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
11249
   extract_constrain_insn (insn);
11250
 
11251
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
11252 111 dgisselq
@@ -519,6 +535,7 @@
11253 102 dgisselq
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
11254
     }
11255
 
11256
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
11257
   alternative_mask preferred = get_preferred_alternatives (insn);
11258
   for (i = 0; i < recog_data.n_operands; i++)
11259
     {
11260 111 dgisselq
@@ -617,6 +634,7 @@
11261 102 dgisselq
            }
11262
        }
11263
     }
11264
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
11265
 
11266
   /* Record all alternatives which are better or equal to the currently
11267
      matching one in the alternative_order array.  */
11268 111 dgisselq
@@ -666,6 +684,7 @@
11269 102 dgisselq
       validate_change (insn, recog_data.operand_loc[i],
11270
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
11271
     }
11272
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
11273
 
11274
   for (i = recog_data.n_dups - 1; i >= 0; i--)
11275
     {
11276 111 dgisselq
@@ -679,6 +698,7 @@
11277 102 dgisselq
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
11278
     }
11279
 
11280
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
11281
   return apply_change_group ();
11282
 }
11283
 
11284 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/recog.c gcc-5.3.0-zip/gcc/recog.c
11285
--- gcc-5.3.0-original/gcc/recog.c      2015-03-20 02:07:30.000000000 -0400
11286 127 dgisselq
+++ gcc-5.3.0-zip/gcc/recog.c   2016-04-14 23:19:07.630839483 -0400
11287 117 dgisselq
@@ -68,6 +68,15 @@
11288
 #include "df.h"
11289
 #include "insn-codes.h"
11290
 
11291
+// #define     DO_ZIP_DEBUGS
11292
+#ifdef DO_ZIP_DEBUGS
11293
+extern void    zip_debug_rtx(const_rtx);
11294
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11295
+#else
11296
+#define        ZIP_DEBUG_LINE(STR,RTX)
11297
+#endif
11298
+
11299
+
11300
 #ifndef STACK_PUSH_CODE
11301
 #ifdef STACK_GROWS_DOWNWARD
11302
 #define STACK_PUSH_CODE PRE_DEC
11303 122 dgisselq
@@ -2283,6 +2292,7 @@
11304
   recog_data.n_dups = 0;
11305
   recog_data.is_asm = false;
11306
 
11307
+ZIP_DEBUG_LINE("Extract-insn", insn);
11308
   switch (GET_CODE (body))
11309
     {
11310
     case USE:
11311
@@ -3671,7 +3681,6 @@
11312 117 dgisselq
            break;
11313
 
11314
          /* The buffer filled to the current maximum, so try to match.  */
11315
-
11316
          pos = peep2_buf_position (peep2_current + peep2_current_count);
11317
          peep2_insn_data[pos].insn = PEEP2_EOB;
11318
          COPY_REG_SET (peep2_insn_data[pos].live_before, live);
11319 122 dgisselq
@@ -3704,6 +3713,7 @@
11320 117 dgisselq
     rebuild_jump_labels (get_insns ());
11321
   if (peep2_do_cleanup_cfg)
11322
     cleanup_cfg (CLEANUP_CFG_CHANGED);
11323
+
11324
 }
11325
 #endif /* HAVE_peephole2 */
11326
 
11327
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
11328
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
11329 127 dgisselq
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-04-20 20:51:38.590252867 -0400
11330 117 dgisselq
@@ -72,6 +72,14 @@
11331
 #include "dumpfile.h"
11332
 #include "rtl-iter.h"
11333
 
11334
+// #define     DO_ZIP_DEBUGS
11335
+#ifdef DO_ZIP_DEBUGS
11336
+extern void    zip_debug_rtx(const_rtx);
11337
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11338
+#else
11339
+#define        ZIP_DEBUG_LINE(STR,RTX)
11340
+#endif
11341
+
11342
 /* This file contains the reload pass of the compiler, which is
11343
    run after register allocation has been done.  It checks that
11344
    each insn is valid (operands required to be in registers really
11345 127 dgisselq
@@ -794,6 +802,20 @@
11346 117 dgisselq
   basic_block bb;
11347
   bool inserted;
11348
 
11349
+#ifdef DO_ZIP_DEBUGS
11350
+  {
11351 127 dgisselq
+       fprintf(stderr, "BEFORE-RELOAD\n");
11352 117 dgisselq
+       int     total_count = 0, current_count = 0;
11353
+       for (insn = first; insn; insn = NEXT_INSN (insn))
11354
+               total_count++;
11355
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
11356
+               fprintf(stderr, "B %3d/%3d", current_count++, total_count);
11357
+               zip_debug_rtx(insn);
11358
+       }
11359 127 dgisselq
+       fprintf(stderr, "BEFORE-RELOAD -- END OF INSTRUCTION LIST\n");
11360 117 dgisselq
+  }
11361
+#endif
11362
+
11363
   /* Make sure even insns with volatile mem refs are recognizable.  */
11364
   init_recog ();
11365
 
11366 127 dgisselq
@@ -1366,6 +1388,20 @@
11367 117 dgisselq
 
11368
   reload_completed = !failure;
11369
 
11370
+#ifdef DO_ZIP_DEBUGS
11371
+  {
11372 127 dgisselq
+       fprintf(stderr, "AFTER-RELOAD\n");
11373 117 dgisselq
+       int     total_count = 0, current_count = 0;
11374
+       for (insn = first; insn; insn = NEXT_INSN (insn))
11375
+               total_count++;
11376
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
11377
+               fprintf(stderr, "A %3d/%3d", current_count++, total_count);
11378
+               zip_debug_rtx(insn);
11379
+       }
11380 127 dgisselq
+       fprintf(stderr, "AFTER-RELOAD -- END OF INSTRUCTION LIST\n");
11381 117 dgisselq
+  }
11382
+#endif
11383
+
11384
   return need_dce;
11385
 }
11386
 
11387 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
11388
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
11389 122 dgisselq
+++ gcc-5.3.0-zip/gcc/reload.c  2016-04-06 17:49:33.418613170 -0400
11390
@@ -136,6 +136,15 @@
11391
 #include "target.h"
11392
 #include "ira.h"
11393
 
11394
+// #define     DO_ZIP_DEBUGS
11395
+#ifdef DO_ZIP_DEBUGS
11396
+extern void zip_debug_rtx(const_rtx);
11397
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
11398
+#else
11399
+#define        ZIP_DEBUG_LINE(STR,RTX)
11400
+#endif
11401
+
11402
+
11403
 /* True if X is a constant that can be forced into the constant pool.
11404
    MODE is the mode of the operand, or VOIDmode if not known.  */
11405
 #define CONST_POOL_OK_P(MODE, X)               \
11406
@@ -2700,6 +2709,8 @@
11407
   hard_regs_live_known = live_known;
11408
   static_reload_reg_p = reload_reg_p;
11409
 
11410
+ZIP_DEBUG_LINE("Find reloads\n", insn);
11411
+
11412
   /* JUMP_INSNs and CALL_INSNs are not allowed to have any output reloads;
11413
      neither are insns that SET cc0.  Insns that use CC0 are not allowed
11414
      to have any input reloads.  */
11415
@@ -2707,8 +2718,17 @@
11416 102 dgisselq
     no_output_reloads = 1;
11417
 
11418
 #ifdef HAVE_cc0
11419
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
11420
+  // cond_exec instruction, we cannot change the input so that the instruction
11421
+  // relies on another register--cc0 is specific.  This requries that the
11422
+  // references be only cc0 and (const_int 0), rather than allowing other
11423
+  // registers here as well.
11424
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
11425
     no_input_reloads = 1;
11426
+  // If the result of an instruction is the cc0 register, that cannot
11427
+  // be changed, therefore no output reloading is allowed.  This only
11428
+  // works if instructions *only* set the cc0 register, and not multiple
11429
+  // registers.
11430
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
11431
     no_output_reloads = 1;
11432
 #endif
11433 146 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/target-def.h gcc-5.3.0-zip/gcc/target-def.h
11434
--- gcc-5.3.0-original/gcc/target-def.h 2015-01-05 07:33:28.000000000 -0500
11435
+++ gcc-5.3.0-zip/gcc/target-def.h      2016-05-12 15:20:06.896745740 -0400
11436
@@ -29,24 +29,44 @@
11437
    rather than the .c file, then we need to wrap the default
11438
    definition in a #ifndef, since files include tm.h before this one.  */
11439
 
11440
+#ifndef TARGET_ASM_ALIGNED_HI_OP
11441
 #define TARGET_ASM_ALIGNED_HI_OP "\t.short\t"
11442
+#endif
11443
+#ifndef TARGET_ASM_ALIGNED_SI_OP
11444
 #define TARGET_ASM_ALIGNED_SI_OP "\t.long\t"
11445
+#endif
11446
 #define TARGET_ASM_ALIGNED_DI_OP NULL
11447
 #define TARGET_ASM_ALIGNED_TI_OP NULL
11448
 
11449
 /* GAS and SYSV4 assemblers accept these.  */
11450
 #if defined (OBJECT_FORMAT_ELF)
11451
-#define TARGET_ASM_UNALIGNED_HI_OP "\t.2byte\t"
11452
-#define TARGET_ASM_UNALIGNED_SI_OP "\t.4byte\t"
11453
-#define TARGET_ASM_UNALIGNED_DI_OP "\t.8byte\t"
11454
-#define TARGET_ASM_UNALIGNED_TI_OP NULL
11455
+# ifndef TARGET_ASM_UNALIGNED_HI_OP
11456
+#  define TARGET_ASM_UNALIGNED_HI_OP "\t.2byte\t"
11457
+# endif
11458
+# ifndef TARGET_ASM_UNALIGNED_SI_OP
11459
+#  define TARGET_ASM_UNALIGNED_SI_OP "\t.4b0te\t"
11460
+# endif
11461
+# ifndef TARGET_ASM_UNALIGNED_DI_OP
11462
+#  define TARGET_ASM_UNALIGNED_DI_OP "\t.8byte\t"
11463
+# endif
11464
+# define TARGET_ASM_UNALIGNED_TI_OP NULL
11465
 #else
11466
-#define TARGET_ASM_UNALIGNED_HI_OP NULL
11467
-#define TARGET_ASM_UNALIGNED_SI_OP NULL
11468
-#define TARGET_ASM_UNALIGNED_DI_OP NULL
11469
-#define TARGET_ASM_UNALIGNED_TI_OP NULL
11470
+# ifndef TARGET_ASM_UNALIGNED_HI_OP
11471
+#  define TARGET_ASM_UNALIGNED_HI_OP NULL
11472
+# endif
11473
+# ifndef TARGET_ASM_UNALIGNED_SI_OP
11474
+#  define TARGET_ASM_UNALIGNED_SI_OP NULL
11475
+# endif
11476
+# ifndef TARGET_ASM_UNALIGNED_DI_OP
11477
+#  define TARGET_ASM_UNALIGNED_DI_OP NULL
11478
+# endif
11479
+# define TARGET_ASM_UNALIGNED_TI_OP NULL
11480
 #endif /* OBJECT_FORMAT_ELF */
11481
 
11482
+#ifndef        TARGET_ASM_UNALIGNED_TI_OP
11483
+#define TARGET_ASM_UNALIGNED_TI_OP NULL
11484
+#endif
11485
+
11486
 #if !defined(TARGET_ASM_CONSTRUCTOR) && !defined(USE_COLLECT2)
11487
 # ifdef CTORS_SECTION_ASM_OP
11488
 #  define TARGET_ASM_CONSTRUCTOR default_ctor_section_asm_out_constructor
11489 102 dgisselq
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
11490
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
11491
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
11492
@@ -503,6 +503,11 @@
11493
        return 0
11494
     }
11495
 
11496
+    # Zip CPU doesn't support profiling (yet)
11497
+    if { [istarget zip*] }
11498
+        return 0
11499
+    }
11500
+
11501
     # MinGW does not support -p.
11502
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
11503
        return 0
11504
@@ -986,6 +991,12 @@
11505
        }]
11506
     }
11507
 
11508
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
11509
+    # set supports it, the CPU just isn't ready yet.
11510
+    if { [istarget zip*-*-*] } {
11511
+        return 0
11512
+    }
11513
+
11514
     # This proc is actually checking the availabilty of FPU
11515
     # support for doubles, so on the RX we must fail if the
11516
     # 64-bit double multilib has been selected.
11517
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
11518
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
11519
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
11520
@@ -972,7 +972,7 @@
11521
     {
11522
       if (val & 1)
11523
        {
11524
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
11525
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
11526
          result += powi_lookup_cost (digit, cache)
11527
                    + POWI_WINDOW_SIZE + 1;
11528
          val >>= POWI_WINDOW_SIZE;
11529
@@ -1012,7 +1012,7 @@
11530
     }
11531
   else if (n & 1)
11532
     {
11533
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
11534
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
11535
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
11536
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
11537
     }
11538
@@ -1651,7 +1651,7 @@
11539
 };
11540
 
11541
 #define BITS_PER_MARKER 8
11542
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
11543
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
11544
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
11545
 #define HEAD_MARKER(n, size) \
11546
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
11547
@@ -1687,7 +1687,7 @@
11548
   /* Zero out the extra bits of N in order to avoid them being shifted
11549
      into the significant bits.  */
11550
   if (size < 64 / BITS_PER_MARKER)
11551
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11552
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11553
 
11554
   switch (code)
11555
     {
11556
@@ -1714,7 +1714,7 @@
11557
     }
11558
   /* Zero unused bits for size.  */
11559
   if (size < 64 / BITS_PER_MARKER)
11560
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11561
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11562
   return true;
11563
 }
11564
 
11565
@@ -1761,7 +1761,7 @@
11566
   n->n = CMPNOP;
11567
 
11568
   if (size < 64 / BITS_PER_MARKER)
11569
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11570
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11571
 
11572
   return true;
11573
 }
11574
@@ -2020,7 +2020,7 @@
11575
          {
11576
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
11577
            uint64_t val = int_cst_value (rhs2), mask = 0;
11578
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
11579
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
11580
 
11581
            /* Only constants masking full bytes are allowed.  */
11582
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
11583
@@ -2064,7 +2064,7 @@
11584
              {
11585
                /* If STMT casts to a smaller type mask out the bits not
11586
                   belonging to the target type.  */
11587
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
11588
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
11589
              }
11590
            n->type = type;
11591
            if (!n->base_addr)
11592
@@ -2177,7 +2177,7 @@
11593
     {
11594
       uint64_t mask;
11595
 
11596
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
11597
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
11598
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
11599
       cmpnop &= mask;
11600
     }
11601
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
11602
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
11603 117 dgisselq
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-31 18:55:03.584197958 -0400
11604 102 dgisselq
@@ -143,6 +143,13 @@
11605
 #include "rtl-iter.h"
11606
 #include "fibonacci_heap.h"
11607
 
11608 117 dgisselq
+#ifdef DO_ZIP_DEBUGS
11609 102 dgisselq
+#include <stdio.h>
11610
+extern void zip_debug_rtx(const_rtx);
11611
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11612
+#else
11613
+#define ZIP_DEBUG_LINE(STR,RTX)
11614
+#endif
11615
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
11616
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
11617
 
11618
@@ -6356,6 +6363,7 @@
11619
                machine_mode indmode
11620
                  = TYPE_MODE (TREE_TYPE (argtype));
11621
                rtx mem = gen_rtx_MEM (indmode, x);
11622
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
11623
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
11624
                if (val && cselib_preserved_value_p (val))
11625
                  {
11626
@@ -6462,12 +6470,14 @@
11627
       machine_mode mode
11628
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
11629
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
11630
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
11631
       HOST_WIDE_INT token
11632
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
11633
       if (token)
11634
        clobbered = plus_constant (mode, clobbered,
11635
                                   token * GET_MODE_SIZE (mode));
11636
       clobbered = gen_rtx_MEM (mode, clobbered);
11637
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
11638
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
11639
       call_arguments
11640
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
11641
@@ -9790,6 +9800,7 @@
11642
              machine_mode indmode
11643
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
11644
              rtx mem = gen_rtx_MEM (indmode, incoming);
11645
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
11646
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
11647
                                                         VOIDmode,
11648
                                                         get_insns ());
11649
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
11650
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
11651
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
11652
@@ -195,6 +195,9 @@
11653
 tic6x-*-*)
11654
        cpu_type=c6x
11655
        ;;
11656
+zip*)
11657
+       cpu_type=zip
11658
+       ;;
11659
 esac
11660
 
11661
 # Common parts for widely ported systems.
11662
@@ -1300,6 +1303,9 @@
11663
        echo "*** Configuration ${host} not supported" 1>&2
11664
        exit 1
11665
        ;;
11666
+zip*)
11667
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
11668
+       ;;
11669
 esac
11670
 
11671
 case ${host} in
11672
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
11673
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
11674
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
11675
@@ -150,6 +150,9 @@
11676
        # Need to link with -lpthread so libgomp.so is self-contained.
11677
        XLDFLAGS="${XLDFLAGS} -lpthread"
11678
        ;;
11679
+  zip*)
11680
+        config_path="bsd posix"
11681
+        ;;
11682
 
11683
   *)
11684
        ;;

powered by: WebSVN 2.1.0

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