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

Subversion Repositories zipcpu

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

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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h       2016-10-19 11:02:11.471843057 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h     2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h      2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h       2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/bfin/linux.h  2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/cris/linux.h  2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h        2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/frv/linux.h   2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/gnu.h    2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h   2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux64.h        2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/i386/linux.h  2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/ia64/linux.h  2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h    2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/linux.h       2016-10-19 11:02:11.783840959 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h    2016-10-19 11:02:11.787840932 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/m68k/linux.h  2016-10-19 11:02:11.787840932 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h    2016-10-19 11:02:11.787840932 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/mips/linux.h  2016-10-19 11:02:11.787840932 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h       2016-10-19 11:02:11.787840932 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-10-19 11:02:11.787840932 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h      2016-10-19 11:02:11.787840932 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h        2016-10-19 11:02:11.891840233 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/s390/linux.h  2016-10-19 11:02:11.891840233 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/sh/linux.h    2016-10-19 11:02:11.891840233 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h       2016-10-19 11:02:12.023839345 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-10-19 11:02:12.023839345 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/vax/linux.h   2016-10-19 11:02:12.023839345 -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 191 dgisselq
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h        2016-10-19 11:02:12.023839345 -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 171 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/notes.txt gcc-5.3.0-zip/gcc/config/zip/notes.txt
647
--- gcc-5.3.0-original/gcc/config/zip/notes.txt 1969-12-31 19:00:00.000000000 -0500
648
+++ gcc-5.3.0-zip/gcc/config/zip/notes.txt      2016-08-17 23:00:25.714139174 -0400
649
@@ -0,0 +1,6 @@
650
+signum:
651
+       CMP       0,%1
652
+       LDILO.GT  1,%1
653
+       LDILO.LT -1,%1
654
+
655
+
656 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/t-zip gcc-5.3.0-zip/gcc/config/zip/t-zip
657
--- gcc-5.3.0-original/gcc/config/zip/t-zip     1969-12-31 19:00:00.000000000 -0500
658
+++ gcc-5.3.0-zip/gcc/config/zip/t-zip  2016-02-04 19:00:59.939652587 -0500
659
@@ -0,0 +1,47 @@
660
+################################################################################
661
+##
662
+## Filename:   t-zip
663
+##
664
+## Project:    Zip CPU backend for the GNU Compiler Collection
665
+##
666
+## Purpose:
667
+##
668
+## Creator:    Dan Gisselquist, Ph.D.
669
+##             Gisselquist Technology, LLC
670
+##
671
+################################################################################
672
+##
673
+## Copyright (C) 2016, Gisselquist Technology, LLC
674
+##
675
+## This program is free software (firmware): you can redistribute it and/or
676
+## modify it under the terms of  the GNU General Public License as published
677
+## by the Free Software Foundation, either version 3 of the License, or (at
678
+## your option) any later version.
679
+##
680
+## This program is distributed in the hope that it will be useful, but WITHOUT
681
+## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
682
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
683
+## for more details.
684
+##
685
+## You should have received a copy of the GNU General Public License along
686
+## with this program.  (It's in the $(ROOT)/doc directory, run make with no
687
+## target there if the PDF file isn't present.)  If not, see
688
+## <http://www.gnu.org/licenses/> for a copy.
689
+##
690
+## License:    GPL, v3, as defined and found on www.gnu.org,
691
+##             http://www.gnu.org/licenses/gpl.html
692
+##
693
+##
694
+################################################################################
695
+
696
+FPBIT = fp-bit.c
697
+DPBIT = dp-bit.c
698
+
699
+# dp-bit.c: $(srcdir)/config/fp-bit.c
700
+       # cat $(srcdir)/config/fp-bit.c > dp-bit.c
701
+#
702
+# fp-bit.c: $(srcdir)/config/fp-bit.c
703
+       # echo '#define FLOAT" > fp-bit.c
704
+       # cat $(srcdir)/config/fp-bit.c >> fp-bit.c
705
+
706
+
707
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.c gcc-5.3.0-zip/gcc/config/zip/zip.c
708
--- gcc-5.3.0-original/gcc/config/zip/zip.c     1969-12-31 19:00:00.000000000 -0500
709 191 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c  2016-09-13 15:36:22.342322803 -0400
710
@@ -0,0 +1,2291 @@
711 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
712
+//
713
+// Filename:   zip.c
714
+//
715
+// Project:    Zip CPU backend for the GNU Compiler Collection
716
+//
717
+// Purpose:
718
+//
719
+// Creator:    Dan Gisselquist, Ph.D.
720
+//             Gisselquist Technology, LLC
721
+//
722
+////////////////////////////////////////////////////////////////////////////////
723
+//
724
+// Copyright (C) 2016, Gisselquist Technology, LLC
725
+//
726
+// This program is free software (firmware): you can redistribute it and/or
727
+// modify it under the terms of  the GNU General Public License as published
728
+// by the Free Software Foundation, either version 3 of the License, or (at
729
+// your option) any later version.
730
+//
731
+// This program is distributed in the hope that it will be useful, but WITHOUT
732
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
733
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
734
+// for more details.
735
+//
736
+// You should have received a copy of the GNU General Public License along
737
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
738
+// target there if the PDF file isn't present.)  If not, see
739
+// <http://www.gnu.org/licenses/> for a copy.
740
+//
741
+// License:    GPL, v3, as defined and found on www.gnu.org,
742
+//             http://www.gnu.org/licenses/gpl.html
743
+//
744
+//
745
+////////////////////////////////////////////////////////////////////////////////
746
+#include "config.h"
747
+#include "system.h"
748
+#include "coretypes.h"
749
+#include "tm.h"
750
+#include "rtl.h"
751
+#include "dominance.h"
752
+#include "cfg.h"
753
+#include "cfgrtl.h"
754
+#include "cfganal.h"
755
+#include "lcm.h"
756
+#include "cfgbuild.h"
757
+#include "cfgcleanup.h"
758
+#include "predict.h"
759
+#include "basic-block.h"
760
+#include "df.h"
761
+#include "hashtab.h"
762
+#include "hash-set.h"
763
+#include "machmode.h"
764
+#include "symtab.h"
765
+#include "rtlhash.h"
766
+#include "tree.h"
767
+#include "regs.h"
768
+#include "hard-reg-set.h"
769
+#include "real.h"
770
+#include "insn-config.h"
771
+#include "conditions.h"
772
+#include "output.h"
773
+#include "insn-attr.h"
774
+#include "flags.h"
775
+#include "expr.h"
776
+#include "function.h"
777
+#include "recog.h"
778
+#include "toplev.h"
779
+#include "ggc.h"
780
+#include "builtins.h"
781
+#include "calls.h"
782
+#include "langhooks.h"
783
+#include "optabs.h"
784
+#include "explow.h"
785
+#include "emit-rtl.h"
786 122 dgisselq
+#include "ifcvt.h"
787 102 dgisselq
+
788
+// #include "tmp_p.h"
789
+#include "target.h"
790
+#include "target-def.h"
791
+// #include "tm-constrs.h"
792 122 dgisselq
+#include "tm-preds.h"
793 102 dgisselq
+
794
+#include "diagnostic.h"
795
+// #include "integrate.h"
796
+
797
+// static int  zip_arg_partial_bytes(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
798
+// static      bool    zip_pass_by_reference(CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
799
+static bool    zip_return_in_memory(const_tree, const_tree);
800
+static bool    zip_frame_pointer_required(void);
801
+
802
+static void zip_function_arg_advance(cumulative_args_t ca, enum machine_mode mode,
803
+               const_tree type, bool named);
804
+static rtx zip_function_arg(cumulative_args_t ca, enum machine_mode mode, const_tree type, bool named);
805
+
806
+static void    zip_asm_trampoline_template(FILE *);
807
+static void    zip_trampoline_init(rtx, tree, rtx);
808
+static void    zip_init_builtins(void);
809
+static tree zip_builtin_decl(unsigned, bool);
810
+// static void zip_asm_output_anchor(rtx x);
811
+       void    zip_asm_output_def(FILE *s, const char *n, const char *v);
812
+static rtx     zip_expand_builtin(tree exp, rtx target, rtx subtarget,
813
+                       enum machine_mode tmode, int    ignore);
814
+static bool    zip_scalar_mode_supported_p(enum machine_mode mode);
815
+static bool    zip_libgcc_floating_mode_supported_p(enum machine_mode mode);
816
+static int     zip_address_cost(rtx addr, enum machine_mode mode, addr_space_t as, bool spd);
817
+static bool    zip_mode_dependent_address_p(const_rtx addr, addr_space_t);
818
+static unsigned HOST_WIDE_INT  zip_const_anchor = 0x20000;
819 122 dgisselq
+static          HOST_WIDE_INT  zip_min_opb_imm = -0x20000;
820
+static          HOST_WIDE_INT  zip_max_opb_imm =  0x1ffff;
821 142 dgisselq
+static          HOST_WIDE_INT  zip_min_anchor_offset = -0x2000;
822
+static          HOST_WIDE_INT  zip_max_anchor_offset =  0x1fff;
823 102 dgisselq
+static          HOST_WIDE_INT  zip_min_mov_offset = -0x1000;
824
+static          HOST_WIDE_INT  zip_max_mov_offset =  0x0fff;
825
+static int     zip_sched_issue_rate(void) { return 1; }
826
+static bool    zip_legitimate_address_p(machine_mode, rtx, bool);
827
+static bool    zip_legitimate_move_operand_p(machine_mode, rtx, bool);
828
+       void    zip_debug_rtx_pfx(const char *, const_rtx x);
829
+       void    zip_debug_rtx(const_rtx x);
830
+static void    zip_override_options(void);
831
+static bool    zip_can_eliminate(int from ATTRIBUTE_UNUSED, int to);
832
+static int     zip_memory_move_cost(machine_mode, reg_class_t, bool);
833 111 dgisselq
+static rtx     zip_legitimize_address(rtx x, rtx oldx, machine_mode mode);
834 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void);
835 122 dgisselq
+#ifdef HAVE_cc0
836
+       void    zip_update_cc_notice(rtx exp, rtx_insn *insn);
837
+#error "We're not supposed to have CC0 anymore"
838
+#else
839
+static bool    zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b);
840
+#endif
841 102 dgisselq
+
842
+
843 103 dgisselq
+#define        ALL_DEBUG_OFF   false
844 102 dgisselq
+#define        ALL_DEBUG_ON    false
845
+
846
+enum ZIP_BUILTIN_ID_CODE {
847
+       ZIP_BUILTIN_RTU,
848
+       ZIP_BUILTIN_HALT,
849
+       ZIP_BUILTIN_IDLE,
850
+       ZIP_BUILTIN_SYSCALL,
851
+       ZIP_BUILTIN_SAVE_CONTEXT,
852
+       ZIP_BUILTIN_RESTORE_CONTEXT,
853
+       ZIP_BUILTIN_BITREV,
854
+       ZIP_BUILTIN_CC,
855 117 dgisselq
+       ZIP_BUILTIN_UCC,
856 171 dgisselq
+       ZIP_BUILTIN_BUSY,
857 102 dgisselq
+       ZIP_BUILTIN_MAX
858
+};
859
+
860
+static GTY (()) tree   zip_builtins[(int)ZIP_BUILTIN_MAX];
861
+static enum insn_code  zip_builtins_icode[(int)ZIP_BUILTIN_MAX];
862
+
863
+
864
+#include "gt-zip.h"
865
+
866
+/* The Global 'targetm' Variable. */
867
+struct gcc_target      targetm = TARGET_INITIALIZER;
868
+
869
+
870
+enum   reg_class zip_reg_class(int);
871
+
872
+#define        LOSE_AND_RETURN(msgid, x)               \
873
+       do {                                    \
874
+               zip_operand_lossage(msgid, x);  \
875
+               return;                         \
876
+       } while(0)
877
+
878
+/* Per-function machine data. */
879
+struct GTY(()) machine_function
880
+{
881
+       /* number of pretented arguments for varargs */
882
+       int     pretend_size;
883
+
884
+       /* Number of bytes saved on the stack for local variables. */
885
+       int     local_vars_size;
886
+
887
+       /* Number of bytes saved on stack for register save area */
888
+       int     saved_reg_size;
889
+       int     save_ret;
890
+
891
+       int     sp_fp_offset;
892
+       bool    fp_needed;
893
+       int     size_for_adjusting_sp;
894
+};
895
+
896
+/* Allocate a chunk of memory for per-function machine-dependent data. */
897
+
898
+static struct machine_function *
899
+zip_init_machine_status(void) {
900
+       return ggc_cleared_alloc<machine_function>();
901
+}
902
+
903
+static void
904
+zip_override_options(void)
905
+{
906
+       init_machine_status = zip_init_machine_status;
907
+}
908
+
909
+enum   reg_class
910
+zip_reg_class(int regno)
911
+{
912
+       if (is_ZIP_GENERAL_REG(regno)) {
913
+               return GENERAL_REGS;
914
+       } else if (is_ZIP_REG(regno)) {
915
+               return ALL_REGS;
916
+       } return NO_REGS;
917
+}
918
+
919
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
920
+static bool
921
+zip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED) {
922
+       const   HOST_WIDE_INT size = int_size_in_bytes(type);
923
+       return (size == -1)||(size > UNITS_PER_WORD);
924
+}
925
+
926
+/* Emit an error emssage when we're in an asm, and a fatal error for "normal"
927
+ * insn.  Formatted output isn't easily implemented, since we use output operand
928
+ * lossage to output the actual message and handle the categorization of the
929
+ * error.  */
930
+
931
+static void
932
+zip_operand_lossage(const char *msgid, rtx op) {
933
+       fprintf(stderr, "Operand lossage??\n");
934
+       debug_rtx(op);
935
+       zip_debug_rtx(op);
936
+       output_operand_lossage("%s", msgid);
937
+}
938
+
939
+/* The PRINT_OPERAND_ADDRESS worker.   */
940
+void
941
+zip_print_operand_address(FILE *file, rtx x) {
942
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
943
+
944
+       if (dbg) zip_debug_rtx(x);
945
+       switch(GET_CODE(x)) {
946
+               case REG:
947 127 dgisselq
+                       gcc_assert(is_ZIP_REG(REGNO(x)));
948 171 dgisselq
+                       gcc_assert(REGNO(x) < 16);
949 102 dgisselq
+                       fprintf(file, "(%s)", reg_names[REGNO(x)]);
950
+                       break;
951
+               case SYMBOL_REF:
952
+                       fprintf(file, "%s", XSTR(x,0));
953
+                       break;
954
+               case LABEL_REF:
955
+                       x = LABEL_REF_LABEL(x);
956
+               case CODE_LABEL:
957
+                       { char buf[256];
958
+                       ASM_GENERATE_INTERNAL_LABEL(buf, "L", CODE_LABEL_NUMBER(x));
959
+#ifdef ASM_OUTPUT_LABEL_REF
960
+                       ASM_OUTPUT_LABEL_REF(file, buf);
961
+#else
962
+                       assemble_name(file, buf);
963
+#endif
964
+                       }
965
+                       break;
966
+               case PLUS:
967 111 dgisselq
+                       if (!REG_P(XEXP(x, 0))) {
968
+                               fprintf(stderr, "Unsupported address construct\n");
969
+                               zip_debug_rtx(x);
970 102 dgisselq
+                               abort();
971 127 dgisselq
+                       } gcc_assert(is_ZIP_REG(REGNO(XEXP(x,0))));
972 171 dgisselq
+                       gcc_assert(REGNO(XEXP(x,0))<16);
973 127 dgisselq
+                       if (CONST_INT_P(XEXP(x, 1))) {
974 102 dgisselq
+                               if (INTVAL(XEXP(x,1))!=0) {
975
+                                       fprintf(file, "%ld(%s)",
976 135 dgisselq
+                                       (long)INTVAL(XEXP(x, 1)),
977 102 dgisselq
+                                       reg_names[REGNO(XEXP(x, 0))]);
978
+                               } else {
979
+                                       fprintf(file, "(%s)",
980
+                                       reg_names[REGNO(XEXP(x, 0))]);
981
+                               }
982
+                       } else if (GET_CODE(XEXP(x,1)) == SYMBOL_REF) {
983
+                               fprintf(file, "%s(%s)", XSTR(x,0),
984
+                                       reg_names[REGNO(XEXP(x, 0))]);
985
+                       } else if ((GET_CODE(XEXP(x, 1)) == MINUS)
986
+                               && (GET_CODE(XEXP(XEXP(x, 1), 0))==SYMBOL_REF)
987
+                               && (GET_CODE(XEXP(XEXP(x, 1), 1))==SYMBOL_REF)) {
988
+                               fprintf(file, "%s-%s(%s)",
989
+                                       XSTR(XEXP(XEXP(x, 1),0),0),
990
+                                       XSTR(XEXP(XEXP(x, 1),1),0),
991
+                                       reg_names[REGNO(XEXP(x, 0))]);
992
+                       } else
993
+                               fprintf(file, "#INVALID(%s)",
994
+                                       reg_names[REGNO(XEXP(x, 0))]);
995
+                       /*
996
+                       else if (GET_CODE(XEXP(addr, 1)) == LABEL)
997
+                               fprintf(file, "%s(%s)",
998
+                                       GET_CODE(XEXP(addr, 1)),
999
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
1000
+                       else if ((GET_CODE(XEXP(addr, 1)) == MINUS)
1001
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 0))==LABEL)
1002
+                               && (GET_CODE(XEXP(GET_CODE(XEXP(addr, 1)), 1))==LABEL)) {
1003
+                               fprintf(file, "%s-%s(%s)",
1004
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
1005
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
1006
+                                       reg_names[REGNO(GET_CODE(XEXP(addr, 0)))]);
1007
+                       }
1008
+                       */
1009
+                       break;
1010
+               // We don't support direct memory addressing within our
1011
+               // instruction set, even though the instructions themselves
1012
+               // would support direct memory addressing of the lower 18 bits
1013
+               // of memory space.
1014
+               case MEM:
1015
+                       if (dbg) zip_debug_rtx(x);
1016
+                       zip_print_operand_address(file, XEXP(x, 0));
1017
+                       break;
1018 111 dgisselq
+               case CONST_INT:
1019 135 dgisselq
+                       fprintf(file, "%ld",(long)INTVAL(x));
1020 111 dgisselq
+                       break;
1021 102 dgisselq
+               default:
1022 111 dgisselq
+                       fprintf(stderr, "Unknown address format\n");
1023
+                       zip_debug_rtx(x);
1024 102 dgisselq
+                       abort(); break;
1025
+                       // output_addr_const(file, x);
1026
+               break;
1027
+       }
1028
+}
1029
+
1030
+/* The PRINT_OPERAND worker. */
1031
+
1032
+void
1033
+zip_print_operand(FILE *file, rtx x, int code)
1034
+{
1035
+       rtx operand = x;
1036
+       int     rgoff = 0;
1037
+
1038
+       // fprintf(file, "Print Operand!\n");
1039
+
1040
+       /* New code entries should just be added to the switch below.  If
1041
+        * handling is finished, just return.  If handling was just a
1042
+        * modification of the operand, the modified operand should be put in
1043
+        * "operand", and then do a break to let default handling
1044
+        * (zero-modifier) output the operand.
1045
+        */
1046
+       switch(code) {
1047
+               case 0:
1048
+                       /* No code, print as usual. */
1049
+                       break;
1050
+               case 'L':
1051
+                       /* Lower of two registers, print one up */
1052
+                       rgoff = 1;
1053
+                       break;
1054
+               case 'R':
1055
+               case 'H':
1056
+                       /* Higher of a register pair, print normal */
1057
+                       break;
1058
+
1059
+               default:
1060
+                       LOSE_AND_RETURN("invalid operand modifier letter", x);
1061
+       }
1062
+
1063
+       /* Print an operand as without a modifier letter. */
1064
+       switch (GET_CODE(operand)) {
1065
+       case REG:
1066
+               if (REGNO(operand)+rgoff >= FIRST_PSEUDO_REGISTER)
1067
+                       internal_error("internal error: bad register: %d", REGNO(operand));
1068
+               fprintf(file, "%s", reg_names[REGNO(operand)+rgoff]);
1069
+               return;
1070
+       case SCRATCH:
1071
+               LOSE_AND_RETURN("Need a scratch register", x);
1072
+               return;
1073
+
1074
+       case CODE_LABEL:
1075
+       case LABEL_REF:
1076
+       case SYMBOL_REF:
1077
+       case PLUS:
1078
+               PRINT_OPERAND_ADDRESS(file, operand);
1079
+               return;
1080
+       case MEM:
1081
+               PRINT_OPERAND_ADDRESS(file, XEXP(operand, 0));
1082
+               return;
1083
+
1084
+       default:
1085
+               /* No need to handle all strange variants, let
1086
+                * output_addr_const do it for us.
1087
+                */
1088
+               if (CONSTANT_P(operand)) {
1089
+                       output_addr_const(file, operand);
1090
+                       return;
1091
+               }
1092
+
1093
+               LOSE_AND_RETURN("unexpected operand", x);
1094
+       }
1095
+}
1096
+
1097
+static bool
1098
+zip_frame_pointer_required(void)
1099
+{
1100
+       // This should really depend upon whether we have variable sized
1101
+       // arguments in our frame or not.  Once this fails, let's look
1102
+       // at what the problem was and then whether or not we can detect
1103
+       // it.
1104
+       //
1105
+       // Use a GCC global to determine our answer
1106 103 dgisselq
+       if (cfun->calls_alloca)
1107
+               return true;
1108 102 dgisselq
+       return (frame_pointer_needed);
1109
+/*
1110
+*/
1111
+}
1112
+
1113
+/* Determine whether or not a register needs to be saved on the stack or not.
1114
+ */
1115
+static bool
1116
+zip_save_reg(int regno) {
1117
+       if (regno == 0)
1118
+               return ((!crtl->is_leaf)
1119
+                       ||((df_regs_ever_live_p(0))&&(!call_used_regs[0])));
1120
+       else if ((regno == zip_GOT)&&(!ZIP_PIC))
1121
+               return  ((df_regs_ever_live_p(regno))
1122
+                               &&(!call_used_regs[regno]));
1123
+       else if (regno == zip_FP)
1124
+               return((zip_frame_pointer_required())||((df_regs_ever_live_p(regno))
1125
+                               &&(!call_used_regs[regno])));
1126
+       else if (regno < zip_FP)
1127
+               return  ((df_regs_ever_live_p(regno))
1128
+                               &&(!call_used_regs[regno]));
1129
+       return false;
1130
+}
1131
+
1132
+/* Compute the size of the local area and the size to be adjusted by the
1133
+ * prologue and epilogue.
1134
+ *
1135
+ * Here's what we are looking at (top is the current, bottom is the last ...)
1136
+ *
1137
+ *     Stack Pointer ->
1138 124 dgisselq
+ *                     Outgoing arguments
1139 102 dgisselq
+ *                     Local variables (could be variable size)
1140
+ *     Frame Pointer ->        (= Stack Pointer + sp_fp_offset)
1141
+ *                     Saved return address, if saved
1142
+ *                     Other Saved registers
1143
+ *                     Saved frame pointer (if used)
1144
+ *                     Saved R12, if used
1145
+ *                     (Stack pointer is not saved)
1146 171 dgisselq
+ *                     (PRETEND-ARGS)
1147 102 dgisselq
+ *     Original stack pointer ->       (= Stack_Pointer +size_for_adjusting_sp)
1148
+ *                     Called arguments (not passed in registers)
1149
+ *                     Return arguments (not R1, args.pretend_args_size)
1150
+ *             (Prior function's stack frame ... )
1151
+ *
1152
+ */
1153
+static void
1154
+zip_compute_frame(void) {
1155
+       int     regno;
1156
+       int     args_size;
1157 124 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1158 102 dgisselq
+
1159 171 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-COMPUTE-FRAME: %s\n", current_function_name());
1160 102 dgisselq
+       // gcc_assert(crtl);
1161
+       gcc_assert(cfun);
1162
+       gcc_assert(cfun->machine);
1163
+
1164
+       args_size=(ACCUMULATE_OUTGOING_ARGS ? crtl->outgoing_args_size : 0);
1165
+
1166
+       if(crtl->args.pretend_args_size > 0) {
1167
+               args_size += crtl->args.pretend_args_size;
1168 171 dgisselq
+               if (dbg) fprintf(stderr, "%s pretend_args_size : %d\n", current_function_name(),
1169
+                       crtl->args.pretend_args_size);
1170 102 dgisselq
+               cfun->machine->pretend_size = crtl->args.pretend_args_size;
1171
+       }
1172
+
1173
+       cfun->machine->local_vars_size = get_frame_size();
1174
+
1175
+       // Save callee-saved registers.
1176
+       cfun->machine->saved_reg_size = 0;
1177
+       for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1178
+               if (zip_save_reg(regno))
1179
+                       cfun->machine->saved_reg_size ++;
1180
+       }
1181
+
1182
+       cfun->machine->fp_needed = (zip_frame_pointer_required());
1183
+
1184
+       if ((cfun->machine->fp_needed)&&
1185
+                       (!df_regs_ever_live_p(zip_FP))) {
1186
+               cfun->machine->saved_reg_size ++;
1187
+       }
1188
+
1189 171 dgisselq
+       cfun->machine->sp_fp_offset = crtl->outgoing_args_size
1190
+                               + cfun->machine->local_vars_size;
1191 102 dgisselq
+       cfun->machine->size_for_adjusting_sp = cfun->machine->local_vars_size
1192
+                       + cfun->machine->saved_reg_size
1193
+                       + args_size;
1194 124 dgisselq
+       if(dbg) {
1195 171 dgisselq
+               fprintf(stderr, "\t---- STACK PTR ----\n");
1196
+               fprintf(stderr, "\tOUTGOIN-SIZE: %d\n",
1197
+                       crtl->outgoing_args_size);
1198 124 dgisselq
+               fprintf(stderr, "\tLOCALS-SIZE : %d\n",
1199
+                       cfun->machine->local_vars_size);
1200 171 dgisselq
+               fprintf(stderr, "\t---- FRAME PTR ----%s\n",
1201
+                       cfun->machine->fp_needed?"":" (Eliminated)");
1202 124 dgisselq
+               fprintf(stderr, "\tREGISTERS   : %d\n",
1203
+                       cfun->machine->saved_reg_size);
1204 171 dgisselq
+               fprintf(stderr, "\tPRETEND SIZE: %d\n",
1205
+                       crtl->args.pretend_args_size);
1206
+               fprintf(stderr, "\t---- ARG PTR (Original SP, should be eliminated) ----\n");
1207
+               fprintf(stderr, "\t----\n");
1208
+               fprintf(stderr, "\tARGS-SIZE   : %d\n", args_size);
1209 124 dgisselq
+               fprintf(stderr, "\tSP_FP_OFFSET: %d\n",
1210
+                       cfun->machine->sp_fp_offset);
1211
+               fprintf(stderr, "\tSP-ADJUSTMNT: %d\n",
1212
+                       cfun->machine->size_for_adjusting_sp);
1213
+       }
1214 102 dgisselq
+}
1215
+
1216
+void
1217
+zip_expand_prologue(void) {
1218
+       rtx     insn;
1219
+
1220
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1221
+       zip_compute_frame();
1222
+
1223 124 dgisselq
+       if (dbg)  fprintf(stderr, "PROLOGUE: Computing Prologue instructions\n");
1224 127 dgisselq
+       if (dbg)  fprintf(stderr, "PROLOGUE: SP-FP offset is %d\n",
1225
+                       cfun->machine->sp_fp_offset);
1226 102 dgisselq
+       if (cfun->machine->size_for_adjusting_sp != 0) {
1227 138 dgisselq
+               insn = emit_insn(gen_subsi3_reg_clobber(stack_pointer_rtx,
1228 102 dgisselq
+                               stack_pointer_rtx,
1229
+                       gen_int_mode(cfun->machine->size_for_adjusting_sp,
1230
+                               SImode)));
1231
+                       // cfun->machine->sp_fp_offset
1232
+
1233
+               RTX_FRAME_RELATED_P(insn) = 1;
1234
+       }
1235
+
1236
+       {
1237
+               int offset = 0, regno;
1238
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1239
+                       if (zip_save_reg(regno)) {
1240 127 dgisselq
+                               if (dbg) fprintf(stderr,
1241
+                                       "PROLOGUE: Saving R%d in %d+%d(SP)\n",
1242
+                                       regno, cfun->machine->sp_fp_offset,
1243
+                                       offset);
1244 124 dgisselq
+                               insn=emit_insn(gen_movsi_sto_off(
1245
+                                       stack_pointer_rtx,
1246
+                                       GEN_INT(cfun->machine->sp_fp_offset
1247
+                                               +offset++),
1248 102 dgisselq
+                                       gen_rtx_REG(SImode, regno)));
1249
+                               RTX_FRAME_RELATED_P(insn) = 1;
1250
+                       }
1251
+               }
1252 103 dgisselq
+               if (dbg)  fprintf(stderr, "%d registers saved%s\n", offset,
1253
+                       (crtl->saves_all_registers)?", should be all of them":", less than all");
1254 102 dgisselq
+       }
1255
+
1256
+       if (cfun->machine->fp_needed) {
1257
+               if (dbg) zip_debug_rtx(stack_pointer_rtx);
1258
+               if (dbg) zip_debug_rtx(frame_pointer_rtx);
1259
+               insn = emit_insn(gen_movsi_reg_off(frame_pointer_rtx,
1260 124 dgisselq
+                               stack_pointer_rtx,
1261
+                               GEN_INT(cfun->machine->sp_fp_offset)));
1262 102 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1263 103 dgisselq
+               if (dbg)  fprintf(stderr, "sp_fp_offset is %d\n", cfun->machine->sp_fp_offset);
1264 102 dgisselq
+       }
1265
+}
1266
+
1267
+bool
1268
+zip_use_return_insn(void)
1269
+{
1270
+       if ((!reload_completed)||(cfun->machine->fp_needed)
1271
+                       ||(get_frame_size()!=0)) {
1272
+               // If R0 ever gets pushed to the stack, then we cannot
1273
+               // use a master return from anywhere.  We need to clean up the
1274
+               // stack first.
1275
+               if ((!crtl->is_leaf)||((df_regs_ever_live_p(0))
1276
+                                               &&(!call_used_regs[0]))) {
1277
+                       return false;
1278
+               }
1279
+       }
1280
+       zip_compute_frame();
1281
+       return (cfun->machine->size_for_adjusting_sp == 0);
1282
+}
1283
+
1284
+/* As per the notes in M68k.c, quote the function epilogue should not depend
1285
+ * upon the current stack pointer.  It should use the frame poitner only,
1286
+ * if there is a frame pointer.  This is mandatory because of alloca; we also
1287
+ * take advantage of it to omit stack adjustments before returning ...
1288
+ *
1289
+ * Let's see if we can use their approach here.
1290
+ *
1291
+ * We can't.  Consider our choices:
1292
+ *     LOD (FP),R0
1293
+ *     LOD 1(FP),R4
1294
+ *     LOD 2(FP),R5
1295
+ *     LOD 3(FP),R6
1296
+ *     LOD 4(FP),FP
1297
+ *     ... Then what is the stack pointer?
1298
+ * or
1299
+ *     LOD (FP),R0
1300
+ *     LOD 1(FP),R4
1301
+ *     LOD 2(FP),R5
1302
+ *     LOD 3(FP),R6
1303
+ *     MOV FP,SP
1304
+ *     LOD 4(SP),FP
1305
+ *     ... Which suffers unnecessary pipeline stalls, and certainly doesn't
1306
+ *     exploit our pipeline memory function
1307
+ * or
1308
+ *     MOV FP,SP
1309
+ *     LOD (SP),R0
1310
+ *     LOD 1(SP),R4
1311
+ *     LOD 2(SP),R5
1312
+ *     LOD 3(SP),R6
1313
+ *     LOD 4(SP),FP
1314
+ * Which will be our choice.  Note that we do use the stack pointer, eventually.
1315
+ *
1316
+ */
1317
+void
1318
+zip_expand_epilogue(void) {
1319
+       int     regno, offset;
1320
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1321 138 dgisselq
+       rtx     insn;
1322 102 dgisselq
+
1323
+       zip_compute_frame();
1324
+
1325
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1326
+       if (cfun->machine->fp_needed) {
1327 124 dgisselq
+               // This is done special--if you can't trust the stack pointer
1328
+               // enough so that you must have a frame pointer, then you can't
1329
+               // trust its offset enough to restore from it.  Hence, we start
1330
+               // by moving the frame pointer to the stack pointer to recover
1331
+               // the stack pointer back to a usable value.
1332 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
1333 138 dgisselq
+               insn = emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1334
+               RTX_FRAME_RELATED_P(insn) = 1;
1335 102 dgisselq
+       }
1336
+
1337
+       if (cfun->machine->saved_reg_size != 0) {
1338 124 dgisselq
+               if (cfun->machine->fp_needed)
1339
+                       offset = 0;
1340
+               else
1341
+                       offset = cfun->machine->sp_fp_offset;
1342 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1343
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1344
+                       if (zip_save_reg(regno)) {
1345
+                               if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
1346 138 dgisselq
+                               rtx reg = gen_rtx_REG(SImode, regno);
1347
+                               insn = emit_insn(gen_movsi_lod_off(
1348
+                                               reg,
1349 124 dgisselq
+                                               stack_pointer_rtx,
1350
+                                               GEN_INT(offset++)));
1351 138 dgisselq
+                               add_reg_note(insn, REG_CFA_RESTORE, reg);
1352
+                               RTX_FRAME_RELATED_P(insn) = 1;
1353 102 dgisselq
+                       }
1354
+               }
1355
+       }
1356
+
1357 124 dgisselq
+       if (cfun->machine->fp_needed) {
1358
+               // Restore the stack pointer back to the original, the
1359
+               // difference being the difference from the frame pointer
1360
+               // to the original stack
1361 138 dgisselq
+               insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
1362
+                       stack_pointer_rtx,
1363 124 dgisselq
+                       GEN_INT(cfun->machine->size_for_adjusting_sp
1364
+                               -cfun->machine->sp_fp_offset)));
1365 138 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1366 124 dgisselq
+       } else {
1367
+               // else now the difference is between the stack pointer and
1368
+               // the original stack pointer.
1369 102 dgisselq
+               if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
1370
+                               cfun->machine->size_for_adjusting_sp);
1371 138 dgisselq
+               insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
1372
+                       stack_pointer_rtx,
1373 124 dgisselq
+                       GEN_INT(cfun->machine->size_for_adjusting_sp)));
1374 138 dgisselq
+               RTX_FRAME_RELATED_P(insn) = 1;
1375 102 dgisselq
+       }
1376
+       if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
1377
+
1378 138 dgisselq
+       // The return RTX is not allowed to be frame related
1379
+       insn = emit_jump_insn(ret_rtx);
1380
+       // RTX_FRAME_RELATED_P(insn) = 1;
1381 102 dgisselq
+}
1382
+
1383 191 dgisselq
+void
1384
+zip_sibcall_epilogue(void) {
1385
+       int     regno, offset;
1386
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1387
+       rtx     insn;
1388
+
1389
+       zip_compute_frame();
1390
+
1391
+       if (dbg) fprintf(stderr, "EPILOG::\n");
1392
+       if (cfun->machine->fp_needed) {
1393
+               // This is done special--if you can't trust the stack pointer
1394
+               // enough so that you must have a frame pointer, then you can't
1395
+               // trust its offset enough to restore from it.  Hence, we start
1396
+               // by moving the frame pointer to the stack pointer to recover
1397
+               // the stack pointer back to a usable value.
1398
+               if (dbg) fprintf(stderr, "SIBCALL-EPILOG::Moving frame pointer to stack register\n");
1399
+               insn = emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
1400
+               RTX_FRAME_RELATED_P(insn) = 1;
1401
+       }
1402
+
1403
+       if (cfun->machine->saved_reg_size != 0) {
1404
+               if (cfun->machine->fp_needed)
1405
+                       offset = 0;
1406
+               else
1407
+                       offset = cfun->machine->sp_fp_offset;
1408
+               if (dbg) fprintf(stderr, "SIBCALL-EPILOG::Saved_REG_Size = %d\n", cfun->machine->saved_reg_size);
1409
+               for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
1410
+                       if (zip_save_reg(regno)) {
1411
+                               if (dbg) fprintf(stderr, "SIBCALL-EPILOG::RESTORING R%d\n", regno);
1412
+                               rtx reg = gen_rtx_REG(SImode, regno);
1413
+                               insn = emit_insn(gen_movsi_lod_off(
1414
+                                               reg,
1415
+                                               stack_pointer_rtx,
1416
+                                               GEN_INT(offset++)));
1417
+                               add_reg_note(insn, REG_CFA_RESTORE, reg);
1418
+                               RTX_FRAME_RELATED_P(insn) = 1;
1419
+                       }
1420
+               }
1421
+       }
1422
+
1423
+       if (cfun->machine->fp_needed) {
1424
+               // Restore the stack pointer back to the original, the
1425
+               // difference being the difference from the frame pointer
1426
+               // to the original stack
1427
+               insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
1428
+                       stack_pointer_rtx,
1429
+                       GEN_INT(cfun->machine->size_for_adjusting_sp
1430
+                               -cfun->machine->sp_fp_offset)));
1431
+               RTX_FRAME_RELATED_P(insn) = 1;
1432
+       } else {
1433
+               // else now the difference is between the stack pointer and
1434
+               // the original stack pointer.
1435
+               if (dbg) fprintf(stderr, "SIBCALL-EPILOG::ADDSI3(StackPtr, %d)\n",
1436
+                               cfun->machine->size_for_adjusting_sp);
1437
+               insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
1438
+                       stack_pointer_rtx,
1439
+                       GEN_INT(cfun->machine->size_for_adjusting_sp)));
1440
+               RTX_FRAME_RELATED_P(insn) = 1;
1441
+       }
1442
+}
1443
+
1444 102 dgisselq
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1445
+ *
1446
+ * We currently only support calculating the return address for the current
1447
+ * frame.
1448
+ */
1449
+
1450
+/*
1451
+rtx
1452
+zip_return_addr_rtx(int count, rtx frame ATTRIBUTE_UNUSED)
1453
+{
1454
+       if (count)
1455
+               return NULL_RTX;
1456
+
1457
+       zip_compute_frame();
1458
+
1459
+       // saved return address for current function is at fp - 1
1460
+       if (cfun->machine->save_ret)
1461
+               return gen_rtx_MEM(Pmode, plus_constant(frame_pointer_rtx,
1462
+                               -UNITS_PER_WORD));
1463
+       return get_hard_reg_initial_val(Pmode, RETURN_ADDRESS_REGNUM);
1464
+}
1465
+*/
1466
+
1467
+/* Implements the macro INITIAL_ELIMINATION_OFFSET,
1468
+ * return the OFFSET.
1469
+ */
1470
+int
1471
+zip_initial_elimination_offset(int from, int to) {
1472
+       int     ret = 0;
1473
+       zip_compute_frame();
1474
+
1475 171 dgisselq
+/*
1476 102 dgisselq
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1477
+               ret = cfun->machine->sp_fp_offset;
1478 117 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
1479 171 dgisselq
+               // Since the ARG_POINTER_REGNUM is defined to be identical
1480
+               // to the FRAME_POINTER_REGNUM, this "if" will never ever
1481
+               // get called.
1482 117 dgisselq
+               ret = cfun->machine->sp_fp_offset;
1483 102 dgisselq
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1484 171 dgisselq
+               // Since we define ARG_POINTER_REGNUM to be FRAME_POINTER_REGNUM
1485
+               // we're asked for the offset between the frame pointer and
1486
+               // itself.  The result had better be zero.
1487
+               //
1488 117 dgisselq
+               ret = 0;
1489 102 dgisselq
+       } else {
1490
+               abort();
1491
+       }
1492 171 dgisselq
+*/
1493 102 dgisselq
+
1494 171 dgisselq
+       // Let's try using an ARG_POINTER != FRAME_POINTER
1495
+       if (((from) == FRAME_POINTER_REGNUM)&&((to) == STACK_POINTER_REGNUM)) {
1496
+               ret = cfun->machine->sp_fp_offset;
1497
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==STACK_POINTER_REGNUM)) {
1498
+               // Since the ARG_POINTER_REGNUM is defined to be identical
1499
+               // to the FRAME_POINTER_REGNUM, this "if" will never ever
1500
+               // get called.
1501
+               ret = cfun->machine->size_for_adjusting_sp;
1502
+       } else if (((from)=ARG_POINTER_REGNUM)&&((to)==FRAME_POINTER_REGNUM)) {
1503
+               ret = cfun->machine->size_for_adjusting_sp
1504
+                       - cfun->machine->sp_fp_offset;
1505
+       } else {
1506
+               abort();
1507
+       }
1508
+
1509 102 dgisselq
+       return ret;
1510
+}
1511
+
1512
+/*
1513
+ * Code taken from m68k ...
1514
+ */
1515
+static bool
1516
+zip_can_eliminate(int from, int to)
1517
+{
1518
+       // fprintf(stderr, "CAN_ELIMINATE::QUERYING(%d,%d)\n", from, to);
1519
+       if ((from == zip_FP)&&(to == zip_SP))
1520
+               return !cfun->machine->fp_needed;
1521
+       return true;
1522
+}
1523
+
1524
+/*
1525
+static void
1526
+zip_basic_check(void)
1527
+{
1528
+       gcc_assert(mode_base_align[SImode]==4);
1529
+       if ((BITS_PER_UNIT != 32)
1530
+                       ||(GET_MODE_SIZE(SImode)!=1)
1531
+                       ||(GET_MODE_SIZE(DImode)!=1)
1532
+                       ||(HARD_REGNO_NREGS(0,SImode)!=1)) {
1533
+               printf("SIZEOF(SIMode) == %d\n", GET_MODE_SIZE(SImode));
1534
+               printf("BITS_PER_UNIT  == %d\n", BITS_PER_UNIT);
1535
+               gcc_assert(BITS_PER_UNIT==32);
1536
+               gcc_assert(GET_MODE_SIZE(SImode)==1);
1537
+               gcc_assert(HARD_REGNO_NREGS(0,SImode)==1);
1538
+       }
1539
+}
1540
+*/
1541
+
1542
+#define        zip_basic_check()
1543
+
1544 171 dgisselq
+/* Compute the number of word sized registers needed to hold a function
1545 102 dgisselq
+ * argument of mode INT_MODE and tree type TYPE.
1546
+ */
1547
+int
1548
+zip_num_arg_regs(enum machine_mode mode, const_tree type) {
1549
+       int     size;
1550
+
1551
+       zip_basic_check();
1552
+
1553
+       if (targetm.calls.must_pass_in_stack(mode, type))
1554
+               return 0;
1555
+
1556
+       if ((type)&&(mode == BLKmode))
1557
+               size = int_size_in_bytes(type);
1558
+       else
1559
+               size = GET_MODE_SIZE(mode);
1560
+
1561
+       return (size + UNITS_PER_WORD - 1)/UNITS_PER_WORD;
1562
+}
1563
+
1564
+static void
1565
+zip_function_arg_advance(cumulative_args_t ca, machine_mode mode,
1566
+               const_tree type, bool named ATTRIBUTE_UNUSED) {
1567
+       CUMULATIVE_ARGS *cum;
1568
+       int     nreg;
1569
+
1570
+       zip_basic_check();
1571
+
1572
+       cum = get_cumulative_args(ca);
1573
+       nreg = zip_num_arg_regs(mode, type);
1574
+       if (((*cum)+nreg) > NUM_ARG_REGS)
1575
+               (*cum) = NUM_ARG_REGS;
1576
+       else
1577
+               (*cum) += nreg;
1578
+}
1579
+
1580
+static rtx
1581
+zip_function_arg(cumulative_args_t ca, machine_mode mode,
1582
+               const_tree type ATTRIBUTE_UNUSED, bool named) {
1583
+       CUMULATIVE_ARGS *cum;
1584
+
1585
+       zip_basic_check();
1586
+
1587
+
1588
+       if (!named)
1589
+               return NULL_RTX;
1590
+       //if (targetm.calls.must_pass_in_stack(mode, type))
1591
+               //return NULL_RTX;
1592
+       cum = get_cumulative_args(ca);
1593
+
1594
+       if ((*cum) >= NUM_ARG_REGS)
1595
+               return NULL_RTX;
1596
+       return
1597
+               gen_rtx_REG(mode, (*cum)+1);
1598
+}
1599
+
1600 191 dgisselq
+/* DECL is the declaration of the function being targeted by the call, and EXP
1601
+ * is the CALL_EXPR representing the call.
1602
+ */
1603
+bool   zip_function_ok_for_sibcall(ATTRIBUTE_UNUSED tree decl, tree exp) {
1604
+       // calls.c already checks whether or not the parameter stack space
1605
+       // is identical, so ... let's hope this all works and find out.
1606
+
1607
+       //
1608
+       // Actually, this will fail:  If the sibling uses R5 to pass registers
1609
+       // in and we don't, then there will be no way to restore R5.  This is
1610
+       // true for the current configuration.  It will be true for future
1611
+       // configurations if the sibling ever uses a register that must be
1612
+       // saved as a parameter register.
1613
+       //
1614
+       // We can check this ... if we can count how many registers the
1615
+       // sibling call will use.
1616
+       //
1617
+       CUMULATIVE_ARGS cum_v;
1618
+       cumulative_args_t       cum;
1619
+       tree            parameter;
1620
+       machine_mode    mode;
1621
+       tree            ttype;
1622
+       rtx             parm_rtx;
1623
+       int             i;
1624
+       static const char zip_call_used_register[] = CALL_USED_REGISTERS;
1625
+
1626
+       INIT_CUMULATIVE_ARGS(cum_v, NULL, NULL, 0,0);
1627
+       cum = pack_cumulative_args(&cum_v);
1628
+       for (i=0; i<call_expr_nargs(exp); i++) {
1629
+
1630
+               parameter = CALL_EXPR_ARG(exp, i);
1631
+
1632
+               if ((!parameter) || (TREE_CODE(parameter)==ERROR_MARK))
1633
+                       return true;
1634
+               ttype = TREE_TYPE(parameter);
1635
+               gcc_assert(ttype);
1636
+               mode = ttype->type_common.mode;
1637
+
1638
+               if (pass_by_reference(&cum_v, mode, ttype, true)) {
1639
+                       mode = Pmode;
1640
+                       ttype = build_pointer_type(ttype);
1641
+               }
1642
+
1643
+               parm_rtx = zip_function_arg(cum, mode, ttype, 0);
1644
+               zip_function_arg_advance(cum, mode, ttype, 0);
1645
+               if (!parm_rtx)
1646
+                       continue;
1647
+
1648
+               // If it is a register
1649
+               //      and it is *NOT* a CALL_USED_REGISTER
1650
+               //      then we can't do this.
1651
+               //
1652
+               // Example: func(R1,..R4,R5)
1653
+               //      can be followed by func2(R1,.., up to R5)
1654
+               //      (not supported, though... just to simplify our test
1655
+               //      below)
1656
+               // Example: func(R1,..R4)
1657
+               //      cannot be followed by func2(R1,..,R5)
1658
+               //      We would blow R5 away by our prologue, even if it was
1659
+               //      properly set.
1660
+               // Example: func(R1,..R5)
1661
+               //      can be followed by func2(R1,.., up to R4)
1662
+               //      func2 may save R5 (which doesn't need saving) but that's
1663
+               //              irrelevant
1664
+               // Example: func(R1,..up to R4)
1665
+               //      can be followed by func2(R1,.., up to R4)
1666
+               //
1667
+               if (REG_P(parm_rtx)&&(REGNO(parm_rtx))
1668
+                               &&(REGNO(parm_rtx)<sizeof(zip_call_used_register))
1669
+                               &&(!zip_call_used_register[REGNO(parm_rtx)]))
1670
+                       return false;
1671
+       }
1672
+
1673
+       return true;
1674
+
1675
+       // We also need to check if the return types are the same ... or
1676
+       // will GCC handle that for us?
1677
+}
1678
+
1679 122 dgisselq
+void   zip_canonicalize_comparison(int *code, rtx *op0, rtx *op1,
1680
+               bool preserve_op0)
1681
+{
1682
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
1683 102 dgisselq
+
1684 122 dgisselq
+       if (dbg) fprintf(stderr, "CANONICALIZE ...%s\n", (preserve_op0)?"(Preserve Op0)":"");
1685
+       if (dbg) zip_debug_rtx_pfx("CODE", gen_rtx_fmt_ee((rtx_code)*code, VOIDmode, gen_rtx_REG(CCmode,zip_CC), const0_rtx));
1686
+       if (dbg) zip_debug_rtx_pfx("OP0 ", *op0);
1687
+       if (dbg) zip_debug_rtx_pfx("OP1 ", *op1);
1688
+
1689
+       if ((!preserve_op0)&&((*code == LE)||(*code == GTU)||(*code == GEU))) {
1690
+               rtx tem = *op0;
1691
+               *op0 = *op1;
1692
+               *op1 = tem;
1693
+               *code = (int)swap_condition((enum rtx_code)*code);
1694
+       }
1695
+
1696
+       if ((*code == LE)||(*code == LEU)||(*code == GTU)) {
1697
+               int offset = 1; // (*code == GTU) ? 1 : -1;
1698
+               bool    swap = false;
1699
+
1700
+               if (CONST_INT_P(*op1)) {
1701
+                       *op1 = GEN_INT(INTVAL(*op1)+offset);
1702
+                       swap = true;
1703
+               } else if (REG_P(*op1)) {
1704 138 dgisselq
+                       *op1 = plus_constant(GET_MODE(*op1), *op1, offset, true);
1705 122 dgisselq
+                       swap = true;
1706
+               } else if ((GET_CODE(*op1)==PLUS)&&(CONST_INT_P(XEXP(*op1,1)))){
1707
+                       *op1 = plus_constant(GET_MODE(*op1),XEXP(*op1,0),
1708
+                               INTVAL(XEXP(*op1,1))+offset);
1709
+                       swap = true;
1710
+               } if (swap) {
1711
+                       if (*code == LE)
1712
+                               (*code)= LT;
1713
+                       else if (*code == LEU)
1714
+                               (*code)= LTU;
1715
+                       else // (*code == GTU)
1716
+                               (*code) = GEU;
1717
+               }
1718
+       }
1719
+}
1720
+
1721
+static bool
1722
+zip_fixed_condition_code_regs(unsigned int *a, unsigned int *b) {
1723
+       *a = zip_CC;
1724
+       *b = INVALID_REGNUM;
1725
+       return true;
1726
+}
1727
+
1728
+
1729 102 dgisselq
+/* totally buggy - we can't return pointers to nested functions */
1730
+static void
1731
+zip_asm_trampoline_template(FILE *f) {
1732
+       // Whereas at one time I thought I wouldn't need it, now I know I
1733
+       // need this trampoline function, although it is for a completely
1734
+       // different purpose than the one I was familiar with.
1735 138 dgisselq
+       fprintf(f, "\tbrev\t0,r1\n");
1736
+       fprintf(f, "\tldilo\t0,r1\n");
1737 102 dgisselq
+       fprintf(f, "\tjmp r1\n");
1738
+}
1739
+
1740
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
1741
+static void
1742
+zip_trampoline_init(rtx m_tramp ATTRIBUTE_UNUSED,
1743
+       tree fndecl ATTRIBUTE_UNUSED,
1744
+       rtx chain_value ATTRIBUTE_UNUSED) {
1745
+// #warning "This needs to be filled out"
1746
+       abort();
1747
+}
1748
+
1749
+static tree
1750
+def_builtin(const char *name, enum insn_code icode, enum ZIP_BUILTIN_ID_CODE code,
1751
+       tree type)
1752
+{
1753
+       tree t = add_builtin_function(name,type,code,BUILT_IN_MD, NULL, NULL_TREE);
1754
+       zip_basic_check();
1755
+
1756
+       if(t) {
1757
+               zip_builtins[code] = t;
1758
+               zip_builtins_icode[code] = icode;
1759
+       }
1760
+
1761
+       return t;
1762
+
1763
+}
1764
+
1765
+void   zip_init_builtins(void) {
1766
+       zip_basic_check();
1767
+
1768
+  tree void_ftype_void = build_function_type_list(void_type_node, NULL_TREE);
1769
+#ifdef HAVE_zip_rtu
1770
+  def_builtin("zip_rtu", CODE_FOR_zip_rtu, ZIP_BUILTIN_RTU, void_ftype_void);
1771
+#endif
1772
+#ifdef HAVE_zip_halt
1773
+  def_builtin("zip_halt",  CODE_FOR_zip_halt,  ZIP_BUILTIN_HALT, void_ftype_void);
1774
+#endif
1775 171 dgisselq
+#ifdef HAVE_zip_busy
1776
+  def_builtin("zip_busy",  CODE_FOR_zip_busy,  ZIP_BUILTIN_BUSY, void_ftype_void);
1777
+#endif
1778 102 dgisselq
+#ifdef HAVE_zip_idle
1779
+  def_builtin("zip_idle", CODE_FOR_zip_idle, ZIP_BUILTIN_IDLE, void_ftype_void);
1780
+#endif
1781
+
1782
+#ifdef HAVE_zip_syscall
1783
+// Support int SYSCALL(callID, int a, int b, int c);
1784
+  def_builtin("zip_syscall", CODE_FOR_zip_syscall, ZIP_BUILTIN_SYSCALL,
1785
+                       build_function_type_list(void_type_node, NULL_TREE));
1786
+#endif
1787
+
1788
+#ifdef HAVE_zip_save_context
1789
+  def_builtin("zip_save_context", CODE_FOR_zip_save_context, ZIP_BUILTIN_SAVE_CONTEXT,
1790
+               build_function_type_list(void_type_node, ptr_type_node, 0));
1791
+#endif
1792
+
1793
+#ifdef HAVE_zip_restore_context
1794
+  def_builtin("zip_restore_context", CODE_FOR_zip_restore_context, ZIP_BUILTIN_RESTORE_CONTEXT,
1795
+       build_function_type_list(void_type_node, ptr_type_node, 0));
1796
+#endif
1797
+
1798
+#ifdef HAVE_zip_bitrev
1799
+  def_builtin("zip_bitrev", CODE_FOR_zip_bitrev, ZIP_BUILTIN_BITREV,
1800
+       build_function_type_list(unsigned_type_node, unsigned_type_node,
1801
+               NULL_TREE));
1802
+#endif
1803
+
1804
+#ifdef HAVE_zip_cc
1805
+  def_builtin("zip_cc", CODE_FOR_zip_cc, ZIP_BUILTIN_CC,
1806
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1807
+#endif
1808
+
1809 117 dgisselq
+#ifdef HAVE_zip_ucc
1810
+  def_builtin("zip_ucc", CODE_FOR_zip_ucc, ZIP_BUILTIN_UCC,
1811
+       build_function_type_list(unsigned_type_node, NULL_TREE));
1812
+#endif
1813
+
1814 102 dgisselq
+}
1815
+
1816
+static tree
1817
+zip_builtin_decl(unsigned zip_builtin_code, bool initialize_p ATTRIBUTE_UNUSED)
1818
+{
1819
+  if (zip_builtin_code >= ZIP_BUILTIN_MAX)
1820
+    return error_mark_node;
1821
+
1822
+  return zip_builtins[zip_builtin_code];
1823
+}
1824
+
1825
+static rtx
1826
+zip_expand_builtin(tree exp, rtx target,
1827
+               rtx subtarget ATTRIBUTE_UNUSED,
1828
+               machine_mode tmode ATTRIBUTE_UNUSED,
1829
+               int     ignore ATTRIBUTE_UNUSED) {
1830
+
1831
+       tree    fndecl = TREE_OPERAND(CALL_EXPR_FN(exp), 0);
1832
+       bool    nonvoid = (TREE_TYPE(TREE_TYPE(fndecl)) != void_type_node);
1833
+       enum    ZIP_BUILTIN_ID_CODE code=(enum ZIP_BUILTIN_ID_CODE)DECL_FUNCTION_CODE(fndecl);
1834
+       enum    insn_code icode = zip_builtins_icode[code];
1835
+       rtx     pat, op[5];
1836
+       call_expr_arg_iterator  iter;
1837
+       tree    arg;
1838
+
1839
+       if ((code == ZIP_BUILTIN_SAVE_CONTEXT)
1840
+                       ||(code == ZIP_BUILTIN_RESTORE_CONTEXT)) {
1841
+               arg = first_call_expr_arg(exp, &iter);
1842
+               if (arg == error_mark_node)
1843
+                       return NULL_RTX;
1844
+               op[0] = expand_normal(arg);
1845
+               if (GET_CODE(op[0]) != REG)
1846
+                       op[0] = force_reg(Pmode, op[0]);
1847
+               pat = GEN_FCN(icode)(op[0]);
1848
+       } else if (code == ZIP_BUILTIN_BITREV) {
1849
+               arg = first_call_expr_arg(exp, &iter);
1850
+               if (arg == error_mark_node) {
1851
+                       return NULL_RTX;
1852
+               }
1853
+               op[0] = expand_normal(arg);
1854
+               if (!target)
1855
+                       target = gen_reg_rtx(SImode);
1856
+               pat = GEN_FCN(icode)(target, op[0]);
1857 117 dgisselq
+       } else if ((code == ZIP_BUILTIN_CC)||(code == ZIP_BUILTIN_UCC)) {
1858 102 dgisselq
+               if (!target)
1859
+                       target = gen_reg_rtx(SImode);
1860
+               pat = GEN_FCN(icode)(target);
1861
+       } else // RTU, HALT, IDLE
1862
+               pat = GEN_FCN(icode)();
1863
+       if (!pat)
1864
+               return NULL_RTX;
1865
+       emit_insn(pat);
1866
+       return (nonvoid ? target : const0_rtx);
1867
+}
1868
+
1869
+static bool
1870
+zip_scalar_mode_supported_p(enum machine_mode mode) {
1871
+       zip_basic_check();
1872
+
1873
+       return ((mode)==SImode)||((mode)==DImode); // ||((mode)==SFmode);
1874
+}
1875
+
1876
+static bool
1877
+zip_libgcc_floating_mode_supported_p(enum machine_mode mode) {
1878
+       return ((mode)==SFmode)||((mode)==DFmode);
1879
+}
1880
+
1881
+static int
1882
+zip_address_cost(rtx addr ATTRIBUTE_UNUSED,
1883
+       enum machine_mode mode ATTRIBUTE_UNUSED,
1884
+       addr_space_t as ATTRIBUTE_UNUSED, bool spd ATTRIBUTE_UNUSED) {
1885
+       return 1;
1886
+}
1887
+
1888
+static bool
1889
+zip_mode_dependent_address_p(const_rtx addr ATTRIBUTE_UNUSED,
1890
+       addr_space_t as ATTRIBUTE_UNUSED) {
1891
+       return false;
1892
+}
1893
+
1894
+/*
1895
+static void
1896
+zip_asm_output_anchor(rtx x) {
1897
+       printf("ANCHOR: OP(%d)\n", GET_CODE(x));
1898
+}
1899
+*/
1900
+
1901
+static void
1902
+zip_debug_print(const char *pfx, int lvl, const char *str) {
1903
+       int     i;
1904
+       i = lvl;
1905
+       if ((true)||(lvl == 0))
1906
+               fprintf(stderr, "%s", pfx);
1907
+       else
1908
+               i += strlen(pfx);
1909
+       while(i-->0)
1910
+               fprintf(stderr, "  ");
1911
+       fprintf(stderr, "%s\n", str);
1912
+}
1913
+
1914
+static void
1915
+zip_debug_print_m(const char *pfx, int lvl, const char *str, enum machine_mode m) {
1916
+       int     i;
1917
+
1918
+       i = lvl;
1919
+       if ((true)||(lvl == 0))
1920
+               fprintf(stderr, "%s", pfx);
1921
+       else
1922
+               i = lvl+strlen(pfx);
1923
+       while(i-->0)
1924
+               fprintf(stderr, "  ");
1925
+       switch(m) {
1926
+               case VOIDmode:
1927
+                       fprintf(stderr, "%s:V\n", str);
1928
+                       break;
1929
+               case BLKmode:
1930
+                       fprintf(stderr, "%s:BLK\n", str);
1931
+                       break;
1932
+               case BImode:
1933
+                       fprintf(stderr, "%s:BI\n", str);
1934
+                       break;
1935
+#ifdef HAVE_QImode
1936
+               case QImode:
1937
+                       fprintf(stderr, "%s:QI\n", str);
1938
+                       break;
1939
+#endif
1940
+#ifdef HAVE_HImode
1941
+               case HImode:
1942
+                       fprintf(stderr, "%s:HI\n", str);
1943
+                       break;
1944
+#endif
1945
+               case SImode:
1946
+                       fprintf(stderr, "%s:SI\n", str);
1947
+                       break;
1948 122 dgisselq
+               case CCmode:
1949
+                       fprintf(stderr, "%s:CC\n", str);
1950
+                       break;
1951 102 dgisselq
+               case DImode:
1952
+                       fprintf(stderr, "%s:DI\n", str);
1953
+                       break;
1954
+               default:
1955
+                       fprintf(stderr, "%s:?\n", str);
1956
+       }
1957
+}
1958
+
1959
+static void
1960
+zip_debug_rtx_1(const char *pfx, const_rtx x, int lvl) {
1961
+       if (x == NULL_RTX) {
1962
+               zip_debug_print(pfx, lvl, "(NULL-RTX)");
1963
+               return;
1964
+       } else if (GET_CODE(x) > NUM_RTX_CODE) {
1965
+               char    buf[64];
1966
+               sprintf(buf, "(BAD-RTX-CODE %d)", GET_CODE(x));
1967
+               zip_debug_print(pfx, lvl, buf);
1968 117 dgisselq
+               gcc_assert(0 && "Bad RTX Code");
1969 102 dgisselq
+               return;
1970
+       } switch(GET_CODE(x)) { // rtl.def
1971 122 dgisselq
+       case PARALLEL:
1972
+               zip_debug_print(pfx, lvl, "(PARALLEL");
1973
+               for(int j=0; j<XVECLEN(x,0);j++)
1974
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1975
+               zip_debug_print(pfx, lvl, ")");
1976
+               debug_rtx(x);
1977
+               break;
1978 102 dgisselq
+       case INT_LIST: zip_debug_print(pfx, lvl, "(INT-LIST"); break;
1979 122 dgisselq
+       case SEQUENCE:
1980
+               zip_debug_print(pfx, lvl, "(SEQUENCE");
1981
+               for(int j=0; j<XVECLEN(x,0);j++)
1982
+                       zip_debug_rtx_1(pfx, XVECEXP(x,0,j), lvl+1);
1983
+               zip_debug_print(pfx, lvl, ")");
1984
+               debug_rtx(x);
1985
+               break;
1986 102 dgisselq
+       case ADDRESS: zip_debug_print(pfx, lvl, "(ADDRESS"); break;
1987
+       case DEBUG_INSN: zip_debug_print(pfx, lvl, "(DEBUG-INSN"); break;
1988
+       case INSN:
1989
+               zip_debug_print(pfx, lvl, "(INSN");
1990
+               /*
1991
+               { const rtx_insn *tmp_rtx;
1992
+               for(tmp_rtx = as_a <const rtx_insn *>(x); tmp_rtx != 0; tmp_rtx = NEXT_INSN(tmp_rtx)) {
1993
+                       zip_debug_rtx_1(tmp_rtx, lvl+1);
1994
+               }}
1995
+               */
1996
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
1997
+               zip_debug_print(pfx, lvl, ")");
1998 117 dgisselq
+               debug_rtx(x);
1999 102 dgisselq
+               break;
2000
+       case JUMP_INSN: zip_debug_print(pfx, lvl, "(JUMP-INSN");
2001 111 dgisselq
+               zip_debug_rtx_1(pfx, PATTERN(x), lvl+1);
2002
+               zip_debug_print(pfx, lvl, ")");
2003
+               /*
2004 102 dgisselq
+               if (JUMP_LABEL(x)) {
2005 111 dgisselq
+                       if (GET_CODE(JUMP_LABEL(x)) == LABEL_REF) {
2006
+                               char    buf[64];
2007
+                               sprintf(buf, "(LABEL *.L%d))", CODE_LABEL_NUMBER(LABEL_REF_LABEL(JUMP_LABEL(x))));
2008
+                               zip_debug_print(pfx, lvl+1, buf);
2009
+                       } else if (GET_CODE(JUMP_LABEL(x))==CODE_LABEL) {
2010
+                               char    buf[64];
2011
+                               sprintf(buf, "(CODE_LABEL *.L%d))", CODE_LABEL_NUMBER(JUMP_LABEL(x)));
2012
+                               zip_debug_print(pfx, lvl+1, buf);
2013
+                       } else
2014
+                       zip_debug_print(pfx, lvl+1, "(w/Label))");
2015 102 dgisselq
+               } else
2016 111 dgisselq
+                       zip_debug_print(pfx, lvl+1, "(NO label))");
2017
+               debug_rtx(x);
2018
+               */
2019 102 dgisselq
+               break;
2020
+       case CALL:
2021
+               zip_debug_print(pfx, lvl, "(CALL (Adr) (Args)");
2022
+               zip_debug_rtx_1(pfx, XEXP(x,0), lvl+1);
2023
+               zip_debug_rtx_1(pfx, XEXP(x,1), lvl+1);
2024
+               zip_debug_print(pfx, lvl, ")");
2025
+               break;
2026
+       case CALL_INSN: zip_debug_print(pfx, lvl, "(CALL-INSN");
2027
+               debug_rtx(x);
2028
+               break;
2029
+       case BARRIER: zip_debug_print(pfx, lvl, "(BARRIER)"); break;
2030
+       case RETURN: zip_debug_print(pfx, lvl, "(RETURN)"); break;
2031
+       case NOTE:
2032
+               {       char buf[128];
2033
+                       sprintf(buf, "(NOTE %s)", GET_REG_NOTE_NAME(GET_MODE(x)));
2034
+                       zip_debug_print(pfx, lvl, buf);
2035
+               }break;
2036
+       case COND_EXEC: zip_debug_print(pfx, lvl, "(COND_EXEC)");
2037
+               debug_rtx(x);
2038
+               break;
2039
+       case ASM_INPUT: zip_debug_print(pfx, lvl, "(ASM INPUT)"); break;
2040
+       case ASM_OPERANDS: zip_debug_print(pfx, lvl, "(ASM OPERANDS)"); break;
2041
+       case UNSPEC: zip_debug_print(pfx, lvl, "(UNSPEC)"); break;
2042
+       case UNSPEC_VOLATILE: zip_debug_print(pfx, lvl, "(UNSPEC_VOLATILE)"); break;
2043
+       case CODE_LABEL:
2044
+               {
2045
+                       char    buf[64];
2046 111 dgisselq
+                       sprintf(buf, "(CODE_LABEL *.L%d)", CODE_LABEL_NUMBER(x));
2047 102 dgisselq
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2048
+               } break;
2049
+       case SET:
2050
+               zip_debug_print_m(pfx, lvl, "(SET", GET_MODE(x));
2051 117 dgisselq
+               zip_debug_rtx_1(pfx, SET_DEST(x),lvl+1);
2052
+               zip_debug_rtx_1(pfx, SET_SRC(x),lvl+1);
2053 102 dgisselq
+               zip_debug_print(pfx, lvl, ")");
2054 117 dgisselq
+               debug_rtx(x);
2055 102 dgisselq
+               break;
2056 122 dgisselq
+       case REG: {
2057 127 dgisselq
+               char buf[25], mstr[4];
2058
+               mstr[0] = '\0';
2059
+               if (GET_MODE(x) == SImode)
2060
+                       strcpy(mstr, ":SI");
2061
+               else if (GET_MODE(x) == DImode)
2062
+                       strcpy(mstr, ":DI");
2063
+               else if (GET_MODE(x) == VOIDmode)
2064
+                       strcpy(mstr, ":V");
2065 102 dgisselq
+               if (REGNO(x) == zip_PC)
2066 127 dgisselq
+                       sprintf(buf, "(PC%s)", mstr);
2067 102 dgisselq
+               else if (REGNO(x) == zip_CC)
2068 127 dgisselq
+                       sprintf(buf, "(CC%s)", mstr);
2069 102 dgisselq
+               else if (REGNO(x) == zip_SP)
2070 127 dgisselq
+                       sprintf(buf, "(SP%s)", mstr);
2071 102 dgisselq
+               else if (REGNO(x) == zip_FP)
2072 127 dgisselq
+                       sprintf(buf, "(REG%s FP)", mstr);
2073 102 dgisselq
+               else if (REGNO(x) == zip_GOT)
2074 127 dgisselq
+                       sprintf(buf, "(REG%s GBL)", mstr);
2075 102 dgisselq
+               else if (FUNCTION_VALUE_REGNO_P(REGNO(x)))
2076 127 dgisselq
+                       sprintf(buf, "(REG%s RTN-VL)", mstr);
2077 102 dgisselq
+               else if (REGNO(x) == RETURN_ADDRESS_REGNUM)
2078 127 dgisselq
+                       sprintf(buf, "(REG%s RTN-AD)", mstr);
2079 122 dgisselq
+               else
2080 127 dgisselq
+                       sprintf(buf, "(REG%s %d)", mstr, REGNO(x));
2081
+               if (mstr[0])
2082
+                       zip_debug_print(pfx, lvl, buf);
2083
+               else
2084
+                       zip_debug_print_m(pfx, lvl, buf, GET_MODE(x));
2085 102 dgisselq
+               } break;
2086
+       case IF_THEN_ELSE: // 51
2087
+               zip_debug_print(pfx, lvl, "(IF-THEN-ELSE");
2088
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2089
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2090
+               zip_debug_rtx_1(pfx, XEXP(x,2),lvl+1);
2091
+               zip_debug_print(pfx, lvl, ")");
2092
+               break;
2093
+       case PC:
2094
+               zip_debug_print(pfx, lvl, "(PC)");
2095
+               break;
2096
+       case CC0:
2097
+               zip_debug_print(pfx, lvl, "(CC0)");
2098
+               break;
2099
+       case COMPARE:
2100 127 dgisselq
+               zip_debug_print_m(pfx, lvl, "(COMPARE", GET_MODE(x));
2101 102 dgisselq
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2102
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2103
+               zip_debug_print(pfx, lvl, ")");
2104
+               break;
2105 111 dgisselq
+       case CONST:
2106
+               zip_debug_print_m(pfx, lvl, "(CONST", GET_MODE(x));
2107
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2108
+               zip_debug_print(pfx, lvl, ")");
2109
+               break;
2110 102 dgisselq
+       case CONST_INT:
2111
+               { char buf[25];
2112
+               if (GET_MODE(x)==SImode)
2113 135 dgisselq
+                       sprintf(buf, "(CONST_INT:SI %ld)", (long)INTVAL(x));
2114 102 dgisselq
+               else if (GET_MODE(x)==VOIDmode)
2115 135 dgisselq
+                       sprintf(buf, "(CONST_INT:V %ld)", (long)INTVAL(x));
2116 102 dgisselq
+               else
2117 135 dgisselq
+                       sprintf(buf, "(CONST_INT:? %ld)", (long)INTVAL(x));
2118 102 dgisselq
+               zip_debug_print(pfx, lvl, buf);
2119
+               } break;
2120
+       case LABEL_REF:
2121 122 dgisselq
+               { char buf[256];
2122 111 dgisselq
+               sprintf(buf, "(LABEL *.L%d)", CODE_LABEL_NUMBER(LABEL_REF_LABEL(x)));
2123
+               zip_debug_print(pfx, lvl, buf);
2124
+               }
2125 102 dgisselq
+               break;
2126
+       case SYMBOL_REF:
2127
+               {
2128
+                       char buf[64];
2129
+                       sprintf(buf, "(SYMBOL: %s)", XSTR(x,0));
2130
+                       // fprintf(file, "%s", XSTR(x,0));
2131
+                       zip_debug_print(pfx, lvl, buf);
2132
+               }
2133
+               break;
2134
+       case MEM:
2135
+               zip_debug_print_m(pfx, lvl, "(MEM", GET_MODE(x));
2136
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2137
+               zip_debug_print(pfx, lvl, ")");
2138
+               break;
2139
+       /*
2140
+       case VALUE:
2141
+               {
2142
+                       char buf[64];
2143
+                       sprintf(buf, "(VALUE: %d)", INTVAL(XEXP,0));
2144
+                       zip_debug_print_m(pfx, lvl, "buf", GET_MODE(x));
2145
+               }
2146
+               break;
2147
+       */
2148
+       case PLUS:
2149
+               zip_debug_print_m(pfx, lvl, "(PLUS", GET_MODE(x));
2150
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2151
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2152
+               zip_debug_print(pfx, lvl, ")");
2153
+               break;
2154
+       case MINUS:
2155
+               zip_debug_print_m(pfx, lvl, "(MINUS", GET_MODE(x));
2156
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2157
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2158
+               zip_debug_print(pfx, lvl, ")");
2159
+               break;
2160
+       case AND:
2161
+               zip_debug_print_m(pfx, lvl, "(AND", GET_MODE(x));
2162
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2163
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2164
+               zip_debug_print(pfx, lvl, ")");
2165
+               break;
2166
+       case IOR:
2167
+               zip_debug_print_m(pfx, lvl, "(OR", GET_MODE(x));
2168
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2169
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2170
+               zip_debug_print(pfx, lvl, ")");
2171
+               break;
2172
+       case XOR:
2173
+               zip_debug_print_m(pfx, lvl, "(XOR", GET_MODE(x));
2174
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2175
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2176
+               zip_debug_print(pfx, lvl, ")");
2177
+               break;
2178
+       case MULT:
2179
+               zip_debug_print_m(pfx, lvl, "(MULT", GET_MODE(x));
2180
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2181
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2182
+               zip_debug_print(pfx, lvl, ")");
2183
+               break;
2184
+       case EQ:        //
2185
+               zip_debug_print_m(pfx, lvl, "(EQ", GET_MODE(x));
2186
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2187
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2188
+               zip_debug_print(pfx, lvl, ")");
2189
+               break;
2190
+       case NE:        //
2191
+               zip_debug_print_m(pfx, lvl, "(NE", GET_MODE(x));
2192
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2193
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2194
+               zip_debug_print(pfx, lvl, ")");
2195
+               break;
2196
+       case GE:        //
2197
+               zip_debug_print_m(pfx, lvl, "(GE", GET_MODE(x));
2198
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2199
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2200
+               zip_debug_print(pfx, lvl, ")");
2201
+               break;
2202
+       case GT:        //
2203
+               zip_debug_print_m(pfx, lvl, "(GT", GET_MODE(x));
2204
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2205
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2206
+               zip_debug_print(pfx, lvl, ")");
2207
+               break;
2208
+       case LE:        //
2209
+               zip_debug_print_m(pfx, lvl, "(LE", GET_MODE(x));
2210
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2211
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2212
+               zip_debug_print(pfx, lvl, ")");
2213
+               break;
2214
+       case LT:        //
2215
+               zip_debug_print_m(pfx, lvl, "(LT", GET_MODE(x));
2216
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2217
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2218
+               zip_debug_print(pfx, lvl, ")");
2219
+               break;
2220
+       case GEU:       //
2221
+               zip_debug_print_m(pfx, lvl, "(GEU", GET_MODE(x));
2222
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2223
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2224
+               zip_debug_print(pfx, lvl, ")");
2225
+               break;
2226
+       case GTU:       //
2227
+               zip_debug_print_m(pfx, lvl, "(GTU", GET_MODE(x));
2228
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2229
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2230
+               zip_debug_print(pfx, lvl, ")");
2231
+               break;
2232
+       case LEU:       //
2233
+               zip_debug_print_m(pfx, lvl, "(LEU", GET_MODE(x));
2234
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2235
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2236
+               zip_debug_print(pfx, lvl, ")");
2237
+               break;
2238
+       case LTU:       //
2239
+               zip_debug_print_m(pfx, lvl, "(LTU", GET_MODE(x));
2240
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2241
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2242
+               zip_debug_print(pfx, lvl, ")");
2243
+               break;
2244
+       case SCRATCH:   //
2245
+               zip_debug_print_m(pfx, lvl, "(SCRATCH)", GET_MODE(x));
2246
+               break;
2247
+       case SUBREG:
2248
+               { char buf[25];
2249 111 dgisselq
+               if (REG_P(XEXP(x,0))) {
2250
+                       sprintf(buf, "(SUBREG %d/%d)", REGNO(XEXP(x,0)),
2251
+                               SUBREG_BYTE(x));
2252
+                       zip_debug_print(pfx, lvl, buf);
2253
+               } else if (MEM_P(XEXP(x,0))) {
2254
+                       sprintf(buf, "(SUBREG /%d", SUBREG_BYTE(x));
2255
+                       zip_debug_print(pfx, lvl, buf);
2256
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2257
+                       zip_debug_print(pfx, lvl, ")");
2258
+               } else {
2259
+                       sprintf(buf, "(SUBREG UNK /%d", SUBREG_BYTE(x));
2260
+                       zip_debug_print(pfx, lvl, buf);
2261
+                       zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2262
+                       zip_debug_print(pfx, lvl, ")");
2263
+               }}
2264
+               break;
2265 127 dgisselq
+       case ASHIFT:
2266
+               zip_debug_print_m(pfx, lvl, "(ASHIFT", GET_MODE(x));
2267
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2268
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2269
+               zip_debug_print(pfx, lvl, ")");
2270
+               break;
2271
+       case ASHIFTRT:
2272
+               zip_debug_print_m(pfx, lvl, "(ASHIFTRT", GET_MODE(x));
2273
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2274
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2275
+               zip_debug_print(pfx, lvl, ")");
2276
+               break;
2277
+       case LSHIFTRT:
2278
+               zip_debug_print_m(pfx, lvl, "(LSHIFTRT", GET_MODE(x));
2279
+               zip_debug_rtx_1(pfx, XEXP(x,0),lvl+1);
2280
+               zip_debug_rtx_1(pfx, XEXP(x,1),lvl+1);
2281
+               zip_debug_print(pfx, lvl, ")");
2282
+               break;
2283 102 dgisselq
+       default:
2284 111 dgisselq
+               { char buf[128];
2285 102 dgisselq
+               sprintf(buf, "(? = %d) -- calling DEBUG-RTX", GET_CODE(x));
2286
+               zip_debug_print(pfx, lvl, buf);
2287
+               debug_rtx(x);
2288
+               } break;
2289
+       }
2290
+}
2291
+
2292
+void
2293
+zip_debug_rtx_pfx(const char *pfx, const_rtx x) {
2294
+       zip_debug_rtx_1(pfx, x, 0);
2295
+}
2296
+
2297
+void
2298
+zip_debug_rtx(const_rtx x) {
2299
+       zip_debug_rtx_pfx("", x);
2300
+}
2301
+
2302
+void
2303 142 dgisselq
+zip_debug_ccode(int ccode) {
2304
+       switch(ccode) {
2305
+       case    EQ: fprintf(stderr, "EQ"); break;
2306
+       case    NE: fprintf(stderr, "NE"); break;
2307
+       case    GT: fprintf(stderr, "GT"); break;
2308
+       case    GE: fprintf(stderr, "GE"); break;
2309
+       case    LT: fprintf(stderr, "LT"); break;
2310
+       case    LE: fprintf(stderr, "LE"); break;
2311
+       case    GTU: fprintf(stderr, "GTU"); break;
2312
+       case    GEU: fprintf(stderr, "GEU"); break;
2313
+       case    LTU: fprintf(stderr, "LTU"); break;
2314
+       case    LEU: fprintf(stderr, "LEU"); break;
2315
+       default:
2316
+               fprintf(stderr, "%d", ccode); break;
2317
+       }
2318
+}
2319
+
2320
+void
2321 102 dgisselq
+zip_debug_insn(rtx_insn *insn ATTRIBUTE_UNUSED) {
2322
+}
2323
+
2324
+void
2325
+zip_debug_bb(basic_block bb) {
2326
+       rtx_insn        *insn;
2327
+
2328
+       fprintf(stderr, "************ BASIC-BLOCK ***************\n");
2329
+       FOR_BB_INSNS(bb, insn)
2330
+       {
2331
+               zip_debug_rtx(insn);
2332
+       }
2333
+}
2334
+
2335
+
2336
+static bool
2337 122 dgisselq
+zip_legitimate_opb(rtx x, bool strict)
2338 102 dgisselq
+{
2339 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2340 102 dgisselq
+
2341 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB\n");
2342 102 dgisselq
+       if (dbg) zip_debug_rtx_pfx("Test: ", x);
2343
+
2344
+       if (NULL_RTX == x)
2345
+               return false;
2346 122 dgisselq
+       else if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
2347
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> Mode failure\n");
2348 102 dgisselq
+               return false;
2349 122 dgisselq
+       } else if ((strict)&&(REG_P(x))) {
2350
+               if (REGNO(x)<zip_CC) {
2351
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2352
+                       return true;
2353
+               } else return false;
2354
+       } else if (register_operand(x, GET_MODE(x))) {
2355
+               // This also handles subregs
2356
+               if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> (Reg)\n");
2357
+               return true;
2358 111 dgisselq
+       } else if ((CONST_INT_P(x))
2359
+               &&(INTVAL(x) >= zip_min_opb_imm)
2360
+               &&(INTVAL(x) <= zip_max_opb_imm)) {
2361 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);
2362 111 dgisselq
+               return true;
2363 122 dgisselq
+       // } else if ((GET_CODE(x) == LABEL_REF)||(GET_CODE(x)==CODE_LABEL)) {
2364
+               // return true;
2365 102 dgisselq
+       } else if (GET_CODE(x) == PLUS) {
2366
+               // Is it a valid register?
2367 122 dgisselq
+               if ((!strict)&&(!register_operand((rtx)XEXP((rtx)x,0), GET_MODE(x)))) {
2368 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No (No reg in +%s)\n",
2369 102 dgisselq
+                       (GET_CODE(XEXP(x,1))==REG)?", reg in op[1]":"");
2370
+                       return false;
2371 122 dgisselq
+               } else if ((strict)&&((!REG_P(XEXP(x,0)))||(REGNO(XEXP(x,0))>=zip_CC))) {
2372 102 dgisselq
+                       return false;
2373
+               } if ((GET_CODE(XEXP(x, 1)) == CONST_INT)
2374
+                       &&(INTVAL(XEXP(x, 1)) <= zip_max_anchor_offset)
2375
+                       &&(INTVAL(XEXP(x, 1)) >= zip_min_anchor_offset)) {
2376 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> YES! (reg+int)\n");
2377 103 dgisselq
+                       // if((INTVAL(XEXP(x,1))<0)&&(REGNO(XEXP(x,0))==zip_SP))
2378
+                               // gcc_unreachable();
2379 102 dgisselq
+                       return true;
2380
+               } if ((GET_CODE(XEXP(x, 1)) == LABEL_REF)
2381 122 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == CODE_LABEL)
2382 102 dgisselq
+                       ||(GET_CODE(XEXP(x, 1)) == SYMBOL_REF)) {
2383
+                       // While we can technically support this, the problem
2384
+                       // is that the symbol address could be anywhere, and we
2385
+                       // have no way of recovering if it's outside of our
2386
+                       // 14 allowable bits.
2387 111 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No. (reg+lbl)\n");
2388 102 dgisselq
+                       return false;
2389
+               }
2390
+       }
2391
+
2392 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-LEGITIMATE-OPB -> No\n");
2393 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2394
+       return false;
2395
+}
2396
+
2397
+static bool
2398
+zip_legitimate_move_operand_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict) {
2399
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2400
+
2401
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND\n");
2402
+       if (dbg) zip_debug_rtx_pfx("VMov?: ", x);
2403
+
2404 122 dgisselq
+       if (!zip_legitimate_opb(x, strict))
2405 102 dgisselq
+               return false;
2406 122 dgisselq
+       else if ((GET_CODE(x)==PLUS)&&(CONST_INT_P(XEXP(x,1)))) {
2407
+               if ((INTVAL(XEXP(x, 1)) > zip_max_mov_offset)
2408
+                       ||(INTVAL(XEXP(x, 1)) < zip_min_mov_offset)) {
2409 135 dgisselq
+                       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> NO! (reg+int), int out of bounds: %ld\n", (long)INTVAL(XEXP(x,1)));
2410 102 dgisselq
+                       return false;
2411
+               }
2412
+       }
2413
+
2414 122 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOVE-OPERAND -> Yes\n");
2415 102 dgisselq
+       if (dbg) zip_debug_rtx(x);
2416 122 dgisselq
+       return true;
2417 102 dgisselq
+}
2418
+
2419
+int
2420
+zip_pd_mov_operand(rtx op)
2421
+{
2422
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2423
+
2424
+       if (dbg) fprintf(stderr, "ZIP-VALID-MOV(predicate) for OPERAND\n");
2425
+       return zip_legitimate_move_operand_p(VOIDmode, op, !can_create_pseudo_p());
2426
+}
2427
+
2428
+int
2429 111 dgisselq
+zip_pd_mvimm_operand(rtx op)
2430
+{
2431
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2432
+
2433
+       if (dbg) fprintf(stderr, "ZIP-VALID-MVIMM(predicate) for OPERAND\n");
2434
+       if (!CONST_INT_P(op))
2435
+               return false;
2436
+       if (INTVAL(op) > zip_max_mov_offset)
2437
+               return false;
2438
+       if (INTVAL(op) < zip_min_mov_offset)
2439
+               return false;
2440
+       return true;
2441
+}
2442
+
2443
+int
2444
+zip_pd_imm_operand(rtx op)
2445
+{
2446
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2447
+
2448
+       if (dbg) fprintf(stderr, "ZIP-VALID-IMM(predicate) for OPERAND\n");
2449
+       if (!CONST_INT_P(op))
2450
+               return false;
2451
+       if (INTVAL(op) > zip_max_anchor_offset)
2452
+               return false;
2453
+       if (INTVAL(op) < zip_min_anchor_offset)
2454
+               return false;
2455
+       return true;
2456
+}
2457
+
2458
+int
2459 102 dgisselq
+zip_address_operand(rtx op)
2460
+{
2461
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2462
+
2463
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS for OPERAND\n");
2464 111 dgisselq
+       if ((REG_P(op))&&(REGNO(op)==zip_CC))
2465
+               return false;
2466
+       else if ((GET_CODE(op) == PLUS)&&(REG_P(XEXP(op,0)))
2467
+                       &&(REGNO(XEXP(op,0))==zip_CC))
2468
+               return false;
2469
+       else
2470
+               return zip_legitimate_opb(op, !can_create_pseudo_p());
2471 102 dgisselq
+}
2472
+
2473
+int
2474 111 dgisselq
+zip_pd_opb_operand(rtx op)
2475 102 dgisselq
+{
2476
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2477
+
2478 111 dgisselq
+       if (dbg) fprintf(stderr, "ZIP-OPB(predicate) for OPERAND\n");
2479 122 dgisselq
+       return zip_legitimate_opb(op, false); //, !can_create_pseudo_p());
2480 102 dgisselq
+}
2481
+
2482
+int
2483
+zip_ct_address_operand(rtx op)
2484
+{
2485
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2486
+
2487
+       if (dbg) fprintf(stderr, "ZIP-ADDRESS(constraint) for OPERAND\n");
2488 111 dgisselq
+       return zip_legitimate_opb(op, !can_create_pseudo_p());
2489 102 dgisselq
+}
2490
+
2491
+int
2492
+zip_const_address_operand(rtx x) {
2493
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2494
+
2495
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS?\n");
2496
+       if (dbg) zip_debug_rtx(x);
2497 127 dgisselq
+       if ((GET_MODE(x) != SImode)&&(GET_MODE(x) != VOIDmode)) {
2498
+               fprintf(stderr, "is ZIP-CONST-ADDRESS? -> NO, BAD MODE\n");
2499 102 dgisselq
+               return false;
2500 127 dgisselq
+       }
2501 102 dgisselq
+       if ((GET_CODE(x) == LABEL_REF)
2502
+                       ||(GET_CODE(x) == CODE_LABEL)
2503
+                       ||(GET_CODE(x) == SYMBOL_REF)) {
2504 127 dgisselq
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES! (LBL)\n");
2505 102 dgisselq
+               return true;
2506
+       } else if (CONST_INT_P(x)) {
2507 127 dgisselq
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> YES! (INT)\n");
2508 102 dgisselq
+               return true;
2509
+       } else if (GET_CODE(x) == PLUS) {
2510
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(PLUS)\n");
2511
+               return ((zip_const_address_operand(XEXP(x,0)))
2512
+                       &&(CONST_INT_P(XEXP(x,1))));
2513
+       } else if (GET_CODE(x) == MINUS) {
2514
+               if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS(MINUS)\n");
2515
+               return ((zip_const_address_operand(XEXP(x,0)))
2516
+                       &&(zip_const_address_operand(XEXP(x,1))));
2517
+       }
2518
+
2519
+       if (dbg) fprintf(stderr, "is ZIP-CONST-ADDRESS? -> No\n");
2520
+       if (dbg) zip_debug_rtx(x);
2521
+       return false;
2522
+}
2523
+
2524
+int
2525
+zip_ct_const_address_operand(rtx x) {
2526
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2527
+
2528
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(constraint)\n");
2529
+       return zip_const_address_operand(x);
2530
+}
2531
+
2532
+int
2533
+zip_pd_const_address_operand(rtx x) {
2534
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2535
+
2536
+       if (dbg) fprintf(stderr, "ZIP-CONST-ADDRESS(predicate)\n");
2537
+       return zip_const_address_operand(x);
2538
+}
2539
+
2540
+
2541
+static bool
2542
+zip_legitimate_address_p(machine_mode mode ATTRIBUTE_UNUSED, rtx x, bool strict)
2543
+{
2544
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2545
+
2546
+       if (dbg) fprintf(stderr, "Zip-LEGITIMATE-ADDRESS-P\n");
2547
+       if (dbg) zip_debug_rtx(x);
2548
+
2549
+       // Only insist the register be a valid register if strict is true
2550 111 dgisselq
+       if (zip_legitimate_opb(x, strict))
2551 102 dgisselq
+               return true;
2552 111 dgisselq
+       // else if (zip_const_address_operand(x))
2553
+               // return true;
2554 102 dgisselq
+
2555
+       return false;
2556
+}
2557
+
2558 111 dgisselq
+static rtx
2559
+zip_legitimize_address(rtx x, rtx oldx ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED) {
2560
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2561
+
2562
+       if (dbg) zip_debug_rtx_pfx("LEGITIMIZE: ", x);
2563
+       if (zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2564
+               return x;
2565
+
2566
+       if (GET_CODE(x)==PLUS) {
2567
+               if (!REG_P(XEXP(x,0)))
2568
+                       XEXP(x,0) = force_reg(GET_MODE(x),XEXP(x,0));
2569
+               if ((!zip_legitimate_address_p(mode, x, !can_create_pseudo_p()))
2570
+                       &&(!CONST_INT_P(XEXP(x,1))))
2571
+                       x = force_reg(GET_MODE(x),x);
2572
+       } else if (MEM_P(x))
2573
+               x = force_reg(GET_MODE(x),x);
2574
+
2575
+       if (dbg) zip_debug_rtx_pfx("LEGITIMATE: ", x);
2576
+       return x;
2577
+}
2578
+
2579 102 dgisselq
+void
2580
+zip_asm_output_def(FILE *stream, const char *name, const char *value)
2581
+{
2582
+       assemble_name(stream, name);
2583
+       fprintf(stream, "\t.equ ");
2584
+       assemble_name(stream, value);
2585
+       fputc('\n', stream);
2586
+}
2587
+
2588 111 dgisselq
+#define        USE_SUBREG
2589
+#ifdef USE_SUBREG
2590
+#define        SREG_P(RTX) ((SUBREG_P(RTX))&&(REG_P(XEXP(RTX,0))))
2591
+#define        SMEM_P(RTX) ((SUBREG_P(RTX))&&(MEM_P(XEXP(RTX,0))))
2592
+#else
2593
+#define        SREG_P(RTX)     false
2594
+#define        SMEM_P(RTX)     false
2595
+#endif
2596 102 dgisselq
+
2597
+const char *zip_set_zero_or_one(rtx condition, rtx dst) {
2598 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2599 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::SET-ZERO-OR-ONE\n");
2600
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2601
+       if (dbg) zip_debug_rtx_pfx("REG", dst);
2602
+       switch(GET_CODE(condition)) {
2603
+       case EQ:        return "LDI\t0,%0\n\tLDILO.Z\t1,%0";
2604
+       case NE:        return "LDI\t0,%0\n\tLDILO.NZ\t1,%0";
2605
+       case LT:        return "LDI\t0,%0\n\tLDILO.LT\t1,%0";
2606
+       case GT:        return "LDI\t0,%0\n\tLDILO.GT\t1,%0";
2607
+       case LE:        return "LDI\t1,%0\n\tLDILO.GT\t0,%0";
2608
+       case GE:        return "LDI\t0,%0\n\tLDILO.GE\t1,%0";
2609
+       case LTU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0";
2610
+       case GTU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0\n\tLDILO.Z\t0,%0";
2611
+       case LEU:       return "LDI\t0,%0\n\tLDILO.C\t1,%0\n\tLDILO.Z\t1,%0";
2612
+       case GEU:       return "LDI\t1,%0\n\tLDILO.C\t0,%0";
2613
+       default:
2614
+               zip_debug_rtx(condition);
2615
+               internal_error("CSTORE Unsupported condition");
2616
+               return NULL;
2617
+       }
2618
+}
2619
+
2620 127 dgisselq
+/*
2621 102 dgisselq
+const char *zip_binary_movsicc(rtx_code condition, const char *op, const int opno) {
2622
+       static char     result[64] = "";
2623
+       switch(condition) {
2624
+               //
2625
+               // Result already exists in the iffalse register
2626
+               // Can't change it.  Therefore, on the
2627
+               // condition ... move true register to the
2628
+               // destination
2629
+               //
2630
+               case EQ:        sprintf(result, "%s.Z\t%%%d,%%0", op, opno); break;
2631
+               case NE:        sprintf(result, "%s.NZ\t%%%d,%%0", op, opno); break;
2632
+               case LT:        sprintf(result, "%s.LT\t%%%d,%%0", op, opno); break;
2633
+               case GT:        sprintf(result, "%s.GT\t%%%d,%%0", op, opno); break;
2634
+               // .LE doesn't exist on Zip CPU--turn this into two instructions
2635
+               case LE:        sprintf(result, "%s.LT\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2636
+               case GE:        sprintf(result, "%s.GE\t%%%d,%%0", op, opno); break;
2637
+               case LTU:       sprintf(result, "%s.C\t%%%d,%%0", op, opno); break;
2638
+               //
2639
+               // .GTU doesn't exist on the Zip CPU either. We also note that
2640
+               // .C will never be set on an equal condition.  Therefore, we
2641
+               // turn this into a XOR.NZ 2,CC, which will set the .C condition
2642
+               // as long as .Z wasn't true.  We then undo this when we're
2643
+               // done.  This is possible since none of these instructions
2644
+               // (LDI/MOV/Lod conditional, nor Xor conditional) will ever set
2645
+               // the condition codes.
2646
+               //
2647
+               // This is obviously not very optimal.  Avoid this by all means
2648
+               // if you can
2649
+               case GTU:       sprintf(result, "XOR.NZ\t2,CC\n%s.C\t%%%d,%%0\n\tXOR.NZ\t2,CC", op, opno); break;
2650
+               // .LEU doesn't exist on Zip CPU either--turn this into another
2651
+               // two instructions
2652
+               case LEU:       sprintf(result, "%s.C\t%%%d,%%0\n\t%s.Z\t%%%d,%%0", op, opno, op, opno); break;
2653
+               //
2654
+               // .GEU doesn't exist on Zip CPU.  Implementing it her is
2655
+               // painful.  We can change the condition codes to make it so,
2656
+               // but the instruction requires the condition codes not be
2657
+               // changed.  Hence, we must change them back if we do so.
2658
+               //
2659
+               // .C will be set on less than but not equal.  Hence !.C will
2660
+               // be true on greater than or equal.
2661
+               case GEU:       sprintf(result, "XOR\t2,CC\n%s.C\t%%%d,%%0\n\tXOR\t2,CC", op, opno); break;
2662
+               default:
2663
+                       internal_error("MOVSICC(BINARY) Unsupported condition");
2664
+                       return NULL;
2665
+       } return result;
2666
+}
2667 127 dgisselq
+*/
2668 102 dgisselq
+
2669 127 dgisselq
+bool
2670
+zip_supported_condition(int c) {
2671
+       switch(c) {
2672
+       case NE: case LT: case EQ: case GT: case GE: case LTU:
2673
+               return true;
2674
+               break;
2675
+       default:
2676
+               break;
2677
+       } return false;
2678 102 dgisselq
+}
2679
+
2680 127 dgisselq
+bool
2681
+zip_signed_comparison(int c) {
2682
+       switch(c) {
2683
+       case NE: case LT: case EQ: case GT: case GE:
2684
+               return true;
2685
+       default:
2686
+               break;
2687
+       } return false;
2688
+}
2689
+
2690 142 dgisselq
+bool
2691 127 dgisselq
+zip_expand_movsicc(rtx dst, rtx condition, rtx iftrue, rtx iffalse) {
2692 142 dgisselq
+       rtx_insn *insn;
2693 103 dgisselq
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2694 102 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC\n");
2695
+       if (dbg) zip_debug_rtx_pfx("DST", dst);
2696
+       if (dbg) zip_debug_rtx_pfx("CND", condition);
2697
+       if (dbg) zip_debug_rtx_pfx("TRU", iftrue);
2698
+       if (dbg) zip_debug_rtx_pfx("FAL", iffalse);
2699 127 dgisselq
+
2700
+       // Start with the condition
2701
+       rtx     cmpa = XEXP(condition,0), cmpb=XEXP(condition,1);
2702
+       enum rtx_code   cmpcode = GET_CODE(condition);
2703
+
2704 142 dgisselq
+       // Want to always do the false expression, and only sometimes the
2705
+       // true expression.  If, however, the false is a constant and the
2706
+       // true and destination are the same thing, this doesn't work.
2707
+       if (rtx_equal_p(dst, iftrue)) {
2708
+               // If the true value is the same as the destination already,
2709
+               // then swap so we only do the condition on true
2710
+               rtx tem = iffalse;
2711
+               iffalse = iftrue;
2712
+               iftrue  = tem;
2713
+               cmpcode = reverse_condition(cmpcode);
2714
+       }
2715
+
2716 127 dgisselq
+       //; Do we need to swap or adjust the condition?
2717
+       if (zip_supported_condition((int)cmpcode)) {
2718
+               // Keep everything as is
2719 142 dgisselq
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- Condition is supported\n");
2720 127 dgisselq
+       } else if ((zip_supported_condition(reverse_condition(cmpcode)))
2721 142 dgisselq
+                       &&(!MEM_P(iffalse))
2722
+                       &&(!rtx_equal_p(dst,iffalse))) {
2723 127 dgisselq
+               rtx tem = iffalse;
2724
+               iffalse = iftrue;
2725
+               iftrue = tem;
2726
+
2727
+               cmpcode = reverse_condition(cmpcode);
2728
+       } else if ((zip_supported_condition((int)swap_condition(cmpcode)))
2729
+               &&((REG_P(cmpb))||(can_create_pseudo_p()))) {
2730
+               rtx tem = cmpa;
2731
+               cmpa = cmpb;
2732
+               cmpa = tem;
2733
+               cmpcode = swap_condition(cmpcode);
2734
+
2735
+               if ((GET_CODE(cmpa)==PLUS)&&(zip_signed_comparison((int)cmpcode))
2736
+                       &&(REG_P(XEXP(cmpa,0)))
2737
+                       &&(CONST_INT_P(XEXP(cmpa,1)))
2738
+                       &&(abs(INTVAL(XEXP(cmpa,1)))<(1<<17))) {
2739
+
2740
+                       // If we were doing CMP x(Rb),Ra
2741
+                       // and we just changed it to CMP Ra,x(Rb)
2742
+                       // adjust it to CMP -x(Ra),Rb
2743
+                       cmpb = plus_constant(SImode, cmpb, -INTVAL(XEXP(cmpa,1)));
2744
+                       cmpa = XEXP(cmpa,0);
2745
+               } else if (!REG_P(cmpa)) {
2746
+                       // Otherwise, if we had anything else in Rb other than
2747
+                       // a register ... such as a constant, then load it into
2748
+                       // a register before comparing it.  So
2749
+                       //      CMP x,Ra
2750
+                       // became
2751
+                       //      CMP Ra,x
2752
+                       // now becomes
2753
+                       //      LDI x,Rt
2754
+                       //      CMP Ra,Rt
2755
+                       // (We already tested for can_create_pseudo_p() above..)
2756
+                       tem = gen_reg_rtx(SImode);
2757
+                       emit_move_insn(tem, cmpa);
2758
+                       cmpa = tem;
2759 102 dgisselq
+               }
2760 127 dgisselq
+       } else {
2761
+               // Here's our last chance.
2762
+               // This will adjust for less than equal types of stuff
2763
+               int     cod = (int)cmpcode;
2764
+               zip_canonicalize_comparison(&cod, &cmpa, &cmpb, false);
2765
+               cmpcode = (enum rtx_code)cod;
2766 102 dgisselq
+       }
2767
+
2768 142 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC -- Post-Modes\n");
2769
+       if (dbg) zip_debug_rtx_pfx("DST-P: ", dst);
2770
+       if (dbg) zip_debug_rtx_pfx("CND-P: ", condition);
2771
+       if (dbg) zip_debug_rtx_pfx("TRU-P: ", iftrue);
2772
+       if (dbg) zip_debug_rtx_pfx("FAL-P: ", iffalse);
2773
+
2774
+       if (!zip_supported_condition((int)cmpcode)) {
2775
+               if (dbg) {
2776
+               fprintf(stderr, "ZIP::MOVSICC -- Unsupported condition: ");
2777
+                       zip_debug_ccode(cmpcode);
2778
+                       fprintf(stderr, "\n");
2779
+               }
2780
+               return false;
2781
+       }
2782 127 dgisselq
+       gcc_assert(zip_supported_condition((int)cmpcode));
2783
+
2784
+       //; Always do the default move
2785 142 dgisselq
+       bool    conditionally_do_false = false;
2786
+       conditionally_do_false = (MEM_P(iffalse))
2787
+               &&(!rtx_equal_p(dst,iffalse))
2788
+               &&(zip_supported_condition(reverse_condition(cmpcode)));
2789
+       conditionally_do_false = conditionally_do_false || (rtx_equal_p(dst,iftrue));
2790
+       if ((conditionally_do_false)&&(!zip_supported_condition(reverse_condition(cmpcode)))) {
2791
+               if (dbg) {
2792
+                       fprintf(stderr, "ZIP::MOVSICC -- Cant support the reverse condition: ");
2793
+                       zip_debug_ccode(cmpcode);
2794
+                       fprintf(stderr, "\n");
2795
+               }
2796
+               return false;
2797
+       }
2798 127 dgisselq
+
2799 142 dgisselq
+       if ((!rtx_equal_p(dst, iffalse))&&(!conditionally_do_false)) {
2800
+               if (dbg)
2801
+               fprintf(stderr, "ZIP::MOVSICC -- EMITTING MOVE FALSE->DST\n");
2802
+               insn = emit_move_insn(dst, iffalse);
2803
+               if (dbg) zip_debug_rtx_pfx("BARE-U: ", insn);
2804
+       }
2805
+
2806 127 dgisselq
+       rtx     cc_rtx = gen_rtx_REG(CCmode, zip_CC);
2807
+
2808
+       //; Now let's get our comparison right
2809 142 dgisselq
+       if (dbg) fprintf(stderr, "ZIP::MOVSICC -- EMITTING COMPARISON\n");
2810
+       insn = emit_insn(gen_rtx_SET(VOIDmode, cc_rtx,
2811 127 dgisselq
+               gen_rtx_COMPARE(CCmode, cmpa, cmpb)));
2812 142 dgisselq
+       if (dbg) zip_debug_rtx_pfx("BARE-C: ", insn);
2813 127 dgisselq
+
2814
+       //; Finally, let's load the value on true
2815 142 dgisselq
+       if (!rtx_equal_p(dst, iftrue)) {
2816
+               if (dbg) fprintf(stderr, "ZIP::MOVSICC -- EMITTING BARE\n");
2817
+               insn=emit_insn(gen_movsicc_bare(dst,
2818 127 dgisselq
+                       gen_rtx_fmt_ee(cmpcode, SImode, NULL_RTX, NULL_RTX),
2819
+                       iftrue, dst));
2820 142 dgisselq
+               if (dbg) zip_debug_rtx_pfx("BARE-T: ", insn);
2821
+       }
2822
+
2823
+       if (conditionally_do_false) {
2824
+               gcc_assert(zip_supported_condition(reverse_condition(cmpcode)));
2825
+               insn=emit_insn(gen_movsicc_bare(dst,
2826
+                       gen_rtx_fmt_ee(reverse_condition(cmpcode), SImode,
2827
+                       NULL_RTX, NULL_RTX), iffalse, dst));
2828
+               if (dbg) zip_debug_rtx_pfx("BARE-F: ", insn);
2829
+       }
2830
+
2831
+       // Return true on success
2832
+       return true;
2833 102 dgisselq
+}
2834
+
2835
+const char *zip_addsicc(rtx dst, rtx condition, rtx ifsrc, rtx addv ATTRIBUTE_UNUSED) {
2836
+       // We know upon entry that REG_P(dst) must be true
2837
+       if (!REG_P(dst))
2838
+               internal_error("%s","ADDSICC into something other than register");
2839
+       if ((REG_P(ifsrc))&&(REGNO(dst)==REGNO(ifsrc))) {
2840
+               switch (GET_CODE(condition)) {
2841
+               case EQ: return "ADD.Z\t%3,%0";
2842
+               case NE: return "ADD.NZ\t%3,%0";
2843
+               case LT: return "ADD.LT\t%3,%0";
2844
+               case GT: return "ADD.GT\t%3,%0";
2845
+               case LE: return "ADD.LT\t%3,%0\n\tADD.Z\t%3,%0";
2846
+               case GE: return "ADD.GE\t%3,%0";
2847
+               case LTU: return "ADD.C\t%3,%0";
2848
+               case LEU: return "ADD.C\t%3,%0\n\tADD.Z\t%3,%0";
2849
+               case GEU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tXOR\t2,CC";
2850
+               // Can do a GEU comparison, and then undo on the Zero condition
2851
+               case GTU: return "XOR\t2,CC\n\tADD.C\t%3,%0\n\tSUB.Z\t%3,%0\n\tXOR\t2,CC";
2852
+               default:
2853
+                       internal_error("%s", "Zip/No usable addsi expansion");
2854
+                       break;
2855
+               }
2856
+       } else {
2857
+               // MOV A+REG,REG
2858
+               switch (GET_CODE(condition)) {
2859
+               case EQ: return "MOV.Z\t%3+%2,%0";
2860
+               case NE: return "MOV.NZ\t%3+%2,%0";
2861
+               case LT: return "MOV.LT\t%3+%2,%0";
2862
+               case GT: return "MOV.GT\t%3+%2,%0";
2863
+               case LE: return "MOV.LT\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2864
+               case GE: return "MOV.GE\t%3+%2,%0";
2865
+               case LTU: return "MOV.C\t%3+%2,%0";
2866
+               case LEU: return "MOV.C\t%3+%2,%0\n\tMOV.Z\t%3+%2,%0";
2867
+               case GEU: return "XOR\t2,CC\n\tMOV.C\t%3+%2,%0\n\tXOR\t2,CC";
2868
+               // Can do a GEU comparison, and then undo on the Zero condition
2869
+               // EXCEPT: with a move instruction, what's there to undo?  We
2870
+               // just clobbered our register!
2871
+               // case GTU: return "XOR\t2,CC\n\tMOV.C\t%3,%0\n\tSUB.Z\t%3,%0XOR\t2,CC";
2872
+               default:
2873
+                       internal_error("%s", "Zip/No usable addsi(reg,reg) expansion");
2874
+                       break;
2875
+               }
2876
+       }
2877
+
2878
+       return "BREAK";
2879
+}
2880
+
2881 103 dgisselq
+static int     zip_memory_move_cost(machine_mode mode, reg_class_t ATTRIBUTE_UNUSED, bool in ATTRIBUTE_UNUSED) {
2882 102 dgisselq
+       int     rv = 14;
2883
+       if ((mode == DImode)||(mode == DFmode))
2884
+               rv += 2;
2885
+       return rv;
2886
+}
2887
+
2888 103 dgisselq
+// #warning "How do we tell the compiler LDI label is expensive as 2 ops"?
2889 117 dgisselq
+static bool    zip_cannot_modify_jumps_p(void) {
2890
+       // Let's try their suggested approach, keeping us from modifying jumps
2891
+       // after reload.  This should also allow our peephole2 optimizations
2892
+       // to adjust things back to what they need to be if necessary.
2893
+       return (reload_completed || reload_in_progress);
2894
+}
2895 122 dgisselq
+
2896
+rtx_insn       *zip_ifcvt_info;
2897
+
2898
+void
2899
+zip_ifcvt_modify_tests(ce_if_block *ce_info ATTRIBUTE_UNUSED, rtx *true_expr, rtx *false_expr) {
2900
+       const bool      dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
2901
+       if (dbg) fprintf(stderr, "IFCVT-MODIFY-TESTS\n");
2902
+       if (*true_expr) switch(GET_CODE(*true_expr)) {
2903
+               case LE:
2904
+               case GTU:
2905
+               case GEU:
2906
+               case LEU:
2907
+                       if (dbg) fprintf(stderr, "TRUE, missing expr\n");
2908
+                       if (dbg) zip_debug_rtx(*true_expr);
2909
+                       *true_expr = NULL_RTX;
2910
+                       break;
2911
+               default: // LT, GT, GTE, LTU, NE, EQ
2912
+                       break;
2913
+       }
2914
+
2915
+       if (*false_expr) switch(GET_CODE(*false_expr)) {
2916
+               case LE:
2917
+               case GTU:
2918
+               case GEU:
2919
+               case LEU:
2920
+                       if (dbg) fprintf(stderr, "FALSE, missing expr\n");
2921
+                       if (dbg) zip_debug_rtx(*false_expr);
2922
+                       *false_expr = NULL_RTX;
2923
+               default:
2924
+                       break;
2925
+       }
2926
+       if ((dbg)&&((!*true_expr)||(!*false_expr)))
2927
+               fprintf(stderr, "IFCVT-MODIFY-TESTS -- FAIL\n");
2928
+}
2929
+
2930
+void
2931 142 dgisselq
+zip_ifcvt_machdep_init(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2932 122 dgisselq
+/*
2933 142 dgisselq
+if (!ceinfo->then_bb)
2934
+       return;
2935
+rtx_insn *insn;
2936
+FOR_BB_INSNS(ceinfo->then_bb, insn) {
2937
+       fprintf(stderr, "IFCVT -- INIT\n");
2938
+       zip_debug_rtx_pfx("INIT-BB", insn);
2939 122 dgisselq
+}
2940
+*/
2941
+/*
2942
+       zip_ifcvt_info = NULL;
2943
+       rtx_insn *insn, *ifinsn = NULL;
2944
+       FOR_BB_INSNS(ceinfo->test_bb, insn) {
2945
+               rtx     p;
2946
+               p = single_set(insn);
2947
+               if (!p) continue;
2948
+               if (SET_DEST(p)==pc_rtx) {
2949
+                       ifinsn = insn;
2950
+               }
2951
+               if (!REG_P(SET_DEST(p)))
2952
+                       continue;
2953
+               if (GET_MODE(SET_DEST(p))!=CCmode)
2954
+                       continue;
2955
+               if (REGNO(SET_DEST(p))!=zip_CC)
2956
+                       continue;
2957
+               zip_ifcvt_info = insn;
2958
+       }
2959
+
2960
+       if (zip_ifcvt_info)
2961
+               zip_debug_rtx_pfx("PUTATIVE-CMP",zip_ifcvt_info);
2962
+       if (ifinsn)
2963
+               zip_debug_rtx_pfx("PRIOR-JMP",ifinsn);
2964
+*/
2965
+}
2966
+
2967 142 dgisselq
+void
2968
+zip_ifcvt_modify_insn(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED,
2969
+               rtx pattern ATTRIBUTE_UNUSED,
2970
+               rtx_insn *insn ATTRIBUTE_UNUSED) {
2971
+       // zip_debug_rtx_pfx("MODIFY-INSN: ", insn);
2972
+}
2973
+
2974
+void
2975
+zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2976
+/*
2977
+       fprintf(stderr, "IFCVT -- CANCEL\n");
2978
+       zip_ifcvt_info = NULL;
2979
+*/
2980
+}
2981
+
2982
+void
2983
+zip_ifcvt_modify_final(struct ce_if_block *ceinfo ATTRIBUTE_UNUSED) {
2984
+/*
2985
+rtx_insn *insn;
2986
+FOR_BB_INSNS(ceinfo->test_bb, insn) {
2987
+       fprintf(stderr, "IFCVT -- FINAL\n");
2988
+       zip_debug_rtx_pfx("FINAL-TEST-BB", insn);
2989
+}
2990
+       zip_ifcvt_info = NULL;
2991
+*/
2992
+}
2993
+
2994
+
2995 127 dgisselq
+int    zip_insn_sets_cc(rtx_insn *insn) {
2996
+       return (get_attr_ccresult(insn)==CCRESULT_SET);
2997
+}
2998
+
2999
+int    zip_is_conditional(rtx_insn *insn) {
3000
+       return (get_attr_conditional(insn)==CONDITIONAL_YES);
3001
+}
3002 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
3003
--- gcc-5.3.0-original/gcc/config/zip/zip.h     1969-12-31 19:00:00.000000000 -0500
3004 191 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h  2016-09-13 13:46:17.890711238 -0400
3005
@@ -0,0 +1,4095 @@
3006 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
3007
+//
3008
+// Filename:   gcc/config/zip/zip.h
3009
+//
3010
+// Project:    Zip CPU backend for the GNU Compiler Collection
3011
+//
3012
+// Purpose:
3013
+//
3014
+// Creator:    Dan Gisselquist, Ph.D.
3015
+//             Gisselquist Technology, LLC
3016
+//
3017
+////////////////////////////////////////////////////////////////////////////////
3018
+//
3019
+// Copyright (C) 2016, Gisselquist Technology, LLC
3020
+//
3021
+// This program is free software (firmware): you can redistribute it and/or
3022
+// modify it under the terms of  the GNU General Public License as published
3023
+// by the Free Software Foundation, either version 3 of the License, or (at
3024
+// your option) any later version.
3025
+//
3026
+// This program is distributed in the hope that it will be useful, but WITHOUT
3027
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
3028
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3029
+// for more details.
3030
+//
3031
+// You should have received a copy of the GNU General Public License along
3032
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
3033
+// target there if the PDF file isn't present.)  If not, see
3034
+// <http://www.gnu.org/licenses/> for a copy.
3035
+//
3036
+// License:    GPL, v3, as defined and found on www.gnu.org,
3037
+//             http://www.gnu.org/licenses/gpl.html
3038
+//
3039
+//
3040
+////////////////////////////////////////////////////////////////////////////////
3041
+#ifndef        GCC_ZIP_H
3042
+#define        GCC_ZIP_H
3043
+
3044
+
3045
+//
3046
+//
3047 127 dgisselq
+// Zip CPU configuration defines
3048 102 dgisselq
+//
3049
+//
3050
+#define        ZIP_USER        0        // Assume we are in supervisor mode
3051
+#define        ZIP_MULTIPLY    1       // Assume we have multiply instructions
3052
+#define        ZIP_DIVIDE      1       // Assume we have divide instructions
3053
+#define        ZIP_FPU         0        // Assume we have no floating point instructions
3054
+#define        ZIP_PIPELINED   1       // Assume our instructions are pipelined
3055
+#define        ZIP_VLIW        1       // Assume we have the VLIW feature
3056
+#define        ZIP_ATOMIC      ((ZIP_PIPELINED)&&(ZIP_VLIW))
3057
+#define        ZIP_PIC         0        // Attempting to produce PIC code, with GOT
3058
+#define        ZIP_HAS_DI      1
3059 127 dgisselq
+// Should we use the peephole optimizations?
3060
+#define        ZIP_PEEPHOLE    1       // 0 means no peephole optimizations.
3061 138 dgisselq
+// How about the new long multiply instruction set?
3062
+#define        ZIP_LONGMPY     1       // 0 means use the old instruction set
3063 102 dgisselq
+
3064
+// Zip has 16 registers in each user mode.
3065
+//     Register 15 is the program counter (PC)
3066
+//     Register 14 is the condition codes (CC)
3067
+//     Register 13 is the stack pointer   (SP)
3068
+//     Register 12 (may be) the Global Offset Table pointer (GOT)
3069
+//     Register  0 (may be) the return address pointer
3070
+// Registers 16-31 may only be used in supervisor mode.
3071
+#define        is_ZIP_GENERAL_REG(REGNO)       ((REGNO)<13)
3072 171 dgisselq
+#define        is_ZIP_REG(REGNO)               ((REGNO)<33)
3073 102 dgisselq
+
3074 171 dgisselq
+#define        zip_AP_PSEUDO   32
3075 103 dgisselq
+#define        zip_PC          15
3076
+#define        zip_CC          14
3077
+#define        zip_SP          13
3078
+#define        zip_FP          12
3079
+#define        zip_GOT         11
3080 171 dgisselq
+// #define     zip_AP          10      // We're using a PSEUDO REG instead
3081 103 dgisselq
+#define        zip_R1          1
3082
+#define        zip_R0          0
3083 102 dgisselq
+
3084
+#define        ZIP_FIRST_ARG_REGNO     1
3085
+#define        ZIP_LAST_ARG_REGNO      5
3086 111 dgisselq
+#define        NUM_ARG_REGS            (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
3087
+#define        MAX_PARM_REGS           (ZIP_LAST_ARG_REGNO-ZIP_FIRST_ARG_REGNO+1)
3088 102 dgisselq
+
3089
+/* The overall framework of an assembler file */
3090
+
3091
+#define        ASM_COMMENT_START       ";"
3092
+#define        ASM_APP_ON              ""
3093
+#define        ASM_APP_OFF             ""
3094
+
3095
+#define        FILE_ASM_OP             "\t.file\n"
3096
+
3097
+/* Output and Generation of Labels */
3098
+#define        GLOBAL_ASM_OP           "\t.global\t"
3099
+
3100
+#undef BITS_PER_UNIT
3101
+#define        BITS_PER_UNIT   (32)
3102
+
3103
+/* Assembler Commands for Alignment */
3104
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
3105 127 dgisselq
+       { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
3106 102 dgisselq
+
3107
+
3108
+/* A C compound statement to output to stdio stream STREAM the assembler syntax
3109
+ * for an instruction operand X. */
3110
+#define        PRINT_OPERAND(STREAM, X, CODE)  zip_print_operand(STREAM, X, CODE)
3111
+#define        PRINT_OPERAND_ADDRESS(STREAM, X) zip_print_operand_address(STREAM, X)
3112
+
3113
+/* Passing arguments in registers */
3114
+#define        FUNCTION_VALUE_REGNO_P(REGNO)   ((REGNO)==zip_R1)
3115
+
3116
+/* Define how to find the value returned by a function.  VALTYPE is the data
3117
+ * type of the value (as a tree).  If the precise function being called is known
3118
+ * FUNC is its FUNCTION_DECL; otherwise, FUNC is 0. */
3119
+#define        FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG(TYPE_MODE(VALTYPE), zip_R1)
3120
+
3121
+/* Define how to find the value returned by a library function assuming the
3122
+ * value has mode MODE.
3123
+ */
3124
+#define        LIBCALL_VALUE(MODE)     gen_rtx_REG(MODE, zip_R1)
3125
+
3126
+
3127
+/* STACK AND CALLING */
3128
+
3129
+
3130
+/* Define this macro as a C expression that is nonzero for registers that are
3131
+ * used by the epilogue or the return pattern.  The stack and frame pointer
3132
+ * registers are already assumed to be used as needed.
3133
+ */
3134
+#define        EPILOGUE_USES(R)        (R == RETURN_ADDRESS_REGNUM)
3135
+
3136
+
3137
+/* The best alignment to use in cases where we have a choice. */
3138 127 dgisselq
+#define        FASTEST_ALIGNMENT       BITS_PER_WORD
3139 102 dgisselq
+
3140
+/* MAX_FIXED_MODE_SIZE -- An integer expression for the size in bits of the
3141
+ * largest integer machine mode that should actually be used.  All integer
3142
+ * machine modes of this size and smaller can be used for structures and unions
3143
+ * with the appropriate sizes.  If this macro is undefined,
3144
+ * GET_MODE_BITSIZE(DImode) is assumed.
3145
+ *
3146
+ * ZipCPU -- The default looks good enough for us.
3147
+ */
3148
+
3149
+/* Generate Code for Profiling
3150
+ */
3151
+#define        FUNCTION_PROFILER(FILE,LABELNO)         (abort(), 0)
3152
+
3153
+
3154
+/* A C expression which is nonzero if register number NUM is suitable for use
3155
+ * as an index register in operand addresses.
3156
+ */
3157
+#define        REGNO_OK_FOR_INDEX_P(NUM)       0
3158
+
3159
+
3160
+/* A C compound statement with a conditional 'goto LABEL;' executed if X
3161
+ * (an RTX) is a legitimate memory address on the target machine for a memory
3162
+ * operand of mode MODE.
3163
+ */
3164 111 dgisselq
+/* 17.03 Controlling the Compilation Driver, 'gcc' */
3165
+// DRIVER_SELF_SPECS
3166
+// OPTION_DEFAULT_SPECS
3167
+// CPP_SPEC
3168
+// CPLUSPLUS_CPP_SPEC
3169
+// CC1_SPEC
3170
+// CC1PLUS_SPEC
3171
+/* ASM_SPEC ... A C string constant that tells the GCC driver program options
3172
+ * to pass to the assembler.  It can also specify how to translate options you
3173
+ * give to GCC into options for GCC to pass to the assembler.  See the file
3174
+ * 'sun3.h' for an example of this.
3175
+ *
3176
+ * Do not define thismacro if it does not need to do anything.
3177
+ */
3178
+// #undef      ASM_SPEC
3179
+// ASM_FINAL_SPEC
3180
+// ASM_NEEDS_DASH_FOR_PIPED_INPUT
3181
+
3182
+/* LINK_SPEC ... A C string constant that tells the GCC driver program options
3183
+ * to pass to the linker.  It can also specify how to translate options you give
3184
+ * to GCC into options for GCC to pass to the linker.
3185
+ *
3186
+ * Do not define this macro if it does not need to do anything.
3187
+ */
3188
+
3189
+/* LIB_SPEC ... Another C string constant very much like LINK_SPEC.  The
3190
+ * difference between the two is that LIB_SPEC is used at the end of the
3191
+ * command given to the linker.
3192
+ *
3193
+ * If this macro is not defined, a default is provided that loads the standard
3194
+ * C library from the usual place.  See 'gcc.c'.
3195
+ */
3196
+#undef LIB_SPEC
3197
+// #define     LIB_SPEC        "%{!g:-lc} %{g:-lg} -lzip"
3198
+#define        LIB_SPEC        ""
3199
+
3200
+/* LIBGCC_SPEC ... Another C string constant that tells the GCC driver program
3201
+ * hoow and when to place a reference to 'libgcc.a' into the linker command
3202
+ * line.  This constant is placed both before and after the value of LIB_SPEC.
3203
+ *
3204
+ * If this macro is not defined, the GCC driver provides a default that passes
3205
+ * the string '-lgcc' to the linker.
3206
+ */
3207
+#undef LIBGCC_SPEC
3208
+#define        LIBGCC_SPEC     ""
3209
+
3210
+/* REAL_LIBGCC_SPEC ... By default, if ENABLE_SHARED_LIBGCC is defined, the
3211
+ * LIBGCC_SPEC is not directly used by the driver program but is instead
3212
+ * modified to refer to different versions of 'libgcc.a' depending on the
3213
+ * values of the command line flags '-static', '-shared', '-static-libgcc',
3214
+ * and '-shared-libgcc'.  On targets where these modifications are
3215
+ * inappropriate, define REAL_LIBGCC_SPEC instead.  REAL_LIBGCC_SPEC tells the
3216
+ * driver how to place a reference to 'libgcc' on the link command line, but
3217
+ * unlike LIBGCC_SPEC, it is used unmodified.
3218
+ */
3219
+#define        REAL_LIBGCC_SPEC        ""
3220
+
3221
+// USE_LD_AS_NEEDED
3222
+// LINK_EH_SPEC
3223
+
3224
+/* STARTFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3225
+ * difference between the two is that STARTFILE_SPEC is used at the very
3226
+ * beginning of the command given to the linker.
3227
+ *
3228
+ * If this macro is not defined, a default is provided that loads the standard
3229
+ * C startup file from the usual place.  See 'gcc.c'
3230
+ */
3231
+#undef STARTFILE_SPEC
3232
+#define        STARTFILE_SPEC  ""
3233
+
3234
+/* ENDFILE_SPEC ... Another C string constant used much like LINK_SPEC.  The
3235
+ * difference between the two is that ENDFILE_SPEC is used at the very end
3236
+ * of the command given to the linker.
3237
+ *
3238
+ * Do not define this macro if it does not do anything.
3239
+ */
3240
+// #undef      ENDFILE_SPEC
3241
+// #define     ENDFILE_SPEC    ""
3242
+
3243
+// THREAD_MODEL_SPEC
3244
+// SYSROOT_SUFFIX_SPEC
3245
+// SYSROOT_HEADERS_SUFFIX_SPEC
3246
+// EXTRA_SPECS
3247
+// LINK_LIBGCC_SPECIAL_1
3248
+// LINK_GCC_C_SEQUENCE_SPEC
3249
+// LINK_COMMAND_SPEC
3250
+// TARGET_ALWAYS_STRIP_DOTDOT
3251
+// MULTILIB_DEFAULTS
3252
+// RELATIVE_PREFIX_NOT_LINKDIR
3253
+// MD_EXEC_PREFIX
3254
+// STANDARD_STARTFILE_PREFIX
3255
+// STANDARD_STARTFILE_PREFIX_1
3256
+// STANDARD_STARTFILE_PREFIX_2
3257
+// MD_STARTFILE_PREFIX
3258
+// MD_STARTFILE_PREFIX_1
3259
+// INIT_ENVIRONMENT
3260
+// LOCAL_INCLUDE_DIR
3261
+#undef LOCAL_INCLUDE_DIR
3262
+
3263
+// NATIVE_SYSTEM_HEADER_COMPONENT
3264
+// INCLUDE_DEFAULTS
3265
+
3266 102 dgisselq
+/* 17.03 Run-time Target Specification */
3267
+
3268
+/* TARGET_CPU_CPP_BUILTINS() ... This function-like macro expands to a block of
3269
+ * code that defines built-in preprocessor macros and assertions for the target
3270
+ * CPU, using the functions builtin_define, builtin_define_std, and
3271
+ * builtin_assert.  When the front end calls this macro it provides a trailing
3272
+ * semicolon, and since it has finished command line option proccessing your
3273
+ * code can use those results freely.
3274
+ *
3275
+ * ZipCPU --- We should probably capture in this macro what capabilities the
3276
+ * command line parameters we've been given indicate that our CPU has.  That
3277
+ * way, code can be adjusted depending upon the CPU's capabilities.
3278
+ */
3279
+#define        TARGET_CPU_CPP_BUILTINS()                       \
3280
+       { builtin_define("__ZIPCPU__");                 \
3281
+       if (ZIP_FPU) builtin_define("__ZIPFPU__");      \
3282
+       if (ZIP_ATOMIC) builtin_define("__ZIPATOMIC__");        \
3283
+       }
3284
+       // If (zip_param_has_fpu)  builtin_define("__ZIPFPU__");
3285
+       // If (zip_param_has_div)  builtin_define("__ZIPDIV__");
3286
+       // If (zip_param_has_mpy)  builtin_define("__ZIPMPY__");
3287
+       // If (zip_param_has_lock) builtin_define("__ZIPLOCK__");
3288
+       // If (zip_param_supervisor) builtin_define("__ZIPUREGS__");
3289
+       // If (we support int64s) builtin_define("___int64_t_defined");
3290
+
3291
+/* TARGET_OS_CPP_BUILTINS() ... Similarly to TARGET_CPU_CPP_BUILTINS but this
3292
+ * macro is optional and is used for the target operating system instead.
3293
+ */
3294
+
3295
+/* Option macros: (we need to define these eventually ... )
3296
+ *
3297
+ *     TARGET_HANDLE_OPTION
3298
+ *     TARGET_HANDLE_C_OPTION
3299
+ *     TARGET_OBJ_CONSTRUCT_STRING_OBJECT
3300
+ *     TARGET_OBJ_DECLARE_UNRESOLVED_CLASS_REFERENCE
3301
+ *     TARGET_OBJ_DECLARE_CLASS_DEFINITION
3302
+ *     TARGET_STRING_OBJECT_REF_TYPE_P
3303
+ *     TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
3304
+ *     TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE(VOID)
3305
+ *     C_COMMON_OVERRIDE_OTPTIONS
3306
+ *     TARGET_OPTION_OPTIMIZATION_TABLE
3307
+ *     TARGET_OPTION_INIT_STRUCT
3308
+ *     TARGET_OPTION_DEFAULT_PARAMS
3309
+ */
3310
+
3311
+/* SWITCHABLE_TARGET
3312
+ *
3313
+ * Zip CPU doesn't need this, so it defaults to zero.  No need to change it
3314
+ * here.
3315
+ */
3316
+
3317
+/* TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(VOID) ... Returns true if the
3318
+ * target supports IEEE 754 floating-point exceptions and rounding modes, false
3319
+ * otherwise.  This is intended to relate to the float and double types, but not
3320
+ * necessarily "long double".  By default, returns true if the adddf3
3321
+ * instruction pattern is available and false otherwise, on the assumption that
3322
+ * hardware floating point supports exceptions and rounding modes but software
3323
+ * floating point does not.
3324
+ *
3325
+ * ZipCPU floating point is barely going to be functional, I doubt it will
3326
+ * support all of these bells and whistles when full functionality is even
3327
+ * achieved.  Therefore, we won't support these modes.  However, we can't just
3328
+ * set this to zero, so let's come back to this.
3329
+ */
3330
+// #warning "Wrong answer encoded to date"
3331 103 dgisselq
+// #undef      TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
3332 102 dgisselq
+// #define     TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P(X) 0
3333
+
3334
+/* 17.04 Defining data structures for per-function information */
3335
+
3336
+/* INIT_EXPANDERS ... Macro called to initialize any target specific
3337
+ * information.  This macro is called once per function, before generation of
3338
+ * any RTL has begun.  The intention is to allow the initialization of the
3339
+ * function pointer init_machine_status.
3340
+ */
3341
+// #warning "I may need to define this to handle function return addresses ..."
3342
+
3343
+/* 17.05 Storage Layout */
3344
+
3345
+/* Storage Layout */
3346
+#define        BITS_BIG_ENDIAN         0        // MSB has highest number
3347
+#define        BYTES_BIG_ENDIAN        1       // 1 if MSB is lowest number
3348
+#define        WORDS_BIG_ENDIAN        1       // 1 if MSW is lowest number
3349
+#define        FLOAT_WORDS_BIG_ENDIAN  1
3350
+#define        BITS_PER_WORD           32
3351
+// #define     MAX_BITS_PER_WORD       // defaults to BITS_PER_WORD
3352
+#define        UNITS_PER_WORD          1       // Storage units in a word, pwr of 2:1-8
3353
+#define        MIN_UNITS_PER_WORD      1       // Default is UNITS_PER_WORD
3354
+/* POINTER_SIZE ... Width of a pointer in bits.  You must specify a value no
3355
+ * wider than the width of Pmode.  If it is not equal to the width of Pmode,
3356
+ * you must define POINTERS_EXTEND_UNSIGNED. If you do not specify a value the
3357
+ * default is BITS_PER_WORD.
3358
+ *
3359
+ * ZipCPU --- All of our pointers are 32-bits, the width of our address bus.
3360
+ */
3361
+#define        POINTER_SIZE            32      // Ptr width in bits
3362
+/* POINTERS_EXTEND_UNSIGNED ... A C expression that determines how pointers
3363
+ * should be extended from ptr_mode to either Pmode or word_mode.  It is greater
3364
+ * than zero if pointers should be zero-extended, zero if they should be sign
3365
+ * extended, and negative if some other conversion is needed.  In the last case,
3366
+ * the extension is done by the target's ptr_extend instruction.
3367
+ *
3368
+ * You need not define this macro if the ptr_mode, Pmode, and word_mode are all
3369
+ * the same width.
3370
+ *
3371
+ * ZipCPU --- While we shouldn't need this, QImode and HImode have the same
3372
+ * number of bits as SImode.  Therefore, one might wish to convert between the
3373
+ * two.  Hence, we specify how we would do that here.
3374
+ */
3375 127 dgisselq
+#define        POINTERS_EXTEND_UNSIGNED        1
3376 102 dgisselq
+
3377
+/* PROMOTE_MODE(m,unsignedp,type) ... A macro to update m and unsignedp when an
3378
+ * object whose type is type and which has he specified mode and signedness is
3379
+ * to be stored in a register.  This macro is only called when type is a scalar
3380
+ * type.
3381
+ *
3382
+ * On most RISC machines, which only have operations that operate on a full
3383
+ * register, define this macro to set m to word_mode if m is an integer mode
3384
+ * narrower than BITS_PER_WORD.  In most cases, only integer modes should be
3385
+ * widened because wider precision floating-point operations are usually more
3386
+ * expensive than their narrower counterparts.
3387
+ *
3388
+ * For most machines, the macro definition does not change unsigndep.  However,
3389
+ * some machines, have instructions that preferentially handle either signed or
3390
+ * unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
3391
+ * loads from memory and 32-bit add instructions sign-extend the result to
3392
+ * 64-bits. On such machines, set unsignedp according to which kind of extension
3393
+ * is more efficient.
3394
+ *
3395
+ * Do not define this macro if it would never modify m.
3396
+ *
3397
+ * ZipCPU --- We need to always (if possible) promote everything to SImode where
3398
+ * we can handle things.  HImode and QImode just don't make sense on this CPU.
3399
+ */
3400
+#define        PROMOTE_MODE(M,U,T)     if ((GET_MODE_CLASS(M)==MODE_INT)&&(GET_MODE_SIZE(M)<2)) (M)=SImode;
3401
+
3402
+// TARGET_PROMOTE_FUNCTION_MODE
3403
+/* PARM_BOUNDARY ... Normal alignment required for function parameters on the
3404
+ * stack, in bits.  All stack parameters receive at least this much alignment
3405
+ * regardless of data type.  On most machines, this is the same as the size of
3406
+ * an integer.
3407
+ */
3408
+#define        PARM_BOUNDARY   32
3409
+
3410
+/* STACK_BOUNDARY ... Define this macro to the minimum alignment enforced by
3411
+ * hardware for the stack pointer on this machine.  The definition is a C
3412
+ * expression for the desired alignment (measured in bits).  This value is used
3413
+ * as a default if PREFERRED_STACK_BOUNDARY is not defined.  On most machines,
3414
+ * this should be the same as PARM_BOUNDARY.
3415
+ */
3416
+#define        STACK_BOUNDARY  PARM_BOUNDARY
3417
+
3418
+/* PREFERRED_STACK_BOUNDARY ... Define this ... */
3419 127 dgisselq
+#define        PREFERRED_STACK_BOUNDARY        STACK_BOUNDARY
3420 102 dgisselq
+
3421 127 dgisselq
+/* INCOMING_STACK_BOUNDARY ... Define this macro if the incoming stack boundary
3422
+ * may be different from PREFERRED_STACK_BOUNDARY.  This macro must evaluate
3423
+ * to a value equal to or larger than STACK_BOUNDARY.
3424 102 dgisselq
+ */
3425 127 dgisselq
+#define        INCOMING_STACK_BOUNDARY STACK_BOUNDARY
3426 102 dgisselq
+
3427
+/* FUNCTION_BOUNDARY ... Alignment required for a function entry point, in bits.
3428
+ */
3429
+#define        FUNCTION_BOUNDARY       32
3430
+
3431
+/* BIGGEST_ALIGNMENT ... Biggest alignment that any data type can require on
3432
+ * this machine, in bits.  Note that this is not the biggest alignment that is
3433
+ * supported, just the biggest alignment that, when violated, may cause a fault.
3434
+ */
3435
+#define BIGGEST_ALIGNMENT      32
3436
+
3437 127 dgisselq
+/* MALLOC_ABI_ALIGNMENT
3438
+ */
3439
+
3440
+/* ATTRIBUTE_ALIGNED_VALUE
3441
+ */
3442
+
3443 102 dgisselq
+/* MINIMUM_ATOMIC_ALIGNMENT ... If defined, the smallest alignment, that can be
3444
+ * given to an object that can be referenced in one operation, without
3445
+ * disturbing any nearby object.  Normally, this is BITS_PER_UNIT, but may be
3446
+ * larger on machines that don't have byte or halfword store operations.
3447
+ */
3448
+#define        MINIMUM_ATOMIC_ALIGNMENT        BITS_PER_UNIT
3449
+
3450 127 dgisselq
+/* BIGGEST_FIELD_ALIGNMENT ... Biggest alignment that any structure or union
3451
+ * field can require on this machine, in bits.  If defined, this overrides
3452
+ * BIGGEST_ALIGNMENT for structure and union fields only, unless the field
3453
+ * alignment has been set by the __attribute__((aligned(n))) construct.
3454
+ */
3455
+#define        BIGGEST_FIELD_ALIGNMENT BITS_PER_UNIT
3456
+
3457
+/* ADJUST_FIELD_ALIGN
3458
+ */
3459
+#define        ADJUST_FIELD_ALIGN(A,B) BITS_PER_WORD
3460
+
3461
+/* MAX_STACK_ALIGNMENT
3462
+ */
3463
+#define        MAX_STACK_ALIGNMENT     BITS_PER_WORD
3464
+
3465
+/* MAX_OFILE_ALIGNMENT
3466
+ */
3467
+
3468
+/* DATA_ALIGNMENT(TYPE, BASIC-ALIGN) ... If defined, a C expression to compute
3469
+ * the alignment for a variable in the static store.  TYPE is the data type, and
3470
+ * BASIC-ALIGN is the alignment that the object would ordinarily have.  The
3471
+ * value of this macro is used instead of that alignment to align the object.
3472
+ *
3473
+ * If this macro is not defined, then BASIC-ALIGN is used.
3474
+ *
3475
+ * ZipCPU -- in hindsight, if this macro is not defined then the compiler is
3476
+ * broken.  So we define it to be our fastest alignment, or 32-bits.
3477
+ */
3478
+#define        DATA_ALIGNMENT(TYPE, ALIGN)     BITS_PER_WORD
3479
+
3480
+
3481
+/* DATA_ABI_ALIGNMENT(TYPE,BASIC-ALIGN)
3482
+ */
3483
+
3484
+/* CONSTANT_ALIGNMENT(CONST, BASIC-ALIGN) ... If defined, a C expression to
3485
+ * compute the alignment given to a constant that is being placed in memory.
3486
+ * CONST is the constant and BASIC-ALIGN is the alignment that the object
3487
+ * would ordinarily have.  The value of this macro is used instead of that
3488
+ * alignment to align the object.
3489
+ *
3490
+ * If this macro is not defined, then BASIC-ALIGN is used.
3491
+ *
3492
+ * ZipCPU -- in hindsiht, if this macro is not defined then the compiler is
3493
+ * broken.  We'll define it as above.
3494
+ *
3495
+ */
3496
+#define        CONSTANT_ALIGNMENT(EXP, ALIGN)  BITS_PER_WORD
3497
+
3498
+/* LOCAL_ALIGNMENT(TYPE,BASIC-ALIGN) ... If defined ...
3499
+ */
3500
+#define        LOCAL_ALIGNMENT(TYP,ALIGN)      BITS_PER_WORD
3501
+
3502
+/* TARGET_VECTOR_ALIGNMENT
3503
+ */
3504
+
3505
+/* STACK_SLOT_ALIGNMENT
3506
+ */
3507
+#define        STACK_SLOT_ALIGNMENT(T,M,B)     BITS_PER_WORD
3508
+
3509
+/* LOCAL_DECL_ALIGNMEN(DECL)
3510
+ */
3511
+#define        LOCAL_DECL_ALIGNMENT(DECL)      BITS_PER_WORD
3512
+
3513
+/* MINIMUM_ALIGNMENT
3514
+ */
3515
+#define        MINIMUM_ALIGNMENT(EXP,MOD,ALIGN)        BITS_PER_WORD
3516
+
3517
+/* EMPTY_FIELD_BOUNDARY
3518
+ * Alignment of field after 'int : 0' in a structure.
3519
+ */
3520
+#define        EMPTY_FIELD_BOUNDARY    BITS_PER_WORD
3521
+
3522
+/* STRUCTURE_SIE_BOUNDARY
3523
+ * ZipCPU -- Every structures size must be a multiple of 32-bits.
3524
+ */
3525
+#define        STRUCTURE_SIZE_BOUNDARY BITS_PER_WORD
3526
+
3527 102 dgisselq
+/* STRICT_ALIGNMENT ... Set this nonzero if move instructions will actually
3528
+ * fail to work when given unaligned data.  If instructions will merely go
3529
+ * slower in that case, define this macro as 0.
3530 125 dgisselq
+ *
3531
+ * ZipCPU -- Since we have defined our smallest addressable unit to be a 32-bit
3532
+ * word (one byte, on our machine), and since reading any amount of 32-bit words
3533
+ * is easy, then there really are no instructions that will ever fail.
3534 102 dgisselq
+ */
3535 125 dgisselq
+#define        STRICT_ALIGNMENT        0
3536 102 dgisselq
+
3537 127 dgisselq
+/* PCC_BITFIELD_TYPE_MATTERS -- define this if you wish to imitate the the way
3538
+ * other C compilers handle alignment of bit-fields and the structures that
3539
+ * contain them.
3540
+ *
3541
+ * The behavior is that the type written for a named bit-field (int, short, or
3542
+ * other integer type) imposes an alignment for the entire structure, as if the
3543
+ * structure really did contain an ordinary field of that type.  In addition,
3544
+ * the bit-field is placed within the structure so that it would fit within
3545
+ * such a field, not crossing a boundary for it.
3546
+ *
3547
+ * Thus, no most machines, a named bit-field whose type is written as int would
3548
+ * not cross a four-byte boundary, and would force four-byte alignment for the
3549
+ * whole structure.  (The alignment used may not be four bytes; it is controlled
3550
+ * by other alignment parameters.)
3551
+ *
3552
+ * An unnamed bit-field will not affect the alignment of the containing
3553
+ * structure.
3554
+ *
3555
+ * If the macro is defined, its definition should be a C expression, a non
3556
+ * zero value for the expression enables this behavior.
3557
+ * Look at the fundamental type that is used for a bit-field and use that to
3558
+ * impose alignment on the enclosing structure.  struct s{int a:8}; should
3559
+ * have the same alignment as 'int', not 'char'.
3560
+ */
3561
+#undef PCC_BITFIELD_TYPE_MATTERS
3562
+#define        PCC_BITFIELD_TYPE_MATTERS       0
3563
+
3564 102 dgisselq
+/* MAX_FIXED_MODE_SIZE ... An integer expression for the size in bits of the
3565
+ * largest integer machine mode that should actually be used.  All integer
3566
+ * machine modes of this size or smaller can be used for structures and unions
3567
+ * with the appropriate sizes.  If this macro is undefined,
3568
+ * GET_MODE_BITSIZE(DImode) is assumed.
3569
+ *
3570
+ * ZipCPU ... Get_MOD_BITSIZE(DImode) will be 64, and this is really not the
3571
+ * size on bits of the largest integer machine mode.  However, that's the case
3572
+ * with most DI implementations: A long is two words, spliced together.  We'd
3573
+ * like to support that eventually, but we need to get there.  Hence, let's use
3574
+ * compile time flag (ZIP_HAS_DI) that we can enable when we're ready.
3575
+ */
3576
+#if (ZIP_HAS_DI != 0)
3577
+#define        MAX_FIXED_MODE_SIZE     64
3578
+#else
3579
+#define        MAX_FIXED_MODE_SIZE     32
3580
+#endif
3581
+
3582
+
3583
+/* 17.06 Layout of Source Language Data Types */
3584
+
3585
+#undef CHAR_TYPE_SIZE
3586
+#undef SHORT_TYPE_SIZE
3587
+#undef INT_TYPE_SIZE
3588
+#undef LONG_TYPE_SIZE
3589
+#undef LONG_LONG_TYPE_SIZE
3590
+//
3591
+#define        CHAR_TYPE_SIZE  32
3592
+#define        SHORT_TYPE_SIZE 32
3593
+#define        INT_TYPE_SIZE   32
3594
+#define        LONG_TYPE_SIZE  32
3595
+#define        LONG_LONG_TYPE_SIZE     64
3596
+// BOOL_TYPE_SIZE defaults to CHAR_TYPE_SIZE
3597
+#undef FLOAT_TYPE_SIZE
3598
+#undef DOUBLE_TYPE_SIZE
3599
+#undef LONG_DOUBLE_TYPE_SIZE
3600
+#define        FLOAT_TYPE_SIZE         32
3601
+#define        DOUBLE_TYPE_SIZE        FLOAT_TYPE_SIZE // Zip CPU doesn't support dbls
3602
+#define        LONG_DOUBLE_TYPE_SIZE   64      // This'll need to be done via emulation
3603
+// SHORT_FRAC_TYPE_SIZE
3604
+// LONG_FFRACT_TYPE_SIZE
3605
+// LONG_LONG_FRACT_TIME_SIZE
3606
+#undef SHORT_ACCUM_TYPE_SIZE
3607
+#undef ACCUM_TYPE_SIZE
3608
+#undef LONG_ACCUM_TYPE_SIZE
3609
+#define        SHORT_ACCUM_TYPE_SIZE   SHORT_TYPE_SIZE
3610
+#define        ACCUM_TYPE_SIZE         INT_TYPE_SIZE
3611
+#define        LONG_ACCUM_TYPE_SIZE    LONG_TYPE_SIZE
3612
+
3613
+/* LIBGCC2_GNU_PREFIX ... This macro corresponds to the TARGET_GNU_PREFIX target
3614
+ * hook and should be defined if that hook is overriden to be true.  It causes
3615
+ * function names in libgcc to be changed to use a __gnu_ prefix for their name
3616
+ * rather than the default __.  A port which uses this macro should also arrange
3617
+ * to use t-gnu-prefix in the libgcc config.host.
3618
+ *
3619
+ * ZipCPU -- I see no reason to define and therefore change this behavior.
3620
+ */
3621
+
3622
+/* TARGET_FLT_EVAL_METHOD ... A C expression for the value for FLT_EVAL_METHOD
3623
+ * in float.h,, assuming, if applicable, that the floating-point control word
3624
+ * is in its default state.  If you do not define this macro the value of
3625
+ * FLT_EVAL_METHOD will be zero.
3626
+ *
3627
+ * ZipCPU --- ???
3628
+ */
3629
+
3630
+/* WIDEST_HARDWARE_FP_SIZE ... A C expression for the size in bits of the widest
3631
+ * floating-point format supported by the hardware.  If you define this macro,
3632
+ * you must specify a value less than or equal to the value of LONG_DOUBLE_...
3633
+ * If you do not define this macro, the value of LONG_DOUBLE_TYPE_SIZE is the
3634
+ * default.
3635
+ *
3636
+ * ZipCPU supports 32-bit IEEE floats--IF THE SUPPORT IS COMPILED IN!  This
3637
+ * really needs to be determined, then, based upon a compile time parameter
3638
+ * where the one compiling the code states whether or not the H/W even has
3639
+ * floating point support.
3640
+ *
3641
+ * For now, we'll assume it does--but once we implement GCC parameters, we'll
3642
+ * need to change this.
3643
+ */
3644
+#undef WIDEST_HARDWARE_FP_SIZE
3645
+// #warning "Definition needs to change if no FPU present"
3646
+#define        WIDEST_HARDWARE_FP_SIZE FLOAT_TYPE_SIZE
3647
+
3648
+/* DEFAULT_SIGNED_CHAR ... An expression whose value is 1 or 0, according to
3649
+ * whether the type char should be signed or unsigned by default.  The user
3650
+ * can always override this default with the options -fsigned-char and
3651
+ * -funsigned-char.
3652
+ *
3653
+ * ZipCPU--let's go with the default behavior.
3654
+ */
3655
+#define        DEFAULT_SIGNED_CHAR     1
3656
+
3657
+/* TARGET_DEFAULT_SHORT_ENUMS(VOID) ... This target hook should return true if
3658 103 dgisselq
+ * the compiler should give an enum type only as many bytes as it takes to
3659 102 dgisselq
+ * represent the range of possible values of that type.  It should return
3660
+ * false if all enum types should be allocated like int.
3661
+ *
3662
+ * The default is to return false.  This is what the ZipCPU needs, so we won't
3663
+ * override it.
3664
+ */
3665
+
3666
+/* SIZE_TYPE ... A C expression for a string describing the name of the data
3667
+ * type to use for size values.  The typedef name size_t is defined using the
3668
+ * contents of the string.
3669
+ *
3670
+ * If you don't define this macro, the default is "long unsigned int".  Since
3671
+ * on the ZipCPU this is a 32-bit number, and all ZipCPU values are 32-bits,
3672
+ * the default seems perfect for us.
3673
+ */
3674
+#define        SIZE_TYPE       "unsigned int"
3675
+
3676
+/* SIZETYPE ... GCC defines internal types () for expressions dealing with size.
3677
+ * This macro is a C expression for a string describing the name of the data
3678
+ * type from which the precision of sizetype is extracted.  The string has the
3679
+ * same restrictions as SIZE_TYPE string.  If you don't define this macro, the
3680
+ * default is SIZE_TYPE --- which seems good enough for us.
3681
+ */
3682
+
3683
+/* PTRDIFF_TYPE ... A C expression for a string describing the name of the data
3684 127 dgisselq
+ * type to use for the result of subtracting two pointers.  The typedef name
3685 102 dgisselq
+ * ptrdiff_t is defined using the contents of the string.  See SIZE_TYPE for
3686
+ * more information.
3687
+ *
3688
+ * The default is "long int" which for the ZipCPU is 32-bits---still good enough
3689
+ * for us.
3690
+ */
3691
+#define        PTRDIFF_TYPE    "int"
3692
+
3693
+/* WCHAR_TYPE ... A C expression for a string describing the name of the data
3694
+ * type to use for wide characters.  The typedef name wchar_t is defined using
3695
+ * the contents of  the string.  If you don't define this macro, the default is
3696
+ * 'int'--good enough for ZipCPU.
3697
+ */
3698
+
3699
+/* WCHAR_TYPE_SIZE ... A C expression for the size in bits of the data type for
3700
+ * wide characters.  This is used in cpp, which cannot make use of WCHAR_TYPE.
3701
+ */
3702
+#undef WCHAR_TYPE_SIZE
3703
+#define        WCHAR_TYPE_SIZE 32
3704
+
3705
+/* WINT_TYPE ... A C expression for a string describing the name of the data
3706
+ * type to use for wide characters passed to printf and returned from getwc.
3707
+ * The typedef name wint_t is defined using the contents of the string.  See
3708
+ *
3709 103 dgisselq
+ * ZipCPU -- If you don't define this macro, the default is "unsigned int"--also
3710
+ * best for us again.
3711 102 dgisselq
+ */
3712
+
3713
+/* INTMAX_TYPE ... A C expression for a string describing the name of the
3714
+ * data type that can represent any value of any standard or extended signed
3715
+ * integer type.  The typedef name intmax_t is defined using the contents of
3716
+ * the string.
3717
+ *
3718
+ * If you don't define this macro, the default is the first of "int", "long int"
3719
+ * or "long long int" that has as much precision as "long long int".
3720
+ */
3721
+
3722
+/* UINTMAX_TYPE ... same as INTMAX_TYPE, but for unsigned
3723
+ */
3724
+
3725
+#undef SIG_ATOMIC_TYPE
3726
+#if (ZIP_ATOMIC != 0)
3727
+#define        SIG_ATOMIC_TYPE "int"
3728
+#else
3729
+#define        SIG_ATOMIC_TYPE NULL    // We have no atomic types, but registers
3730
+#endif
3731
+#undef INT8_TYPE
3732
+#define        INT8_TYPE               NULL    // We have no 8-bit integer type
3733
+#undef INT16_TYPE
3734
+#define        INT16_TYPE              NULL
3735
+#undef INT32_TYPE
3736
+#define        INT32_TYPE              "int"
3737
+#undef UINT8_TYPE
3738
+#define        UINT8_TYPE              NULL
3739
+#undef UINT16_TYPE
3740
+#define        UINT16_TYPE             NULL
3741
+#undef UINT32_TYPE
3742
+#define        UINT32_TYPE             "unsigned int"
3743
+#undef INT_LEAST8_TYPE
3744
+#define        INT_LEAST8_TYPE         "int"
3745
+#undef INT_LEAST16_TYPE
3746
+#define        INT_LEAST16_TYPE        "int"
3747
+#undef INT_LEAST32_TYPE
3748
+#define        INT_LEAST32_TYPE        "int"
3749
+#undef UINT_LEAST8_TYPE
3750
+#define        UINT_LEAST8_TYPE        "unsigned int"
3751
+#undef UINT_LEAST16_TYPE
3752
+#define        UINT_LEAST16_TYPE       "unsigned int"
3753
+#undef UINT_LEAST32_TYPE
3754
+#define        UINT_LEAST32_TYPE       "unsigned int"
3755
+#undef INT_FAST8_TYPE
3756
+#define        INT_FAST8_TYPE          "int"
3757
+#undef INT_FAST16_TYPE
3758
+#define        INT_FAST16_TYPE         "int"
3759
+#undef INT_FAST32_TYPE
3760
+#define        INT_FAST32_TYPE         "int"
3761
+#undef UINT_FAST8_TYPE
3762
+#define        UINT_FAST8_TYPE         "unsigned int"
3763
+#undef UINT_FAST16_TYPE
3764
+#define        UINT_FAST16_TYPE        "unsigned int"
3765
+#undef UINT_FAST32_TYPE
3766
+#define        UINT_FAST32_TYPE        "unsigned int"
3767
+#undef INTPTR_TYPE
3768
+#define        INTPTR_TYPE             "unsigned int"
3769
+#undef UINTPTR_TYPE
3770
+#define        UINTPTR_TYPE            "unsigned int"
3771
+
3772
+#undef INT64_TYPE
3773
+#undef UINT64_TYPE
3774
+#undef INT_LEAST64_TYPE
3775
+#undef UINT_LEAST64_TYPE
3776
+#undef INT_FAST64_TYPE
3777
+#undef UINT_FAST64_TYPE
3778
+
3779
+#if (ZIP_HAS_DI != 0)
3780
+#define        INT64_TYPE              "long int"
3781
+#define        UINT64_TYPE             "long unsigned int"
3782
+#define        INT_LEAST64_TYPE        "long int"
3783
+#define        UINT_LEAST64_TYPE       "long unsigned int"
3784
+#define        INT_FAST64_TYPE         "long int"
3785
+#define        UINT_FAST64_TYPE        "long unsigned int"
3786
+#else
3787
+#define        INT64_TYPE              NULL
3788
+#define        UINT64_TYPE             NULL
3789
+#define        INT_LEAST64_TYPE        NULL
3790
+#define        UINT_LEAST64_TYPE       NULL
3791
+#define        INT_FAST64_TYPE         NULL
3792
+#define        UINT_FAST64_TYPE        NULL
3793
+#endif
3794
+
3795
+#define        TARGET_PTRMEMFUNC_VBI_LOCATION  ptrmemfunc_vbit_in_pfn
3796
+
3797
+
3798
+/* 17.07 Register Usage / Register definitions */
3799
+
3800
+/* FIRST_PSEUDO_REGISTER ... Number of hardware registers known to the compiler.
3801
+ * They receive numbers 0 through FIRST_PSEUDO_REGISTER-1; thus the first
3802
+ * pseudo register's numbrer really is assigned the number
3803
+ * FIRST_PSEUDO_REGISTER.
3804
+ *
3805
+ * ZipCPU---There are 16 registers in the ZipCPU, numbered 0-15 with the CC
3806 171 dgisselq
+ * and PC register being numbered 14 and 15 respectively.  The ZipCPU has
3807
+ * another 16 registers, identical to the first, but user mode registers.  These
3808
+ * are number the same as the first (0-15) in user mode, but numbered (16-31)
3809
+ * in supervisor mode.  In addition, we create a pretend argument pointer
3810
+ * register, zip_AP_PSEUDO, to refer to our arguments.  This final register,
3811
+ * although it gets a valid number, will be eliminated in optimization.
3812 102 dgisselq
+ */
3813 171 dgisselq
+#define        FIRST_PSEUDO_REGISTER   (zip_AP_PSEUDO+1)
3814 102 dgisselq
+
3815
+/* FIXED_REGISTERS ... An initializer that says which registers are used for
3816
+ * fixed purposes all throughout the compiled code and are therefore not
3817
+ * available for general allocation.  These would include the stack pointer, the
3818
+ * frame pointer (except on machines where that can be used as a general
3819
+ * register when no frame pointer is needed), the program counter on machines
3820
+ * where that is considered one of the addressable registers, and any other
3821
+ * numbered register with a standard use.
3822
+ *
3823
+ * This information is expressed as a sequence of numbers, separated by commas,
3824
+ * and surrounded by braces.  The nth number is 1 if register n is fixed, 0
3825
+ * otherwise.
3826
+ *
3827
+ * For the Zip CPU, we have three fixed registers that are not available for
3828
+ * general allocation:
3829
+ *
3830
+ *     SP      The stack pointer
3831
+ *     CC      The condition codes and CPU state register
3832
+ *     PC      The program counter
3833
+ *
3834
+ * Other registers, such as FP (the frame pointer) or GBL (the global offset
3835
+ * table pointer) are registers that we hope will not be so fixed.
3836 171 dgisselq
+ *
3837
+ * Okay, just updated this process.  We now have more registers that are not
3838
+ * available for general allocation:
3839
+ *     uR0-uPC         User registers
3840
+ *     PSEUDO-AP       The pseudo arg pointer
3841 102 dgisselq
+ */
3842 171 dgisselq
+#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 }
3843 102 dgisselq
+
3844
+/* CALL_USED_REGISTERS ... like FIXED_REGISTERS but has 1 for each register
3845
+ * that is clobbered (in general) by function calls as well as for fixed
3846
+ * registers.  This macro therefore identifies the registers that are not
3847
+ * available for general allocation of values that must live across function
3848
+ * calls.
3849
+ *
3850
+ * If a register has 0 in CALL_USED_REGISTERS, the compiler automatically saves
3851
+ * it on function entry and restores it on function exit, if the register is
3852
+ * used within the function.
3853
+ *
3854
+ * On the Zip CPU, we must save R0 (the return address), and (let's pick) any
3855
+ * register above R5.
3856
+ */
3857 171 dgisselq
+#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 }
3858 102 dgisselq
+
3859
+/* CALL_REALLY_USED_REGISTERS ...  optional macro that, if not defined, defaults
3860
+ * to the value of CALL_USED_REGISTERS.
3861
+ */
3862
+
3863
+/* HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) ... A C expression that is nonzero
3864
+ * if it is not permissible to store a value of mode MODE in hard register REGNO
3865
+ * across a call without some part of it being clobbbered.  For most machines,
3866
+ * this macro need not be defined.  It is only required for machines that do
3867 103 dgisselq
+ * not preserve the entire contents of a register across a call.
3868 102 dgisselq
+ *
3869 127 dgisselq
+ * ZipCPU--Always preserves the entire contents of those registers that are
3870
+ * preserved across calls, so this shouldnt need to be defined.
3871 102 dgisselq
+ */
3872 127 dgisselq
+// #define     HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE)      (REGNO==0)
3873 102 dgisselq
+
3874
+/* TARGET_CONDITIONAL_REGISTER_USAGE(VOID) ... This hook may conditionally
3875
+ * modify five variables fixed_regs, call_used_regs, global_regs, reg_names, and
3876
+ * reg_class_contents, to take into account any dependence of these register
3877
+ * sets on target flags.  The first three of these are of type char[]
3878
+ * (interpreted as Boolean vectors).  global_regs is a const char *[] and
3879
+ * reg_class_contents is a HARD_REG_SET.  Before the macro is called,
3880
+ * fixed_regs, call_used_regs, reg_class_contents, and reg_names have been
3881
+ * initialized from FIXED_REGISTERS, CALL_USED_REGISTERS, REG_CLASS_CONTENTS,
3882
+ * and REGISTER_NAMES, respectively.  global_regs has been cleared, and any
3883
+ * -ffixed-reg, -fcall-used-reg, and -fcall-saved-reg command options have been
3884
+ * applied.
3885
+ *
3886 171 dgisselq
+ * ZipCPU -- I may need to return and define this depending upon how the
3887
+ * GBL register allocation goes.  But for now, we'll leave this at its default
3888 102 dgisselq
+ * value.
3889
+ */
3890
+// #warning "Revisit me after FP and GBL allocation"
3891
+
3892
+/* INCOMING_REGNO(out) ... Define this macro if the target machine has register
3893
+ * windows. ...
3894
+ *
3895
+ * Zip CPU has no register windows.
3896
+ */
3897
+
3898
+/* OUTGOING_REGNO ... same thing.
3899 171 dgisselq
+ * LOCAL_REGNO ... same thing.
3900 102 dgisselq
+ */
3901
+
3902
+/* PC_REGNUM ... If the program counter has a register number, define this as
3903
+ * that register number.  Otherwise do not define it.
3904
+ */
3905
+#define        PC_REGNUM       zip_PC
3906
+
3907
+
3908
+/* REG_ALLOC_ORDER ... If defined, an initializer for a vector of integers,
3909
+ * containing the number of hard registers in the order in which GCC should
3910
+ * prefer to use them (from most preferred to least.
3911
+ *
3912 103 dgisselq
+ * If this macro is not defined, registers are used lowest numbered first (all
3913 102 dgisselq
+ * else being equal).
3914
+ *
3915
+ * Since the default is the ZipCPU desired case, we won't define this here.
3916
+ */
3917
+
3918
+/* ADJUST_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3919
+ * this macro, so we won't either.
3920
+ */
3921
+
3922
+/* HONOR_REG_ALLOC_ORDER ...
3923
+ */
3924
+
3925
+/* HONOR_REG_ALLOC_ORDER ... on most machines it is not necessary to define
3926
+ * this macro, so we won't either.
3927
+ */
3928
+
3929
+/* HARD_REGNO_NREGS(REGNO, MODE) ... A C expression for the number of
3930
+ * consecutive hard registers, starting at register number REGNO, required to
3931
+ * hold a value of mode MODE.
3932
+ *
3933
+ * On a machine where all registers are exactly one word, a suitable definition
3934
+ * is given of ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)/UNITS_PER_WORD.
3935
+ *
3936
+ * On ZipCPU, we might do
3937
+ *     ((((MODE)==DImode)||((MODE)==DFmode))?2:1)
3938
+ * but I think the default (above) code should work as well.  Hence, let's stick
3939
+ * with the default, lest someone try to create larger modes (TImode, OImode,
3940
+ * XImode) and expect us to follow them properly some how.
3941
+ *
3942
+ * Okay, now in hind sight, we know that the default doesn't work for our
3943
+ * architecture, since GET_MODE_SIZE(SImode)=4, not 1.  Thus, let's rearrange
3944
+ * this expression to work in bits rather than in bytes and we'll know more
3945
+ * of what we are doing.
3946
+ */
3947
+#undef HARD_REGNO_NREGS
3948
+#define        HARD_REGNO_NREGS(REGNO, MODE)   ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1)\
3949
+               / (UNITS_PER_WORD))
3950
+
3951
+/* HARD_REGNO_NREGS_HAS_PADDING(REGNO,MODE) ... A C expression that is nonzero
3952
+ * if a value of mode MODE, stored in memory, ends with padding that causes it
3953
+ * to take up more space than in registers starting at register number REGNO
3954
+ * (as determined by multiplying GCC's notion of the size of the register when
3955
+ * containing this mode by the number of registers returned by HARD_REGNO_NREGS)
3956
+ * By default this is zero.
3957
+ *
3958
+ * Zip CPU --- The default looks good enough to me.
3959
+ */
3960
+
3961
+/* HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE)
3962
+ *
3963
+ * ZipCPU ---
3964
+ */
3965
+
3966
+/* REGMODE_NATURAL_SIZE(MODE) -- Define this macro if the natural size of
3967
+ * registers that hold values of mode mode is not the word size.  It is a C
3968
+ * expression that should give the natural size in bytes for the specified mode.
3969
+ * It is used by the register allocator to try to optimize its results.
3970
+ *
3971
+ * ZipCPU ---
3972
+ */
3973
+// #define     REGMODE_NATURAL_SIZE(MODE)      (((MODE)==DImode)?2:1)
3974
+
3975
+/* HARD_REGNO_MODE_OK ... A C expression that is nonzero if it is permissible
3976 103 dgisselq
+ * to store a value of mode MODE in a hard register number REGNO (or in several
3977 102 dgisselq
+ * registers starting with that one).  For a machine where all registers are
3978
+ * equivalent, a suitable definition is '1'.  You need not include code to check
3979
+ * for the numbers of fixed registers, because the allocation mechanism
3980
+ * considered them to be always occupied.
3981
+ *
3982
+ * ZipCPU --- As long as you are already avoiding the fixed registers, the
3983
+ * suitable default definition mentioned above should be sufficient.
3984
+ */
3985
+#undef HARD_REGNO_MODE_OK
3986 103 dgisselq
+#define        HARD_REGNO_MODE_OK(R,M) (R<zip_CC)
3987 102 dgisselq
+
3988
+/* HARD_REGNO_RENAME_OK(FROM,TO) ... A C expression that is nonzero if it is
3989
+ * okay to rename a hard register FROM to another hard register TO.  One common
3990
+ * use of this macro is to prevernt renaming of a register to another register
3991
+ * that is not saved by a prologue in an interrupt handler.  The default is
3992
+ * always nonzero.
3993
+ *
3994
+ * ZipCPU --- The default looks good enough to us.
3995
+ */
3996
+#undef HARD_REGNO_RENAME_OK
3997
+#define        HARD_REGNO_RENAME_OK(FROM,TO)   ((is_ZIP_GENERAL_REG(FROM))&&(is_ZIP_GENERAL_REG(TO)))
3998
+
3999
+
4000
+/* MODES_TIABLE_P(M1, M2) ... A C expression that is nonzero if a value of mode
4001
+ * M1 is accessible in mode M2 without copying.
4002
+ *
4003
+ * ZipCPU --- well, that's true for us (although we support scant few modes) ...
4004
+ * so lets' set to one.
4005
+ */
4006
+#define        MODES_TIEABLE_P(M1,M2)  1
4007
+
4008
+/* TARGET_HARD_REGNO_SCRATCH_OK(REGNO)
4009
+ * This target hook should return true if it is OK to use a hard register
4010
+ * REGNO has a scratch register in peephole2.  One common use of this macro is
4011
+ * to prevent using of a register that is not saved by a prologue in an
4012
+ * interrupt handler.  The default version of this hook always returns true.
4013
+ *
4014
+ * ZipCPU --- the default works for us as well.  If you are in an interrupt
4015
+ * context, you have an entirely new set of registers (the supervisor set), so
4016
+ * this is a non-issue.
4017
+ */
4018
+
4019
+/* AVOID_CCMODE_COPIES ... define this macro if the compiler should avoid
4020
+ * copies to/from CCmode register(s).  You should only define this macro if
4021
+ * support for copying to/from CCmode is incomplete.
4022
+ *
4023
+ * ZipCPU --- CCmode register copies work like any other, so we'll keep with the
4024
+ * default definition.
4025
+ */
4026
+
4027
+/* STACK_REGS ... Define this if the machine has any stack-like registers.
4028
+ *
4029
+ * Zip CPU has no stack-like registers, as their definition is different from
4030
+ * the ZipCPU stack pointer register.
4031
+ */
4032
+
4033 127 dgisselq
+// #define     ZIP_REG_BYTE_SIZE       1
4034 102 dgisselq
+
4035
+/* 17.08 Register Classes */
4036
+
4037
+/* enum reg_class ... An enumerate type that must be defined with all the
4038
+ * register class names as enumerated values.  NO_REGS must be first.  ALL_REGS
4039
+ * must be the last register class, followed by one more enumerated value,
4040
+ * LIM_REG_CLASSES, which is not a register class but rather tells how many
4041
+ * classes there are.
4042
+ *
4043
+ * ZipCPU --- We'll defined register 0-13 as general registers, 14-15 in
4044
+ * all_regs, and go from there.
4045
+ */
4046
+enum   reg_class {
4047
+       NO_REGS, GENERAL_REGS,
4048
+       USER_REGS,
4049
+       ALL_REGS, LIM_REG_CLASSES
4050
+};
4051
+
4052
+/* N_REG_CLASSES ... the number of distinct register classes, defined as follows
4053
+ */
4054
+#define        N_REG_CLASSES   (int)LIM_REG_CLASSES
4055
+
4056
+/* REG_CLASS_NAMES ... An initializer containing the names of the register
4057
+ * classes as C string constants.  These names are used in writing some of the
4058
+ * debugging dumps.
4059
+ */
4060 171 dgisselq
+#define        REG_CLASS_NAMES { "NO_REGS", "GENERAL_REGS", "USER_REGS", "ALL_REGS" }
4061 102 dgisselq
+
4062
+/* REG_CLASS_CONTENTS ... An initializer containing the contents of the register
4063 127 dgisselq
+ * classes, as integers which are bit masks.  The nth integer specifies the
4064 102 dgisselq
+ * contents of class n.  That way the integer mask is interpreted as that
4065
+ * register r is in the class if (mask&(1<<r)) is 1.
4066
+ *
4067 171 dgisselq
+ * When the machine has more than 32 registers, an integer does not suffice.
4068
+ * Then the integers are replaced by sub-initializers, braced groupings
4069
+ * containing several integers.  Each sub-initializer must be suitable as an
4070
+ * initializer for the type HARD_REG_SET which is defined in 'hard-reg-set.h'.
4071
+ * In this situation, the first integer in each subinitializer corresponds to
4072
+ * registers 0-31, the second integer to registers 32-634, and so on.
4073 102 dgisselq
+ *
4074
+ * ZipCPU --- This is straight forward, three register classes, etc.
4075
+ */
4076 171 dgisselq
+#define        REG_CLASS_CONTENTS { { 0x000000000, 0}, {0x00003fff, 0}, {0x0ffff0000, 0}, {0x0ffffffff, 1} }
4077 102 dgisselq
+
4078
+/* REGNO_REG_CLASS ... A C expression whose value is a register class
4079
+ * containing hard register REGNO.  In general there is more than one such
4080
+ * class;  Choose a class which is minimal, meaning that no smaller class also
4081
+ * contains the register.
4082
+ */
4083 171 dgisselq
+#define        REGNO_REG_CLASS(R)      (is_ZIP_REG(R)?(((R)<=13)?GENERAL_REGS:ALL_REGS):NO_REGS)
4084 102 dgisselq
+
4085
+/* BASE_REG_CLASS ... A macro whose definition is the name of the class to which
4086
+ * a valid base register must belong.  A base register is one used in an address
4087
+ * which is the register value plus a displacement.
4088
+ */
4089
+#undef BASE_REG_CLASS
4090
+#define        BASE_REG_CLASS  GENERAL_REGS
4091
+
4092
+/* MODE_BASE_CLASS(MODE) ... This is a variation of the BASE_REG_CLASS macro
4093
+ * which allows the selection of a bse register in a mode dependent manner.  If
4094
+ * mode is VOIDmode then it should return the same value as BASE_REG_CLASS.
4095
+ */
4096
+#undef MODE_BASE_CLASS
4097
+#define        MODE_BASE_CLASS(MODE)   GENERAL_REGS
4098
+
4099
+/* MODE_BASE_REG_REG_CLASS(MODE) ... A C expression whose value is the register
4100
+ * class to which a valid base register must belong in order to be used in a
4101
+ * base plus index register address.  You should define this macro if base plus
4102
+ * index addresses have different requirements than other base register uses.
4103
+ *
4104
+ * Zip CPU does not support the base plus index addressing mode, thus ...
4105
+ */
4106 111 dgisselq
+// #undef      MODE_BASE_REG_REG_CLASS
4107
+// #define     MODE_BASE_REG_REG_CLASS(MODE)   NO_REGS
4108 102 dgisselq
+
4109
+/* INDEX_REG_CLASS ... A macro whose definition is the name of the class to
4110
+ * which a valid index register must belong.  An index register is one used in
4111
+ * an address where its value is either multiplied by a scale factor or added
4112
+ * to another register (as well as added to a displacement).
4113
+ *
4114
+ * ZipCPU -- Has no index registers.
4115
+ */
4116
+#undef INDEX_REG_CLASS
4117
+#define        INDEX_REG_CLASS NO_REGS
4118
+
4119
+/* REGNO_OK_FOR_BASE_P(NUM) ... A C expression which is nonzero if register
4120
+ * number num is suitable for use as a base register in operand addresses.
4121
+ */
4122
+#undef REGNO_OK_FOR_BASE_P
4123 127 dgisselq
+# define REGNO_OK_FOR_BASE_P(NUM)      ((NUM>=FIRST_PSEUDO_REGISTER)||(NUM != zip_CC))
4124 102 dgisselq
+
4125
+/* REGNO_MODE_OK_FOR_BASE_P ... A C expressison that is just like
4126
+ * REGNO_OK_FOR_BASE_P, except that that expression may examine the mode of the
4127 111 dgisselq
+ * memory reference in MODE.  You should define this macro if the mode of the
4128 102 dgisselq
+ * memory reference affects whether a register may be used as a base register.
4129
+ *
4130
+ * ZipCPU --- the mode doesn't affect anything, so we don't define this.
4131
+ */
4132
+
4133
+/* REGNO_MODE_OK_FOR_REG_BASE_P(NUM, MODE) ... base plus index operand
4134
+ * addresses, accessing memory in mode mode.
4135
+ *
4136
+ * Use of this macro is deprecated.
4137
+ */
4138
+
4139 111 dgisselq
+/* REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) ... A C expression which is
4140 102 dgisselq
+ * nonzero if a register number N is suitable for use as a base register in
4141
+ * operand addresses, accessing memory in mode M in address space AS.  This is
4142
+ * similar to REGNO_MODE_OK_FOR_BASE_P, except that the expression may examine
4143
+ * the context in which the register appears in the memory reference.
4144
+ *
4145
+ * ZipCPU---We aren't specific in how we use our registers.
4146
+ */
4147
+#define        REGNO_MODE_CODE_OK_FOR_BASE_P(N,M,AS,OC,IC) REGNO_OK_FOR_BASE_P(N)
4148
+
4149
+/* REGNO_OK_FOR_INDEX_P(REGNO) ... A C expression which is nonzero if register
4150
+ * num is suitable for use as an index register in opernad addressess.  It may
4151
+ * be either a suitable hard register or a pseudo register that has been
4152 111 dgisselq
+ * allocated such as a hard register.
4153 102 dgisselq
+ *
4154
+ * ZipCPU has no index registers, therefore we declare this to be zero.
4155
+ */
4156
+#undef REGNO_OK_FOR_INDEX_P
4157
+#define        REGNO_OK_FOR_INDEX_P(REGNO)     0
4158
+
4159
+/* TARGET_PREFERRED_RENAME_CLASS(RCLASS) ... A target hook that places
4160
+ * additional preference on the register class to use when it is necessary to
4161
+ * rename a register in class RCLASS to another class, or perhaps NO_REGS, if no
4162
+ * preferred register class is found or hook preferred_rename_class is not
4163
+ * implemented.  SOmething returning a more restrictive class makes better code.
4164
+ * For example, on ARM, thumb-2 instructions using LO_REGS may be smaller than
4165
+ * instructions using GENERIC_REGS.  By returning LO_REGS from
4166
+ * preferred_rename_class, code size can be reduced.
4167
+ */
4168
+// #undef TARGET_PREFERRED_RENAME_CLASS
4169
+// #define     TARGET_PREFERRED_RENAME_CLASS(RCLASS)   RCLASS
4170
+
4171
+/* TARGET_PREFERRED_RELOAD_CLASS(X,RC) ... A target hook that places additional
4172
+ * restri tions on the register class to use when it is necessary to copy value
4173
+ * X into a register in class RC.  The value is a register class; rehaps RC, or
4174
+ * perhaps a smaller class.
4175
+ *
4176
+ * The default fversion of this hook always returns value of RC argument, which
4177
+ * sounds quite appropriate for the ZipCPU.
4178
+ */
4179
+
4180
+/* PREFERRED_RELOAD_CLASS(X,CLASS) ... A C expression that places additional
4181
+ * restrictions on the register class to use when it is necessary to copy
4182
+ * value X into a register in class CLASS.  On many machines, the following
4183
+ * definition is safe: PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
4184
+ * Sometimes returning a more restrictive class makes better code.  For example,
4185
+ * on the 68k, when x is an integer constant that is in range for a moveq
4186
+ * instruction, the value of this macro is always DATA_REGS as long as CLASS
4187 111 dgisselq
+ * includes the data registers.  Requiring a data register guarantees that a
4188 102 dgisselq
+ * 'moveq' will be used.
4189
+ *
4190
+ * ZipCPU --- you can't load certain values into all members of ALL_REGS.  For
4191
+ * example, loading (sleep and !gie) into the CC register could halt the CPU.
4192
+ * Hence, we only allow loads into the GENERAL_REG class.
4193
+ */
4194
+#define        PREFERRED_RELOAD_CLASS(X, CLASS)        GENERAL_REGS
4195
+
4196
+/* TARGET_PREFERRED_OUTPUT_RELOAD_CLASS(RTX,RCLASS) ... Like TARGET_PREFERRED_..
4197
+ * RELOAD_CLASS, but for output instead of input reloads.
4198
+ *
4199
+ * ZipCPU --- there's gotta be a valid default behaviour for this.
4200
+ */
4201
+
4202
+/* LIMIT_RELOAD_CLASS(MODE, CL) ...
4203
+ *
4204
+ * Don't define this macro unless the target machine has limitations which
4205
+ * require the macro to do something nontrivial.  ZipCPU doesn't, so we won't.
4206
+ */
4207
+
4208
+/* TARGET_SECONDARY_RELOAD
4209
+ * SECONDARY_ ...
4210
+ * Don't think we need these ...
4211
+ */
4212
+
4213
+/* CLASS_MAX_NREGS(CLASS,MODE) ... A C expression for the maximum number of
4214
+ * consecutive registers of class CLASS needed to hold a value of mode MODE.
4215
+ *
4216
+ * This is closely related to the macro HARD_REGNO_NREGS.  In fact, the value
4217
+ * of the macro CLASS_MAX_REGS(CL,M) should be the maximum value of
4218
+ * HARD_REGNO_NREGS(REGNO,MODE) for all REGNO values in the class CLASS.
4219
+ *
4220
+ * This macro helps control the handling of multiple word values in the reload
4221
+ * pass.
4222
+ *
4223
+ * ZipCPU --- We'll just use HARDNO_REGNO_NREGS, since CLASS is independent for
4224
+ * us.  We'll also choose register R0, since ... well, since it simply doesn't
4225
+ * matter.  (HARD_REGNO_NREGS ignores this anyway)
4226
+ */
4227
+#define        CLASS_MAX_NREGS(CLASS, MODE)    HARD_REGNO_NREGS(0,MODE)
4228
+
4229
+/* CANNOT_CHANGE_MODE_CLASS
4230
+ * ???
4231
+ */
4232
+
4233
+/* TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
4234
+ */
4235
+
4236
+/* TARRGET_LRA_P
4237
+ * Default looks good.
4238
+ */
4239
+
4240
+/* TARGET_REGISTER_PRIORITY(INT) ... A target hook which returns the register
4241 111 dgisselq
+ * priority number to which the register HARD_REGNO belongs to.  The bigger the
4242 102 dgisselq
+ * number
4243
+ *
4244
+ * The default version of this target hook returns always zero---good enough for
4245
+ * the ZipCPU.
4246
+ */
4247
+
4248
+/* TARGET_REGISTER_USAGE_LEVELING_P(VOID) ... A target hook which returns true
4249
+ * if we need register usage leveling.  That means if a few hard registers are
4250
+ * equally good for the assignment, we choose the least used hard register.  The
4251
+ * register usage leveling may be profitable for some targets.  Don't use usage
4252
+ * leveling for targets with conditional execution or targets with big register
4253
+ * files as it hurts if-conversion and cross-jumping optimizations.  The default
4254
+ * version of this target hook returns always false.
4255
+ *
4256
+ * ZipCPU --- Default is the right answer.
4257
+ */
4258
+
4259
+/* TARGET_DIFFERENT_ADDR_DISPLACEMENT_P ...
4260
+ * Default looks good.
4261
+ */
4262
+
4263
+/* TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P ...
4264
+ * Default looks good.
4265
+ */
4266
+
4267
+/* TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT ....
4268
+ */
4269
+
4270
+/* TARGET_SPILL_CLASS
4271
+ *
4272
+ * ZipCPU --- If we were running in supervisor mode only, this might be the
4273
+ * user set of registers.  However, we're not building for that mode (now),
4274
+ * so we'll leave this at the default of NO_REGS.
4275
+ */
4276
+
4277
+/* TARGET_CSTORE_MODE(ICODE) ... Defines the machine mode to use for the
4278
+ * boolean result of conditional store patterns.  The OCIDE argument is the
4279
+ * instruction code for the cstore being performed.  Not defining this hook is
4280
+ * the same as accepting the mode encoded into operand 0 of the cstore expander
4281
+ * patterns.
4282
+ *
4283
+ * ??? ZipCPU --- I don't follow this documentation.  We'll leave this at the
4284
+ * default therefore.
4285
+ */
4286
+
4287
+/* 17.09 Stack Layout and Calling Conventions */
4288
+
4289
+
4290
+/* STACK_GROWS_DOWNWARD ... Define this macro if pushing a word onto the stack
4291
+ * moves the stack pointer to a smaller address, and false otherwise.
4292
+ *
4293
+ * ZipCPU ... well, our stack does grow downward, but it doesn't do so auto-
4294
+ * magically.  We have to move the stack pointer ourselves.  However, since this
4295
+ * is our convention, we'll define it as such.
4296
+ */
4297
+#undef STACK_GROWS_DOWNWARD
4298
+#define        STACK_GROWS_DOWNWARD    1
4299
+
4300
+/* STACK_PUSH_CODE ... This macro defines the operation used when something is
4301
+ * pushed on the stack.  In RTL, a push operation will be
4302
+ * (set (mem( STACK_PUSH_CODE(reg sp))) ...) The choiecs are PRE_DEC, POST_DEC,
4303
+ * PRE_INC, and POST_INC.  Which of these is correct depends on the stack
4304
+ * direction and on whether the stack pointer points to the last item on the
4305
+ * stack or whether it points to the space for the next item on the stack.
4306
+ * The default is PRE_DECC when STACK_GROWS_DOWNWARD is true, which is almost
4307
+ * always right, and PRE_INC otherwise, which is often wrong.
4308
+ *
4309
+ * ZipCPU --- None of these is right, so let's leave this at the default and
4310
+ * see how badly we get mangled.  In particular, ZipCPU doesn't have any of the
4311
+ * PRE_DEC, POST_DEC, PRE_INC, or POST_INC addressing modes used here.
4312
+ */
4313
+
4314
+/* FRAME_GROWS_DOWNWARD ... Define this macro to nonzero if the addresses of
4315
+ * local variable slots are at negative offsets from the frame pointer.
4316
+ *
4317
+ * ZipCPU --- If the frame pointer is defined as the stack pointer upon the
4318 103 dgisselq
+ * start of function execution, and that stack pointer grows downward, then
4319 102 dgisselq
+ * this should be the case as well.
4320
+ */
4321
+#undef FRAME_GROWS_DOWNWARD
4322
+#define        FRAME_GROWS_DOWNWARD    1
4323
+// #define     FRAME_GROWS_DOWNWARD    0        // This was ECO32's value
4324
+
4325
+
4326
+/* ARGS_GROW_DOWNWARD ... Define this macro if successive arguments to a
4327
+ * function occupy decreasing addresses on the stack.
4328
+ *
4329
+ * ZipCPU -- we can leave this up to the compiler's preferred implementation,
4330
+ * it is of no consequence to the hardware.
4331
+ */
4332
+
4333
+/* STARTING_FRAME_OFFSET ... Offset from the frame pointer to the first local
4334
+ * variable slot to be allocated.  If FRAME_GROWS_DOWNWARD, find the next slot's
4335 171 dgisselq
+ * offset by subtracting the first slot's length from STARTING_FRAME_OFFSET.
4336 102 dgisselq
+ * Otherwise it is found by adding the length of the first slot to the value
4337
+ * START_FRAME_OFFSET.
4338
+ *
4339
+ * ZipCPU --- I'm not certain on this, let's come back after we look at how
4340
+ * the code is getting generated.  However, the ECO32 code I am copying from
4341
+ * suggests that 0 is the right value, so we'll use that here.
4342
+ */
4343 171 dgisselq
+// #warning "Re-evaluate me" --- I did.  This still looks good.
4344 102 dgisselq
+#define        STARTING_FRAME_OFFSET   0
4345
+
4346
+/* STACK_ALIGNMENT_NEEDED ... Define to zero to disable final alignment of the
4347
+ * stack during reload.  The nonzero default for this macro is suitable for most
4348
+ * ports.
4349
+ *
4350
+ * ZipCPU --- we'll leave this at the default, although if any alignment code
4351
+ * shows up on the stack we may need to adjust it.
4352
+ */
4353
+
4354
+/* STACK_POINTER_OFFSET ... Offset from the SP register to the first location at
4355
+ * which outgoing arguments are placed.  If not specified, the default value
4356
+ * of zero is used.  This is the proper value for most machines.
4357
+ */
4358
+#define        STACK_POINTER_OFFSET    0
4359
+
4360
+/* FIRST_PARM_OFFSET ... Offset from the argument pointer register to the first
4361
+ * argument's address.  On some machines it may depend on the data type of the
4362 171 dgisselq
+ * function.
4363 102 dgisselq
+ */
4364
+#define        FIRST_PARM_OFFSET(F)    0
4365
+
4366
+/* STACK_DYNAMIC_OFFSET(F) ... Offset from the stack pointer register to an item
4367
+ * dynamically allocated on the stack, e.g., by alloca.  The default value for
4368
+ * this macro is STACK_POINTER_OFFSET plus the length of the outgoing arguments.
4369
+ * The default is correct for most machines, ...
4370
+ *
4371
+ * ZipCPU --- so we'll use it for the ZipCPU.
4372
+ */
4373
+
4374
+/* INITIAL_FRAME_ADDRESS_RTX ... A C expression whose value is RTL representing
4375
+ * the address of the initial stack frame.  This address is passed to
4376
+ * RETURN_ADDR_RTX and DYNAMIC_CHAIN_ADDRESS.  If you don't define this macro,
4377
+ * a reasonable default value will be used.  Define this macro in order to make
4378
+ * frame pointer elimination work in the presence of __builtin_frame_address(C)
4379
+ * and __builtin_return_address(C) for (C) not equal to zero.
4380
+ *
4381
+ * ZipCPU --- Let's try the reasonable default and see what happens.
4382
+ */
4383
+
4384
+/* SETUP_FRAME_ADDRESSES ... A C expression that produces the machine-specific
4385
+ * code to setup the stack so that arbitrary frames can be accessed.  For
4386
+ * example, on the SPARC, we must flush all of the register windows to the stack
4387
+ * before we can access arbitrary stack frames.  You will seldom need to define
4388
+ * this macro.  The default is to do nothing.
4389
+ *
4390
+ * ZipCPU --- which is what we shall do here.
4391
+ */
4392
+
4393
+/* TARGET_BUILTIN_SETJMP_FRAME_VALUE(VOID) ... This target hook should return
4394
+ * an RTX that is used to store the address of the current frame into the
4395
+ * builtin setjmp buffer.  The default value, virtual_stack_vars_rtx, is correct
4396
+ * for most machines.  One reason you may need to define this target hook is if
4397
+ * hard_frame_pointer_rtx is the appropriate value on your machine.
4398
+ *
4399
+ * ZipCPU --- leave this undefined, since the default value should be correct
4400
+ * for "most" machines.
4401
+ */
4402
+
4403
+/* FRAME_ADDR_RTX ... most machines do not need to define it.
4404
+ */
4405
+
4406
+/* RETURN_ADDR_RTX(COUNT,FRAMEADDR) ... A C expression whose value is RTL
4407
+ * representing the value of the return address for the frame COUNT steps up
4408
+ * from the current frame, after the prologue.  FRAMEADDR is the frame pointer
4409
+ * of the COUNT frame, or the frame pointer of the COUNT-1 frame if
4410
+ * RETURN_ADDR_IN_PREVIOUS_FRAME is nonzero.  The value of the expression must
4411
+ * always be the correct address when COUNT is nonzero, but may be NULL_RTX if
4412
+ * there is no way to determine the return address of other frames.
4413
+ *
4414
+ * ZipCPU --- I have no idea how we'd do this, so let's just return NULL_RTX.
4415
+ */
4416
+#undef RETURN_ADDR_RTX
4417
+#define        RETURN_ADDR_RTX(COUNT,FRAMEADDR)        NULL_RTX
4418
+
4419
+/* RETURN_ADDR_IN_PREVIOUS_FRAME ... Define this macro to nonzero value if the
4420
+ * return address of a particular stack frame is accessed from the frame pointer
4421
+ * of the previous stack frame.  The zero default for this macro is suitable
4422
+ * for most ports.
4423
+ *
4424
+ * ZipCPU---Default works here as well.
4425
+ */
4426
+
4427
+/* INCOMING_RETURN_ADDR_RTX ... A C expression whose value is RTL representing
4428
+ * the location of the incoming return address at the beginning of any function,
4429
+ * before the prologue.  This RTL is either a REG, indicating that the return
4430
+ * value is saved in 'REG', or a MEM representing the location in the stack.
4431
+ * If this RTL is a REG, you should define DWARF_RETURN_COLUMN to
4432
+ * DWARF_FRAME_REGNUM(REGNO).
4433
+ *
4434
+ * ZipCPU --- While our incoming return address could theoretically be in any
4435
+ * register, our machine description file is going to place it into register
4436
+ * R0, so that's what we return here.
4437
+ */
4438
+#undef INCOMING_RETURN_ADDR_RTX
4439
+#define        INCOMING_RETURN_ADDR_RTX        gen_rtx_REG(SImode, zip_R0)
4440
+
4441
+
4442
+/* DWARF_ALT_FRAME_RETURN_COLUMN
4443
+ */
4444
+
4445
+/* DWARF_ZERO_REG ... A C exrpession whose value is an integer giving a DWARF2
4446
+ * register number that is considered to always have the value zero.  This
4447
+ * should only be defined if the target has an architected zero register (ZipCPU
4448
+ * does not), and someone decided it was a good idea to use that register number
4449
+ * to terminate the stack backtrace.  New ports should avoid this (so the
4450
+ * ZipCPU port will avoid it as well).
4451
+ *
4452
+ */
4453
+
4454
+/* TARGET_DWARF_HANDLE_FRAME_UNSPEC
4455
+ */
4456
+
4457 171 dgisselq
+/* INCOMING_FRAME_SP_OFFSET ... A C expression whose value is an integer giving
4458
+ * the offset, in bytes, from the value of the stack pointer register to the
4459
+ * top of the stack frame at the beginning of any function, before the prologue.
4460
+ * The top of the frame is defined to be the value of the stack pointer in the
4461
+ * previous frame, just before the call instruction.
4462
+ *
4463
+ * You only need to define this macro if you want to support call frame
4464
+ * debugging information like that provided by DWARF 2.
4465
+ *
4466
+ * ZipCPU---Our value is zero.
4467 102 dgisselq
+ */
4468
+#define        INCOMING_FRAME_SP_OFFSET        0
4469
+
4470
+/* ARG_POINTER_CFA_OFFSET
4471
+ */
4472
+
4473
+/* FRAME_POINTER_CFA_OFFSET
4474
+ */
4475
+
4476
+/* CFA_FRAME_BASE_OFFSET
4477
+ */
4478
+
4479
+/* 17.09.02 Exception handling support */
4480
+
4481
+/* EH_RETURN_DATA_REGNO(N) ... A C expression whose value is the Nth register
4482
+ * number used for data by exception handlers, or INVALID_REGNUM if fewer than
4483
+ * N registers are usable.  The exception handling library routines communicate
4484
+ * with the exception handlers via a set of agreed upon registers.  Ideally
4485
+ * these registers should be call clobbered; it is possible to use call-saved
4486
+ * registers, but may negatively impact code size.  The target must support at
4487
+ * least 2 data registers, but should define 4 if their are enough free
4488
+ * registers.
4489
+ *
4490
+ * You must define this macro if you want to support call frame exception
4491
+ * handling like that provided by DWARF 2.
4492
+ */
4493
+#define        EH_RETURN_DATA_REGNO(N) (((N<ZIP_FIRST_ARG_REGNO)||(N>ZIP_LAST_ARG_REGNO))?(N-1):INVALID_REGNUM)
4494
+
4495
+/* EH_RETURN_STACKADJ_RTX ... A C expression whose value is RTL representing
4496
+ * a location in which to store a stack adjustment to be applied before function
4497
+ * return.  This is used to unwind the stack to an exception handler's call
4498
+ * frame.  It will be assigned zero on code paths that return normally.
4499
+ *
4500
+ * Do not define this macro if the stack pointer is saved and restored by the
4501
+ * regular prolog and epilog code in the call frame itself (which it is for the
4502
+ * ZipCPU); in this case, the exception handling library routines will update
4503
+ * the stack location to be restored in place.  Otherwise, you must define this
4504
+ * macro if you want to support call frame exception handling like that provided
4505
+ * by DWARF 2.
4506
+ *
4507
+ */
4508
+
4509
+/* EH_RETURN_HANDLER_RTX ... A C expression whose value is RTL representing a
4510
+ * location in which to store the address of an exception handler to which we
4511
+ * should return.  It will not be assigned on code paths that return normally.
4512
+ *
4513
+ * Typcally this is the location in the call frame at which the normal return
4514
+ * address is stored.  For targets that return by popping an address of the
4515
+ * stack, this might be a memory address just below the target callf rame
4516
+ * rather than inside the current call frame.  If defined,
4517
+ * EH_RETURN_STACKADJ_RTX will have already been assigned, so it may be used
4518
+ * to calculate the location of the target call frame.
4519
+ *
4520
+ * If you want to support call frame exception handling, you must define either
4521
+ * this macro or the eh_return instruction pattern.
4522
+ */
4523
+// #warning "I don't know what to do here."
4524
+
4525
+/*
4526
+ *
4527
+ *
4528
+ *
4529
+ *   REST OF SECTION SKIPPED ...
4530
+ *
4531
+ *
4532
+ *
4533
+ */
4534
+
4535
+/* 17.09.03 Specifying how stack checking is done */
4536
+
4537
+/* STACK_CHECK_BUILTIN ... a non-zero value if stack checking is done by the
4538
+ * configuration files in a machine-dependent manner.  You should define this
4539
+ * macro if stack checking is required by the ABI of your machine or if you
4540
+ * would like to do stack checking in some more efficient way than the generic
4541
+ * appraoch.  The default value of this macro is zero.
4542
+ *
4543
+ * ZipCPU --- The default makes sense for us.
4544
+ */
4545
+// #define STACK_CHECK_BUILTIN 0
4546
+
4547
+/* STACK_CHECK_STATIC_BUILTIN ... A nonzero value if static stack checking is
4548
+ * done by the configuration files in a machine-dependent manner.  You should
4549
+ * define this macro if you would like to do static stack checking in some more
4550
+ * efficient way than the generic approach.  The default value of this macro
4551
+ * is zero.
4552
+ *
4553
+ * ZipCPU --- The default makes sense for us.
4554
+ */
4555
+
4556
+/* STACK_CHECK_PROBE_INTERVAL_EXP ...  An integer specifying the interval at
4557
+ * which GCC must generate stack probe instructions, defined as 2 raised to this
4558
+ * interval.  You will normally define this macro so that the interval is no
4559
+ * larger than the size of the "guard pages" at the end of a stack area.  The
4560
+ * default value of 12 (4096-byte interval) is suitable for most systems.
4561
+ *
4562
+ * ZipCPU --- Default.
4563
+ */
4564
+
4565
+/* STACK_CHECK_MOVING_SP ... An integer which is non-zero if GCC should move
4566
+ * the stack pointer page by page when doing probes.  This can be necessary
4567
+ * on systems where the stack pointer contains the bottom address of the memory
4568
+ * area accessible to the executing thread at any point in time.  In this
4569
+ * situation, an alternate signal stack is required in order to be able to
4570
+ * recover from a stack overflow.  The default value of this macro is zero.
4571
+ *
4572
+ * ZipCPU -- Default.
4573
+ */
4574
+
4575
+/* STACK_CHECK_PROTECT
4576
+ */
4577
+/* STACK_CHECK_MAX_FRAME_SIZE
4578
+ * ... you should normally not change the default value of this macro.
4579
+ */
4580
+/* STACK_CHECK_FIXED_FRAME_SIZE
4581
+ * ... you ... will normally use the default of four words.
4582
+ */
4583
+
4584
+/* STACK_CHECK_MAX_VAR_SIZE
4585
+ * ... you will normally not need to override that default.
4586
+ */
4587
+
4588
+/* 17.09.04 Registers that Address the Stack Frame*/
4589
+
4590
+/* STACK_POINTER_REGNUM ... The register number of the stack pointer register,
4591
+ * which must also be a fixed register according to FIXED_REGISTERS.  On most
4592
+ * machines, the hardware determines which register this is.
4593
+ */
4594
+#undef STACK_POINTER_REGNUM
4595
+#define        STACK_POINTER_REGNUM    zip_SP
4596
+
4597
+/* FRAME_POINTER_REGNUM ... The register number of the frame pointer register,
4598
+ * which is used to access certain automatic variables in the stack frame.  On
4599
+ * some machines, the hardware determines which register this is.  On other
4600
+ * machines you can choose any register you wish for this purpose.
4601
+ *
4602
+ * ZipCPU --- While I'd like to dump this pointer, since I don't really see
4603
+ * a need for it, alloca() requires it.  Therefore let's assine a register to
4604
+ * this purpose and watch what the compiler does with it.
4605
+ */
4606
+#define        FRAME_POINTER_REGNUM    zip_FP
4607
+
4608
+/* HARD_FRAME_POINTER_REGNUM ... On some machines the offset between the frame
4609
+ * pointer and starting offset of the automatic variables is not known until
4610
+ * after register allocation has been done (for example, because the saved
4611
+ * registers are between these two locations).  On those machines, define
4612
+ * FRAME_POINTER_REGNUM the number of a special, fixed register to be used
4613
+ * internally until the offset is known, and define HARD_FRAME_POINTER_REGNUM
4614
+ * to be the actual hard register number used for the frame pointer.
4615
+ *
4616
+ * Do not define this macro if it would be the same as FRAME_POINTER_REGNUM
4617
+ *
4618
+ * ZipCPU --- we do not define this macro.
4619
+ */
4620 103 dgisselq
+#define HARD_FRAME_POINTER_REGNUM      zip_FP
4621 102 dgisselq
+
4622
+/* ARG_POINTER_REGNUM ... The register number of the arg pointer register, which
4623
+ * is used to access the function's argument list.  On some machines, this is
4624
+ * the same as the frame pointer register.  On some machines, the hardware
4625
+ * determines which register this is.  On other machines, you can choose any
4626
+ * register you wish for this purpose.  If this is not the same register as the
4627
+ * frame pointer register, then you must mark it as a fixed register according
4628
+ * to FIXED_REGISTERs, or arrange to be able to eliminate it.
4629
+ *
4630
+ * ZipCPU --- We really don't want to lose another register to something
4631
+ * pointless, so let's set this to be the frame pointer register.  Especially
4632
+ * given the ZipCPU's ease of accessing things via offsets of registers, this
4633
+ * should work for a rather large stack frame.
4634 171 dgisselq
+ *
4635
+ * However ... we had problems with passing 6+ variables on the stack, so let's
4636
+ * try creating a pseudo register for this, and appropriately adjusting the
4637
+ * offset between this pseudo register and the stack pointer ...
4638 102 dgisselq
+ */
4639 171 dgisselq
+#define        ARG_POINTER_REGNUM      zip_AP_PSEUDO
4640 102 dgisselq
+
4641
+/* HARD_FRAME_POINTER_IS_FRAME_POINTER ... define this to be a preprocessor
4642
+ * constant that is nonzero if hard_frame_pointer_rtx and frame_pointer_rtx
4643
+ * should be the same.  The default definition is sufficient for us.
4644
+ */
4645
+
4646
+/* HARD_FRAME_POINTER_IS_ARG_POINTER ...
4647
+ * ZipCPU doesn't need this macro
4648
+ */
4649
+
4650
+/* RETURN_ADDRESS_POINTER_REGNUM ... The register number of the return address
4651
+ * pointer register, which is used to access the current function's return
4652
+ * address from the stack.  On some machines, the return address is not at a
4653
+ * fixed offset from the frame pointer or stack pointer or argument pointer.
4654
+ * This register can be defined to point to the return address on the stack, and
4655
+ * then to be converted by ELIMINABLE_REGS into either the frame pointer or the
4656
+ * stack pointer.
4657
+ *
4658
+ * Do not define this macro unless there is no other way to get the return
4659
+ * address from the stack.
4660
+ *
4661
+ * ZipCPU---we need this.
4662
+ */
4663
+#define        RETURN_ADDRESS_REGNUM   zip_R0
4664
+
4665
+
4666
+/* STATIC_CHAIN_REGNUM ... Register numbers used for passing a function's
4667
+ * static chain pointer.  If register windows are used, the register number as
4668
+ * seen by the called function is STATIC_CHAIN_INCOMING_REGNUM, while the
4669
+ * register number as seen by the calling function is STATIC_CHAIN_REGNUM.  If
4670
+ * these register are the same, STATIC_CHAIN_INCOMING_REGNUM need not be
4671
+ * defined.
4672
+ *
4673
+ * ZipCPU doesn't have register windows, so we don't need to define this.
4674
+ */
4675
+// #warning "I have no reason to believe this will even work"
4676
+#define        STATIC_CHAIN_REGNUM     zip_GOT
4677
+
4678
+/* TARGET_STATIC_CHAIN ... This hook replaces the use of STATIC_CHAIN_REGNUM et
4679
+ * al for targets that may use different static chain locations for different
4680
+ * nested functions.  This may be required if the target has function attributes
4681
+ * that affect the calling conventions of the function and those calling
4682
+ * conventions use different static chain locations.
4683
+ *
4684
+ * ZipCPU --- don't need this.
4685
+ */
4686
+// #define     STATIC_CHAIN_REGNUM     zip_R11
4687
+
4688
+
4689
+/* DWARF_FRAME_REGISTERS ... This macro specifies  the maximum number of hard
4690
+ * registers that can be saved in a call frame.  This is used to size data
4691
+ * structures used in DWARF2 exception handling.
4692
+ *
4693
+ * Prior to GCC 3.0, this macro was needed in order to establish a stable
4694
+ * exception handling ABI in the face of adding new hard registers for ISA
4695
+ * extensions.  In GCC 3.0 and later, the EH ABI is insulated from changes in
4696
+ * the number of hard registers.  Nevertheless, this macro can still be used to
4697
+ * reduce the runtime memory requirements of the exception handling routines,
4698
+ * which can be substantial if the ISA contains a lot of registers that are not
4699
+ * call-saved.
4700
+ *
4701
+ * If this macro is not defined, it defaults to FIRST_PSEUDO_REGISTER.
4702
+ *
4703
+ * ZipCPU --- The default is not sufficient.  The CC and PC registers need to
4704
+ * be saved and examined as well in any debug/exception context.  Hence, we
4705
+ * define this to be all of our registers.
4706
+ */
4707
+#undef DWARF_FRAME_REGISTERS
4708
+#define        DWARF_FRAME_REGISTERS   16
4709
+
4710
+/* PRE_GCC3_DWARF_FRAME_REGISTERS ... This macro is similar to DWARF_FRAME_REG..
4711
+ * but is provided for backward compatibility in pre GCC 3.0 compiled code.
4712
+ *
4713
+ * If not defined, it defaults to DWARF_FRAME_REGISTERS---which is perfect for
4714
+ * the ZipCPU.
4715
+ */
4716
+
4717
+/* DWARF_REG_TO_UNWIND_COLUMN(REGNO) ... Define this macro if the target's
4718
+ * representation for dwarf registers is different than the internal
4719
+ * representation for unwind column.  Given a dwarf register, this macro should
4720
+ * return the unwind column number to use instead.
4721
+ *
4722
+ * ... ???
4723
+ */
4724
+
4725
+/* DWARF_FRAME_REGNUM(REGNO) ... Define this macro is the target's
4726
+ * representation for dwarf registers used in .eh_frame or .debug_frame is
4727
+ * different from that used in other debug info sections.  Given a GCC hard
4728
+ * register number, this macro should return the .eh_frame register number.
4729
+ * The default is DBX_REGISTER_NUMBER(REGNO).
4730
+ *
4731
+ * ZipCPU --- provided we define DBX_REGISTER_NUMBER(REGNO) well, this default
4732
+ * should still work for us.
4733
+ */
4734
+
4735
+/* DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) ... Define this macro to map register
4736
+ * numbers held in the call frame info that GCC has collected using
4737
+ * DWARF_FRAME_REGNO to those that should be output in .debug_frame (for_eh is
4738
+ * zero) and .eh_frame (for_eh is non-zero). The default is to return REGNO.
4739
+ *
4740
+ * ZipCPU --- Default is good enough.
4741
+ */
4742
+
4743
+/* REG_VALUE_IN_UNWIND_CONTEXT ... Define this macro if the target stores
4744
+ * register values as _Unwind_Word type in unwind context.  It should be defined
4745
+ * if target register size is larger than the size of void *.  The default
4746
+ * is to store register values as void *type.
4747
+ *
4748
+ * ZipCPU --- Default is what we need.
4749
+ */
4750
+
4751
+/* ASSUME_EXTENDED_UNWIND_CONTEXT ... Define this macro to be 1 if the target
4752
+ * always uses extended unwind context with version, args_size, and by_value
4753
+ * fields.  If it is undefined, it will always be defined to 1 when REG_VALUE_IN_UNWIND_CONTEXT is defined and 0 otherwise.
4754
+ *
4755
+ */
4756
+
4757
+
4758
+/* 17.09.05 Eliminating Frame Pointer and Arg Pointer */
4759
+
4760
+/* TARGET_FRAME_POINTER_REQUIRED(VOID) ... This target hook should return true
4761
+ * if a function must have and use a frame pointer.  This target hook is
4762
+ * called in the reload pass.  If its return value is true, the function will
4763
+ * have a frame pointer.
4764
+ *
4765
+ * This target hook can in principle examine the current function and decide
4766
+ * according to the facts, but on most machines the constant false or the
4767
+ * constant true suffices.  Use false when the machine allows code to be
4768
+ * generated with no frame pointer, and doing so saves some time or space.
4769
+ * Use true when there is no possible advantage to avoiding a frame pointer.
4770
+ *
4771
+ * ZipCPU---if we add in a frame pointer, we become register starved.  Hence,
4772
+ * we'll treat this as a constant false--which is also the default value.
4773
+ */
4774
+#define        target_frame_pointer_required   zip_frame_pointer_required
4775
+
4776
+/* INITIAL_FRAME_POINTER_OFFSET ... A C statement to store in the variable
4777
+ * depth-var the difference between the frame pointer and the stack pointer
4778
+ * values immediately after the function prologue.  The value would be computed
4779
+ * from information such as the result of get_frame_size() and the tables of
4780
+ * registers regs_ever_live and call_used_regs.
4781
+ *
4782
+ * If ELIMINABLE_REGS is defined, this macro will not be used and need not be
4783
+ * defined.  Otherwise, it must be defined even if TARGET_FRAME_POINTER_REQD
4784
+ * always returns true; in that case you may set depth-var to anything.
4785
+ *
4786
+ * ZipCPU --- we intend to set ELIMINABLE_REGS, so this is not necessary.
4787
+ */
4788
+// #define     INITIAL_FRAME_POINTER_OFFSET(DEPTH)     (DEPTH) = 0
4789
+
4790
+
4791
+/* ELIMINABLE_REGS ... If defined, this macro specifies a table of register
4792
+ * pairs used to eliminate unneeded registers that point into the stack frame.
4793
+ * If it is not defined, the only elimination attempted by the compiler is to
4794
+ * replace references to the frame pointer with references to the stack pointer.
4795
+ *
4796
+ * On some machines, the position of the argument pointer is not known until
4797
+ * the compilation is completed.  In such a case, a separate hard register
4798
+ * must be used for the argument pointer.  This register can be eliminated by
4799
+ * replacing it with either the frame pointer or the argument pointer,
4800
+ * depending on whether or not the frame pointer has been eliminated.
4801
+ *
4802
+ * ZipCPU we'll take their suggestion and define this as:
4803
+ */
4804
+#undef ELIMINABLE_REGS
4805
+#define        ELIMINABLE_REGS \
4806
+       {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },  \
4807
+        { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },  \
4808
+        { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
4809
+
4810
+/* bool TARGET_CAN_ELIMINATE(FROM,TO) ... This target function should return
4811
+ * true if the compiler is allowed to try to replace register number FROM with
4812
+ * register number TO.  This target hook need only be defined if ELIMINABLE_REGS
4813
+ * is defined, and will usually return true since most of the cases preventing
4814
+ * register elimination are things that the compiler  already knows about.
4815
+ *
4816
+ * ZipCPU ... does the compiler  know about my decision as to whether or not
4817 117 dgisselq
+ * the frame pointer was needed?  Yes it does, but it's kept separately.  We'll
4818
+ * just say everything can be eliminated.
4819 102 dgisselq
+ */
4820
+#define TARGET_CAN_ELIMINATE   zip_can_eliminate
4821
+
4822
+/* INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) ... This macro is similar to
4823
+ * INITIAL_FRAME_POINTER_OFFSET.  It specifies the initial difference between
4824
+ * the specified pair of registers.  This macro must be defined if
4825
+ * ELIMINABLE_REGS is defined.
4826
+ *
4827 117 dgisselq
+ * ZipCPU---We had at one time set this to a default offset of 0.  This didn't
4828
+ * work.  It turns out that this is not only the *initial* elimination offset,
4829
+ * but also the offset along the way.  Hence, when a variable needs to be
4830
+ * spilled to the stack, this offset must change.  Reload goes and checks for
4831
+ * this, and adjusts registers if the offset has changed.  Hence, without this,
4832
+ * we get negative (i.e. illegal) stack offsets.
4833 102 dgisselq
+ */
4834
+#define        INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)            \
4835
+       do { (OFFSET) = zip_initial_elimination_offset((FROM), (TO)); } \
4836
+       while(0)                                        \
4837
+
4838
+/* 17.09.06 Passing function arguments on the stack */
4839
+
4840
+/* TARGET_PROMOTE_PROTOTYPES ... Returns true if an argument declared in a
4841
+ * prototype as an integral type smaller than int should actually be
4842
+ * passed as an int.  In addition to avoiding errors in certain cases of
4843
+ * mismatch, it also makes for better code on certain machines.  The default is
4844
+ * to not promote prototypes.
4845
+ *
4846
+ * Since everything is an int on the ZipCPU, let's promote anything smaller
4847
+ * (which should still be an int) up to an int anyway.
4848
+ */
4849
+#undef TARGET_PROMOTE_PROTOTYPES
4850
+#define        TARGET_PROMOTE_PROTOTYPES       hook_bool_const_tree_true
4851
+
4852
+/* PUSH_ARGS ... A C expression.  If nonzero, push instructions will be used to
4853
+ * pass outgoing arguments.  If the target machine does not have a push
4854
+ * instruction, set it to zero.  That directs GCC to use an alternate strategy:
4855
+ * to allocate the entire argument block and then store the arguments into it.
4856
+ * When PUSH_ARGS is nonzero, PUSH_ROUNDING must be defined too.
4857
+ *
4858
+ * ZipCPU does not have a push instruction, so we set this to zero.
4859
+ */
4860
+#undef PUSH_ARGS
4861
+#define        PUSH_ARGS       0
4862
+
4863
+/* PUSH_ARGS_REVERSED ... A C expression.  If nonzero, function arguments will
4864
+ * be evaluated last to first, rather than first to last.  If this macro is
4865
+ * not defined, it defaults to PUSH_ARGS on targets where the stack and args
4866
+ * grow in opposite directions, and zero otherwise.
4867
+ *
4868
+ * ZipCPU---Let's evaluate our arguments first to last.
4869
+ */
4870
+#define        PUSH_ARGS_REVERSED      1
4871
+
4872
+/* PUSH_ROUNDING(NPUSHED) ... A C expression that is the number of bytes
4873
+ * actually pushed onto the stack when an instruction attempts to push
4874
+ * (NPUSHED) bytes.
4875
+ *
4876
+ * ZipCPU---We cannot push bytes.  Let's leave this undefined and see what
4877
+ * happens.
4878
+ */
4879
+// #warning "No appropriate definition seemed right."
4880
+
4881
+/* ACCUMULATE_OUTGOING_ARGS ... A C expression.  If non-zero, the maximum amount
4882
+ * of space required for outgoing arguments will be computed and placed into
4883 171 dgisselq
+ * crtl->outgoing_args_size.  No space will be pushed onto the stack for each
4884
+ * call; instead the function prologue should increase the stack frame size by
4885
+ * this amount.
4886 102 dgisselq
+ *
4887
+ * ZipCPU---This is *cool* and so necessary---it saves an extra two instructions
4888
+ * each time we try to call a function/routine.  Yes, we want and *need* this
4889
+ * for good performance.  I mean, think of it, free performance increase?  Who
4890
+ * could argue with that?
4891
+ */
4892
+#undef ACCUMULATE_OUTGOING_ARGS
4893
+#define        ACCUMULATE_OUTGOING_ARGS        1
4894
+
4895
+
4896 191 dgisselq
+/* REG_PARM_STACK_SPACE(FN) ... Define this macro if functions should assume
4897 102 dgisselq
+ * that stack space has been allocated for arguments even when their values
4898
+ * are passed in registers.  The value of this macro is the size, in bytes, of
4899
+ * the area reserved for arguments passed in registers for the function
4900
+ * represented by FN, which can be zero if GCC is calling a library function.
4901
+ * The argument FN can be the FUNCTION_DECL, or the type itself of the function.
4902
+ *
4903
+ * This space can be allocated by the caller, or be part of the machine
4904
+ * dependent stack frame: OUTGOING_REG_PARM_STACK_SPACE says which.
4905
+ *
4906
+ * ZipCPU --- Why allocate space you won't use?  Let's leave this undefined
4907
+ * therefore.
4908
+ */
4909
+// #undef      REG_PARM_STACK_SPACE
4910
+
4911
+
4912
+
4913
+/* INCOMING_REG_PARM_STACK_SPACE(FN) ... Like REG_PARM_STACK_SPACE, but for
4914
+ * incoming register arguments.  Define this macro if space guaranteed when
4915
+ * compiling a function body is different to space required when making a call,
4916
+ * a situation that can arise with K&R style function definitions.
4917
+ *
4918
+ */
4919
+
4920
+/* OUTGOING_REG_PARM_STACK_SPACE(FN) ... Define this to a nonzero value if it
4921
+ * is the responsibility of the caller to allocate the area reserved for
4922
+ * arguments passed in registers when calling a function of FN.  FN may be NULL
4923
+ * if the function called is a library function.
4924
+ *
4925
+ * ZipCPU---Why allocate space you don't need?
4926
+ */
4927
+#define        OUTGOING_REG_PARM_STACK_SPACE(FNTYPE)   0
4928
+
4929
+
4930
+/* STACK_PARMS_IN_REG_PARM_AREA ... Define this macro if REG_PARM_STACK_SPACE
4931
+ * is defined, buyt the stack parameters don't skip the area specified by it.
4932
+ *
4933
+ * ZipCPU---We didn't define REG_PARM_STACK_SPACE, so we won't define this.
4934
+ */
4935
+
4936
+/* TARGET_RETURN_POPS_ARGS(DECL,FNTYPE,SZ) ... This target hook returns the
4937
+ * number of bytes of its own arguments that a function pops on returning, or 0
4938
+ * if the function pops no arguments and the caller must therefore pop them all
4939
+ * after the function returns.
4940
+ *
4941
+ * ZipCPU --- If we define this, we'll lose our gain from
4942
+ * ACCUMULATE_OUTOING_ARGS.  Thus, we leave this undefined.
4943
+ */
4944
+
4945
+/* CALL_POPS_ARGS(CUM) ... A C expression that should indicate the number of
4946
+ * bytes a call sequence pops off of the stack.  It is added to the value of
4947
+ * RETURN_POPS_ARGS when compiling a function call.  CUM is the variable in
4948
+ * which all arguments to the function have been accumulated.
4949
+ *
4950
+ * ZipCPU---The call sequence, by itself, doesn't touch the stack.  Therefore
4951
+ * this is zero.
4952
+ */
4953
+#undef CALL_POPS_ARGS
4954
+#define        CALL_POPS_ARGS(CUM)     0
4955
+
4956
+
4957
+/* 17.09.07 Passing arguments in registers */
4958
+
4959
+/* TARGET_FUNCTION_ARG ... Return an RTX indicating whether a function argument
4960
+ * is passed in a register, and if so, which register.
4961
+ */
4962
+/*
4963
+ * This has been poisoned ... so let's not define it anymore and look for
4964
+ * a better way to do this ...
4965
+ *
4966
+ * #define     FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (((NAMED) == 0) ? NULL_RTX
4967
+ *     : targetm.calls.must_pass_in_stack(MODE, TYPE)  ? NULL_RTX
4968
+ *     : (CUM) > ZIP_LAST_ARG_REGNO                    ? NULL_RTX
4969
+ *     : gen_rtx_REG(MODE, CUM))
4970
+ */
4971
+#define        TARGET_FUNCTION_ARG     zip_function_arg
4972
+
4973
+
4974 171 dgisselq
+/* TARGET_MUST_PASS_IN_STACK(MODE, TYPE) ... This target hook should return
4975
+ * true if we should not pass TYPE solely in registers.  The file 'expr.h'
4976
+ * defines a definition that is usually appropriate, refer to 'expr.h' for
4977
+ * additional documentation.
4978
+ *
4979
+ * ZipCPU ... Ok, so I looked into expr.h and didn't find anything that looked
4980
+ * like this.  So ... I don't know.
4981 102 dgisselq
+ */
4982
+// #undef      TARGET_MUST_PASS_IN_STACK
4983
+// #define     TARGET_MUST_PASS_IN_STACK       zip_must_pass_in_stack
4984
+
4985
+/* TARGET_FUNCTION_INCOMING_ARG ... Define this hook if the target machine
4986
+ * has register windows, ... which ZipCPU does not have.
4987
+ */
4988
+
4989
+/* TARGET_USE_PSEUDO_PIC_REG(void) ... This hook should return 1 in case
4990
+ * pseudo register should be created for pic_offset_table_rtx during function
4991
+ * expand.
4992
+ *
4993
+ * This should be defined by global parameters, isn't it?
4994
+ */
4995
+
4996
+/* TARGET_INIT_PIC_REG(v) ... Perform a target dependent initialization of
4997
+ * pic_offset_table_rtx.  This hook is called at the start of register
4998
+ * allocation.
4999
+ *
5000
+ * ZipCPU---Let's revisit this.
5001
+ */
5002
+// #warning "Come back and relook at relocations"
5003
+
5004
+/* TARGET_ARG_PARTIAL_BYTES ... This target hook returns the number of bytes
5005
+ * at the beginning of an argument that must be put in registers.  The value
5006
+ * must be zero for arguments that are passed entirely in registers or that
5007
+ * are entirely pushed on the stack.
5008
+ */
5009
+// #undef      TARGET_ARG_PARTIAL_BYTES
5010
+// #define     TARGET_ARG_PARTIAL_BYTES        zip_arg_partial_bytes
5011
+
5012
+/* TARGET_PASS_BY_REFERENCE(CUM,MOD,TREE,NAMED) ... This target hook should
5013
+ * return true if an argument at the position indicated by CUM should be passed
5014
+ * by reference.  This predicate is queried after target independent reasons
5015
+ * for being pssed by reference, such as TREE_ADDRESSABLE(TREE).
5016
+ *
5017
+ */
5018
+// #undef      TARGET_PASS_BY_REFERENCE
5019
+// #define     TARGET_PASS_BY_REFERENCE        zip_pass_by_reference
5020
+
5021
+/* CUMULATIVE ARGS ...  A C type for declaring a variable that is used as the
5022
+ * first argument of 'FUNCTION_ARG' and other related values.
5023
+ *
5024
+ * ZipCPU---We're in trouble if an 'int' won't work, so let's just use that.
5025
+ */
5026
+#define        CUMULATIVE_ARGS int
5027
+
5028
+/*
5029
+ * OVERRIDE_ABI_FORMAT
5030
+ */
5031
+
5032
+/* INIT_CUMULATIVE_ARGS ... A C statement (sans semicolon) for initializing the
5033
+ * variable CUM for the state at the beginning of the argument list.
5034
+ *
5035
+ *
5036
+ * ZipCPU---The first argument is passed in register ZIP_FIRST_ARG_REGNO, or
5037
+ * R1 (unless it has been redefined above ...)
5038
+ */
5039
+#define        INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) (CUM = 0)
5040
+
5041
+/* INIT_CUMULATIVE_LIBCALL_ARGS
5042
+ * INIT_CUMULATIVE_INCOMING_ARGS
5043
+ *
5044
+ * These default to the last INIT_CUM_ARGS value above.
5045
+ */
5046
+
5047
+/* TARGET_FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) .. This hook updates
5048
+ * the summarizer variable pointed to by CUM to advance past an argument in
5049
+ * the argument list.  The values MODE, TYPE, and NAMED describe that
5050
+ * argument.  Once this is done, the variable CUM is suitable for analyzing the
5051
+ * following argument with TARGET_FUNCTION_ARG, etc.  This hook need not do
5052
+ * anything if the argument in question was passed on the stack.  The compiler
5053
+ * knows how to track the amount of stack space used for arguments without
5054
+ * any special help.
5055
+ *
5056
+ * ZipCPU---Here we simply copy from ECO32.
5057
+ */
5058
+#define        TARGET_FUNCTION_ARG_ADVANCE     zip_function_arg_advance
5059
+
5060
+/*
5061 171 dgisselq
+ * TARGET_ARG_OFFSET(MODE, TYPE) ... If defined, a C expression that is the
5062
+ * number of bytes to add to the offset of the argument passed in memory.
5063
+ * This is needed for the SPU, which passes char and short arguments in the
5064
+ * preferred slot that is in the middle of the quad word instead of starting
5065
+ * at the top.
5066
+ *
5067
+ * ZipCPU -- sounds like the default would be (more) appropriate.
5068
+ */
5069
+/*
5070 102 dgisselq
+ * FUNCTION_ARG_PADDING        --- not necessary, since we shouldn't be padding
5071
+ * PAD_VARARGS_DOWN    --- not necessary, since we shouldn't be padding
5072
+ * BLOCK_REG_PADDING
5073
+ * TARGET_FUNCTION_ARG_BOUNDARY
5074
+ * TARGET_FUNCTION_ARG_ROUND_BOUNDARY
5075
+ */
5076
+
5077
+/* FUNCTION_ARG_REGNO_P(REGNO) ... A C expression that is nonzero if REGNO is
5078
+ * the number of a hard register in which function arguments are sometimes
5079
+ * passed.  This does not include implicit arguments such as the static chain
5080
+ * and the structure-value address.  On many machines, no registers can be used
5081
+ * for this purpose since all function arguments are pushed on the stack.
5082
+ */
5083
+#define        FUNCTION_ARG_REGNO_P(r) ((r >= ZIP_FIRST_ARG_REGNO)&&(r<=ZIP_LAST_ARG_REGNO))
5084
+
5085
+/* TARGET_SPLIT_COMPLEX_ARG(TYPE) ... This hook should return true if parameter
5086
+ * of type TYPE are passed as two scalar parameters.  By default, GCC will
5087
+ * attempt to pack complex arguments into the target's word size.  Some ABI's
5088
+ * require complex arguments to be split and treated as their individual
5089
+ * components.
5090
+ *
5091
+ * The default value of this hook is NULL, which is treated as always false,
5092
+ * and which should be good enough for ZipCPU--which can go either way.
5093
+ */
5094
+
5095
+/* TARGET_BUILD_BUILTIN_VA_LIST ... This hook returns a type node for va_list
5096
+ * for the target.  The default version of the hook returns void*.
5097
+ *
5098
+ */
5099
+
5100
+/* TARGET_ENUM_VA_LIST_P
5101
+ */
5102
+
5103
+/* TARGET_FN_ABI_VA_LIST ... This hook returns the va_list type of the calling
5104
+ * convention specified by FN.  The default version of this returns va_list_type_node.
5105
+ */
5106
+
5107
+/* TARGET_FN_ABI_VA_LIST
5108
+ */
5109
+
5110
+/* TARGET_CANONICAL_VA_LIST_TYPE
5111
+ */
5112
+
5113
+/* TARGET_GIMPLIFY_VA_ARG_EXPR
5114
+ */
5115
+
5116
+/* TARGET_VALID_POINTER_MODE(MODE) ... Define this to return nonzero if the
5117
+ * port can handle pointers with machine mode MODE.  The default version of this
5118
+ * hook returns true for both ptr_mode and Pmode.
5119
+ *
5120
+ * ZipCPU---if Pmode is properly defined (above, and I think it is), then the
5121
+ * default behavior is quite appropriate.
5122
+ */
5123
+
5124
+/* TARGET_REF_MAY_ALIAS_ERRNO(REFP) ... Define this to return nonzero if the
5125
+ * memory reference REF may alias with the system C library errno location.
5126
+ * The default version of this hook assumes the system C library errno location
5127
+ * is either a declaration of type int or accessed by dereferencing a pointer
5128
+ * to int.
5129
+ *
5130
+ * ZipCPU --- Default sounds good to me.
5131
+ */
5132
+
5133
+
5134
+/* TARGET_SCALAR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if
5135
+ * the port is prepared to handl instructions involving scalar mode MODE.  For
5136
+ * a scalar mode to be considered supported, all the basic arithmetic and
5137
+ * comparisons must work.
5138
+ *
5139
+ * The default version of this hook returns true for any mode required to
5140
+ * handle the basic C types (as defined by the port).  Included here are the
5141
+ * double-word arithmetic supported by the code in optabs.c.
5142
+ */
5143
+#undef TARGET_SCALAR_MODE_SUPPORTED_P
5144
+#define        TARGET_SCALAR_MODE_SUPPORTED_P  zip_scalar_mode_supported_p
5145
+
5146
+/* TARGET_VECTOR_MODE_SUPPORTED_P(MODE) ... Define this to return nonzero if the
5147
+ * port is prepared to handle instructions involving vector mode MODE.  At the
5148
+ * very least, it must have move patterns for this mode.
5149
+ *
5150
+ * ZipCPU---does not support any vector modes.
5151
+ */
5152
+#undef TARGET_VECTOR_MODE_SUPPORTED_P
5153
+#define        TARGET_VECTOR_MODE_SUPPORTED_P  hook_bool_mode_false
5154
+
5155
+/* TARGET_ARRAY_MODE_SUPPORTED_P(MODE, NELEMS) ... Return true if GCC should
5156
+ * try to use a scalar mode to store an array of NELEMS elements, given that
5157
+ * each element has mode MODE.  Returning true here overrides the usual MAX_FIXED_MODE limit and allows GCC to use any defined integer mode.
5158
+ *
5159
+ * ZipCPU---Sounds good.
5160
+ */
5161
+// #undef      TARGET_ARRAY_MODE_SUPPORTED_P
5162
+// #define     TARGET_ARRAY_MODE_SUPPORTED_P   zip_array_mode_supported_p
5163
+
5164
+/* TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P(MODE) ... Define this to return
5165
+ * nonzero if libgcc provides support for the floating-point mode MODE, which is
5166
+ * known to pass TARGET_SCALAR_MODE_SUPPORTED_P.  The default version of this
5167
+ * hook returns true for all of SFmode, DFmode, XFmode, and TFmode, if such
5168
+ * modes exist.
5169
+ *
5170
+ * ZipCPU---We only support SFmode and DFmode, but for now only in emulation
5171
+ * (if we can).  Let's allow both of those and see how far we get.
5172
+ */
5173
+#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
5174
+#define        TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P zip_libgcc_floating_mode_supported_p
5175
+
5176
+/* TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P(MODE) ... Define this to return
5177
+ * nonzero for machine modes for which the port has small register classes.  If
5178
+ * target hook returns nonzero for a given MODE, the compiler will try to
5179
+ * minimize the lifetime of registers in MODE.  The hook may be called with
5180
+ * VOIDmode as an argument.  In this case, the hook is expected to return
5181
+ * nonzero if it returns nonzero for any mode.
5182
+ *
5183
+ * The default version of this hook returns false for any mode.
5184
+ *
5185
+ * ZipCPU---Default sounds good.
5186
+ */
5187
+
5188
+/* 17.09.08 How scalar function values are returned */
5189
+
5190
+/* TARGET_FUNCTION_VALUE
5191
+ */
5192
+
5193
+/* LIBCALL_VALUE
5194
+ */
5195
+
5196
+
5197
+/* 17.09.09 How large values are returned */
5198
+
5199
+/* TARGET_RETURN_IN_MEMORY(TYP,FNTYP) ... This target hook should return a
5200
+ * nonzero value to say to return the function value in memory, just as large
5201
+ * structures are always returned.  Here type will be the data type of the value
5202
+ * and FNTYP will be the type of the function doing the returning, or NULL
5203
+ * for libcalls.
5204
+ *
5205
+ */
5206
+#undef TARGET_RETURN_IN_MEMORY
5207
+#define        TARGET_RETURN_IN_MEMORY zip_return_in_memory
5208
+
5209
+/* DEFAULT_PCC_STRUCT_RETURN
5210
+ * TARGET_STRUCT_VALUE_RTX
5211
+ * PCC_STATIC_STRUCT_RETURN
5212
+ * TARGET_GET_RAW_RESULT_MODE
5213
+ * TARGET_GET_RAW_ARG_MODE
5214
+ */
5215
+
5216
+
5217
+/* 17.09.10 Caller-Saves Register Allocation */
5218
+/* 17.09.11 Function Entry and Exit */
5219 111 dgisselq
+// TARGET_ASM_FUNCTION_PROLOGUE
5220
+// TARGET_ASM_FUNCTION_END_PROLOGUE
5221
+// TARGET_ASM_FUNCCTION_BEGIN_EPILOGUE
5222
+// TARGET_ASM_FUNCTION_EPILOGUE
5223
+/* EXIT_IGNORE_STACK ... Define this macro as a C expression that is nonzero
5224
+ * if the return instruction or the function epilogue ignores the value of the
5225
+ * stack pointer; in other words, if it is safe to delete an instruction to
5226
+ * adjust the stack pointer before a return from the function.
5227
+ *
5228
+ * The default is 0.
5229
+ *
5230
+ * Note that this macro's value is relevant only for functions for which frame
5231
+ * pointers are maintained.  It is never safe to delete a final stack adjustment
5232
+ * in a function that has no frame pointer, and the compiler knows this
5233
+ * regardless of EXIT_IGNORE_STACK.
5234
+ *
5235
+ * ZipCPU -- Thanks to the example of the m68k, and a careful selection of what
5236
+ * our options otherwise could have been, our epilogue code does not use the
5237
+ * stack register at all, but rather starts by moving the frame register into
5238
+ * the stack register.
5239
+ */
5240
+#define EXIT_IGNORE_STACK      1
5241
+// EPILOGUE_USES(regno)
5242
+// EH_USES(regno)
5243
+// TARGET_ASM_OUTPUT_MI_THUNK
5244
+// TARGET_ASM_CAN_OUTPUT_MI_THUNK
5245
+
5246 102 dgisselq
+/* 17.09.12 Generating code for profiling */
5247 111 dgisselq
+// FUNCTION_PROFILER
5248
+// PROFILE_HOOK
5249
+// NO_PROFILE_COUNTERS
5250
+// PROFILE_BEFORE_PROLOGUE
5251
+// TARGET_KEEP_LEAF_WHEN_PROFILED
5252
+
5253 102 dgisselq
+/* 17.09.13 Permitting tail calls*/
5254 111 dgisselq
+
5255
+/* TARGET_FUNCTION_OK_FOR_SIBCALL(DECL,EXP) ... True if it is OK to do sibling
5256
+ * call optimizations for the specified call expression EXP.  DECL will be the
5257
+ * called function, or NULL if this is an indirect call.
5258
+ *
5259
+ * It is not uncommon for limitations of calling conventions to prevent tail
5260
+ * calls to functions outside the current unit of translation, or during PIC
5261
+ * compilation.  The hook is used to enforce these restrictions, as the sibcall
5262
+ * md pattern can not fail, or fall over to a 'normal' call.  The criteria for
5263
+ * successful sibling call optimization may vary greatly between different
5264
+ * architectures.
5265
+ *
5266 191 dgisselq
+ * What's a sibling call?  "Sibling calls or tail calls terminate the function
5267
+ * in a nonn-standard way and thus an edge to the exit must be present.
5268
+ * EDGE_SIBCALL and EDGE_ABNORMAL are set in such case(s).  These edges only
5269
+ * exist in the RTL representation.
5270
+ *
5271
+ * So, basically, a sibling call is a function call at the end of one function.
5272
+ * Rather than setting up a new stack frame, return address, etc, it is
5273
+ * possible to just jump to this new function, leaving the return address for
5274
+ * the prior function as the (now) return address for this one.
5275
+ *
5276
+ * ZipCPU --- These are good things.  We wish to support them.  We will require,
5277
+ * though, that the sibling require no more stack space than the original.
5278
+ * We might go even stricter, requiring that the sibling require no stack space
5279
+ * at all--and only register variables.
5280 111 dgisselq
+ */
5281 191 dgisselq
+#define        TARGET_FUNCTION_OK_FOR_SIBCALL  zip_function_ok_for_sibcall
5282 111 dgisselq
+
5283 191 dgisselq
+/* TARGET_EXTRA_LIVE_ON_ENTRY(REGS) ... Add any hard registers to regs that are
5284
+ * live on entry to the function.  This hook only needs to be defined to provide
5285
+ * registers that cannot be found by examination of FUNTION_ARG_REGNO_P, the
5286
+ * ... and the ...
5287
+ *
5288
+ * ZipCPU -- the default should be good enough for us.
5289
+ */
5290
+/* TARGET_SET_UP_BY_PROLOGUE(CONTAINER) ... This hook should add additional
5291
+ * registers that are computed by the prologue to the hard register set for
5292
+ * shrink-wrapping optimization purposes.
5293
+ *
5294
+ * ??
5295
+ */
5296 111 dgisselq
+
5297 191 dgisselq
+/* TARGET_WARN_FUNC_RETURN(TREE) ... True if a function's return statements
5298
+ * should be checked for matching the function's return type.  This includes
5299
+ * checking for falling off the end of a non-void function.  Return false if
5300
+ * no such check should be made.
5301
+ *
5302
+ * ZipCPU--the default should be good enough for us.
5303
+ */
5304
+
5305 102 dgisselq
+/* 17.09.14 Stack smashing protection */
5306 111 dgisselq
+// TARGET_STACK_PROTECT_GUARD
5307
+// TARGET_STACK_PROTECT_FAIL
5308
+// TARGET_SUPPORTS_SPLIT_STACK
5309
+
5310 102 dgisselq
+/* 17.09.15 Miscellaneous register hooks */
5311
+
5312 111 dgisselq
+// TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5313
+
5314 102 dgisselq
+/* TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
5315
+ * ZipCPU --- default is good enough for us.
5316
+ */
5317
+
5318
+/* 17.10 Implementing VARARGS MACROS */
5319
+
5320
+/* ...
5321
+ */
5322
+
5323
+/* void TARGET_SETUP_INCOMING_VARARGS(A,M,T,I,S) ... This target hook offers an
5324
+ * alternative to using __builtin_saveregs and defining the hook TARGET_EXPAND..
5325
+ * _BUILTIN_SAVEREGS.  Use it to store the anonymous register arguments into the
5326
+ * stack so that all the arguments appear to have been passed consecutively
5327
+ * on the stack.  Once this is done, you can use the standard implementation
5328
+ * of varargs that works for machines that pass all their arguments on the
5329
+ * stack.
5330
+ */
5331
+// #undef      TARGET_SETUP_INCOMING_VARARGS
5332
+// #define     TARGET_SETUP_INCOMING_VARARGS   zip_setup_incoming_varargs
5333
+
5334
+/* ...
5335
+ */
5336
+
5337
+/* 17.11 Trampolines for Nested Functions */
5338
+
5339
+/* TARGET_ASM_TRAMPOLINE_TEMPLATE ... This hook is called by
5340
+ * assemble_trampoline_template to output, on the stream f, assembler code for
5341
+ * a block of data that contains the constant parts of a trampoline.  This code
5342
+ * should not include a label--the label is taken care of automatically.
5343
+ *
5344
+ * ZipCPU -- looks like we need to do this.
5345
+ */
5346
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
5347
+#define        TARGET_ASM_TRAMPOLINE_TEMPLATE  zip_asm_trampoline_template
5348
+
5349
+/* TRAMPOLINE_SECTION ... Return the section into which the trampoline template
5350
+ * is to be placed.  The default value is readonly_data_section.
5351
+ *
5352
+ * ZipCPU--default should be good enough.
5353
+ */
5354
+
5355
+/* TRAMPOLINE_SIZE ... A C expression for the size (in bytes) of the trampoline
5356
+ * as an integer.
5357
+ *
5358
+ * ZipCPU--it's three instructions, or 96 bits.  However, 32-bits is our minimal
5359
+ * addressible unit, so what size do we offer here?  We'll stick with the number
5360
+ * of bytes, but we may need to change this later.
5361
+ *
5362
+ */
5363
+// #warning "May need to redefine trampoline_size in words, not bytes"
5364
+#undef TRAMPOLINE_SIZE
5365
+#define        TRAMPOLINE_SIZE 3
5366
+
5367
+/* TRAMPOLINE_ALIGNMENT ... alignment required for trampolines, in bits.
5368
+ *
5369
+ * Well that's well known in ZipCPU --- 32-bits.
5370
+ */
5371
+#undef TRAMPOLINE_ALIGNMENT
5372
+#define        TRAMPOLINE_ALIGNMENT    32
5373
+
5374
+/* void TARGET_TRAMPOLINE_INIT(RTX,TREE,RTX CH) ... This hook is called to
5375
+ * initialize a trampoline.  m_tramp is an RTX for the memory block for the
5376
+ * trampoline; TREE is the FUNCTION_DECL for the nested fucntion;  CH is an
5377
+ * rtx for the static chain value that should be passed to the function when
5378
+ * it is called.
5379
+ *
5380
+ * ZipCPU ... Can we get by without this?
5381
+ */
5382
+#undef TARGET_TRAMPOLINE_INIT
5383
+#define        TARGET_TRAMPOLINE_INIT  zip_trampoline_init
5384
+
5385
+/* TARGET_TRAMPOLINE_ADJUST_ADDRESS(RTX) ... This hook should perform any
5386
+ * machine-specific adjustment in the address of the trampoline.  Its argument
5387
+ * contains the address of the memory block that was passed to
5388
+ * TARGET_TRAMPOLINE_INIT.  In case the address to be used for a function call
5389
+ * should be different from the address at which the template was stored, the
5390
+ * different address should be returned; otherwise addr should be returned
5391
+ * unchanged.  If the hook is not defined, RTX (addr) will be used for function
5392
+ * calls.
5393
+ *
5394
+ * ZipCPU--works for us!
5395
+ */
5396
+
5397
+/* CLEAR_INSN_CACHE(BEG,END) ... If defined, expands to a C expression clearing
5398
+ * the instruction cache in the specified interval.  The definition of this
5399
+ * macro would typically be a series of asm statements.   Both BEG and END are
5400
+ * pointer expressions.
5401
+ *
5402
+ * ZipCPU --- Ouch!  We have no way to do this (yet)!
5403
+ */
5404
+
5405
+/* TRANSFER_FROM_TRAMPOLINE ... Define this macro is trampolines need a special
5406 111 dgisselq
+ * subroutine to do their work.  The macro should expand to a series of asm
5407 102 dgisselq
+ * statements which will be compiled with GCC.  They go in a library function
5408
+ * named __transfer_from_trampoline.
5409
+ *
5410
+ * We may need to rethink trampolines on ZipCPU.
5411
+ */
5412
+
5413
+
5414
+/* 17.12 Implicit Calls to Library Routines */
5415
+
5416
+/* DECLARE_LIBRARY_RENAMES
5417
+ *
5418
+ * ZipCPU: Don't need it.
5419
+ */
5420
+
5421
+/* TARGET_INIT_LIBFUNCS(VOID) ... This hook should declare additional library
5422
+ * routines or rename existing ones, using the functions set_optab_libfunc and
5423
+ * init_one_libfunc defined in optabs.c.  init_optabs calls this macro after
5424
+ * initializing all the normal library routines.
5425
+ *
5426
+ * Most ports don't need to define this hook, so we won't either.
5427
+ */
5428
+
5429
+/* TARGET_LIBFUNC_GNU_PREFIX ... If false (the default), internal library
5430
+ * routines start with two underscores.  If set to true, these routines start
5431
+ * with __gnu_ instead.
5432
+ *
5433
+ * ZipCPU: No change necessary.
5434
+ */
5435
+
5436
+/* FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE,COMPARISON) ... This macro should return
5437
+ * true if the library routine that implements the floating point comparison
5438
+ * operator comparison in mode mode will return a boolean and false if it will
5439
+ * return a tristate.
5440
+ *
5441
+ * Most ports don't need to define this macro, so Zip CPU won't either.
5442
+ */
5443
+
5444
+/* TARGET_HAS_NO_HW_DIVIDE ... This macro should be defined if the target has no
5445
+ * hardware divide instructions.  If this macro is defined, GCC will use an
5446
+ * algorithm which makes use of simple logical and arithmetic operations for
5447
+ * 64-bit division.  If the macro is not defined, GCC will use an algorithm
5448
+ * which makes use of a 64-bit by 32-bit divide primitive.
5449
+ *
5450
+ * Zip CPU, though, doesn't have the 64-bit by 32-bit divide primitive, thus
5451
+ * we have no HW DIVIDE (for now).
5452
+ */
5453
+#define        TARGET_HAS_NO_HW_DIVIDE
5454
+
5455
+/* TARGET_EDOM ... The value of EDOM on the target machine, as a C integer
5456
+ * expression.  If you don't define this macro, GCC does not attempt to deposit
5457
+ * the value of EDOM into errno directly.  Look in /usr/include/errno.h to find
5458
+ * the value of EDOM on your system.
5459
+ *
5460
+ * EDOM is the error created when a math argument is out of the domain of the
5461
+ * function.
5462
+ *
5463
+ * ZipCPU: Don't need it---I don't think.
5464
+ */
5465
+
5466
+/* GEN_ERRNO_RTX ... Define this macro as a C exrpession to create an rtl
5467
+ * expression that refers to the global "variable" errno.  (On certain
5468
+ * systems, errno may not actually be a variable.)  If you don't define this
5469
+ * macro, a reasonable default is used.
5470
+ *
5471
+ * ZipCPU --- if a reasonable default is used, we'll use that--especially since
5472
+ * I doubt we'll be using errno for a while.
5473
+ */
5474
+
5475
+/* NEXT_OBJC_RUNTIME ... Set this macro to 1 to use the "NeXT" Objective-C
5476
+ * message sending conventions by default.  This calling convention involves
5477
+ * passing the object, the selector and the method arguments all at once to the
5478
+ * method-lookup library function.  This is the usual setting when targetting
5479
+ * Darwin/Mac OS X systems, which have the NeXT runtime installed.
5480
+ *
5481
+ * If the macro is set to 0, ...
5482
+ *
5483
+ * Doesn't look relevant (yet) for the Zip CPU--especially since we don't have
5484
+ * an O/S yet.
5485
+ */
5486
+
5487
+
5488
+
5489
+/* 17.13 Addressing Modes */
5490
+
5491
+/* C expressions that are nonzero if the machine supports pre-increment,
5492
+ * pre-decrement, post-increment, or post-decrement addressing respectively.
5493
+ */
5494
+#define        HAVE_PRE_INCREMENT      (0)
5495
+#define        HAVE_PRE_DECREMENT      (0)
5496
+#define        HAVE_POST_INCREMENT     (0)
5497
+#define        HAVE_POST_DECREMENT     (0)
5498
+
5499
+/* C expression that is nonzero if the machine supports pre- or post- address
5500
+ * side-effect generation involving constants other than the size of the memory
5501
+ * operand.
5502
+ */
5503
+#define        HAVE_PRE_MODIFY_DISP    (0)
5504
+#define        HAVE_POST_MODIFY_DISP   (0)
5505
+
5506
+/* C expression that is non-zero if the machine supports pre- or post-address
5507
+ * side-effect generation involving a register displacement.
5508
+ */
5509
+#define        HAVE_PRE_MODIFY_REG     (0)
5510
+#define        HAVE_POST_MODIFY_REG    (0)
5511
+
5512
+/* CONSTANT_ADDRESS_P(X) ... A C expression that is 1 if the RTX X is a constant
5513
+ * which is a valid address.  On most machines the default definition ... is
5514
+ * acceptable, but a few machines are more restrictive as to which constant
5515
+ * addresses are supported.
5516
+ *
5517
+ * Zip CPU is designed for offset addresses, not constant addresses.  Although
5518
+ * the CPU will support 18-bit signed constant addresses, the assembler and
5519
+ * general programming model do not.  Further, without knowing where the final
5520
+ * address will be located, this is an unusable model.  Therefore we will
5521
+ * define this as not supported.
5522
+ *
5523
+ * In hindsight, this isn't true--labels and symbols are valid addresses, and
5524
+ * they are also constant addresses.  Hence, we leave this at its default.
5525
+ */
5526
+// #undef      CONSTANT_ADDRESS_P
5527
+// #define     CONSTANT_ADDRESS_P(X)   (0)
5528
+
5529 111 dgisselq
+/* CONSTANT_P(X) ... CONSTANT_P, which is defined by target-independent code,
5530
+ * accepts integer values expressions whose values are not explicitly known,
5531
+ * such as symbol_ref, label_ref, and high expressions and const arithmetic
5532
+ * expressions, in addition to const_int and const_double expressions.
5533 102 dgisselq
+ *
5534
+ * Huh???
5535
+ */
5536
+// #define CONSTANT_P(X) ???
5537
+
5538 111 dgisselq
+/* MAX_REGS_PER_ADDRESS ... A number, the maximum number of registers that can
5539
+ * appear in a valid memory address.  Note that it is up to you to specify a
5540
+ * value equal to the maximum number that TARGET_LEGITIMATE_ADDRESS_P would
5541
+ * ever accept.
5542 102 dgisselq
+ */
5543
+#define        MAX_REGS_PER_ADDRESS    1
5544
+
5545
+/* TARGET_LEGITIMATE_ADDRESS_P(MODE,RTX,STRICT) ... A function that returns
5546
+ * whether RTX is a legitimate memory address on the target machine for a
5547
+ * memory operation of mode MODE.
5548
+ */
5549
+#undef TARGET_LEGITIMATE_ADDRESS_P
5550
+#define TARGET_LEGITIMATE_ADDRESS_P    zip_legitimate_address_p
5551
+
5552
+/* TARGET_MEM_CONSTRAINT ... A single character to be used instead of the
5553
+ * default 'm' character for general memory addresses.  This defines the
5554
+ * constraint letter which matches the memory addresses accepted by
5555
+ * TARGET_LEGITIMATE_ADDRESS_P.  Define this macro if you want to support new
5556
+ * address format in your back end without changing the semantics of the 'm'
5557
+ * constraint.  This is necessary in order to preserve functionality of inline
5558
+ * assembly constructs using the 'm' constraint.
5559
+ *
5560
+ * ZipCPU--doesn't look like we need to define this at all.
5561
+ */
5562
+
5563
+/* FIND_BASE_TERM(X) ... A C expression to determine the base term of address
5564
+ * X or to provide a simplified version of X from which alias.c can easily find
5565
+ * the base term.  This macro is used in only two places: find_base_value and
5566
+ * find_base_term in alias.c.
5567
+ *
5568
+ * It is always safe for this macro  to not be defined.  It exists so that
5569
+ * alias analysis can understand machine-dependent addresses.
5570
+ *
5571
+ * ZipCPU: We'll skip this then.
5572
+ */
5573
+
5574
+/* TARGET_LEGITIMIZE_ADDRESS(RTX,OLD,MODE) ... This hook is given an invalid
5575
+ * memory address RTX for an operand of mode MODE and should try to return a
5576
+ * valid memory address.  RTX will always be the result of a call to
5577
+ * break_out_memory_refs, and OLD will be the operand that was given to that
5578
+ * function to produce RTX.
5579
+ *
5580 111 dgisselq
+ * ZipCPU --
5581 102 dgisselq
+ */
5582 111 dgisselq
+#undef TARGET_LEGITIMIZE_ADDRESS
5583
+#define        TARGET_LEGITIMIZE_ADDRESS       zip_legitimize_address
5584 102 dgisselq
+
5585
+/* LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OP,TYPE,IND,WIN) ... A C compound statement
5586
+ * that attempts to replace X, which is an address that needs reloading, with
5587
+ * a valid memory address for an operand of mode MODE.  WIN will be a C
5588
+ * statement label elsewhere in the code.  It is not necessary to define this
5589
+ * macro, but it might be useful for performance reasons.
5590
+ *
5591
+ * ZipCPU: This is worth coming back to, according to the notes page, but it
5592
+ * may also be a difficult macro to use.  Look at other implementations before
5593
+ * we dive into this.
5594
+ */
5595
+// #undef LEGITIMIZE_RELOAD_ADDRESS
5596
+// #define LEGITIMIZE_RELOAD_ADDRESS
5597
+
5598
+/* TARGET_MODE_DEPENDENT_ADDRESS_P(ADDR,SPACE) ... This hook returns true
5599
+ * if memory address addr in address space addrspace can have different meanings
5600
+ * depending on the machine mode of the memory reference it is used for or if
5601
+ * the address is valid for some modes but not others.
5602
+ */
5603
+#undef TARGET_MODE_DEPENDENT_ADDRESS_P
5604
+#define        TARGET_MODE_DEPENDENT_ADDRESS_P         zip_mode_dependent_address_p
5605
+
5606 111 dgisselq
+/* TARGET_LEGITIMATE_CONSTANT_P(MODE,RTX) ... This hook returns true if x is a
5607
+ * legitimate constant for a MODE-mode immediate operand on the target machine.
5608
+ * You can assume the RTX satisfies CONSTANT_P, so you need not check this.
5609
+ *
5610
+ * The default definition returns true.
5611 102 dgisselq
+ */
5612
+
5613
+/* TARGET_DELIGITIMIZE_ADDRESS(RTX)
5614
+ */
5615
+
5616
+/* TARGET_CONST_NOT_OK_FOR_DEBUG_P(RTX) ... This hook should return true if RTX
5617
+ * should not be emitted into debug sections.
5618
+ */
5619
+
5620
+/* TARGET_CANNOT_FORCE_CONST_MEM(MODE,RTX) ... This hook should return true if
5621
+ * RTX is a form that cannot (or should not) be spilled to the constant pool.
5622
+ * MODE is the mode of X.  The default version returns false.
5623
+ */
5624 111 dgisselq
+// #define     TARGET_CANNOT_FORCE_CONST_MEM   hook_bool_mode_rtx_false
5625 102 dgisselq
+
5626
+/* TARGET_USE_BLOCKS_FOR_CONSTANT_P(MODE,RTX) ... This hook should return true
5627
+ * if pool entries for constant RTX can be placed in an object_block structure.
5628
+ * MODE is the mode of X.  The default version returns false for all constants.
5629
+ *
5630
+ *????
5631
+ */
5632
+// #warning "Huh?"
5633
+
5634
+/* TARGET_USE_BLOCKS_FOR_DECL_P(DECL) ... This hook should return true if pool
5635
+ * entries for DECL should be placed in an object_block structure.  The default
5636
+ * version returns true for all DECL's.
5637
+ *
5638
+ * Sounds good.
5639
+ */
5640
+
5641
+/* TARGET_BUILTIN_RECIPROCAL(TREE) ... This hook should return the DECL of a
5642
+ * function that implements the reciprocal of the machine specific builtin
5643
+ * function fndecl, or NULL_TREE if such a function is not available.
5644
+ */
5645
+
5646
+/* TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD(VOID) ... This hook should return the
5647
+ * DECL of a function f that given an address addr as an argument returns a mask
5648
+ * m that can be used to extrract from two vectors the relevant data that
5649
+ * resides in addr in case addr is not properly aligned.
5650
+ *
5651
+ * Zip CPU does not support vectorization.
5652
+ */
5653
+
5654
+/* Other vector, SIMD, and GOACC macros skipped as Zip CPU doesn't support
5655
+ * such data accesses and manipulation.
5656
+ */
5657
+
5658
+/* 17.14 Anchored Addresses */
5659
+
5660
+/* TARGET_MIN_ANCHOR_OFFSET ... The minimum offset that should be applied to
5661
+ * a section anchor.  On most targets, it should be the smallest offset that
5662
+ * can be applied to a base register while still giving a legitimate address for
5663
+ * every mode.  The default value is 0.
5664
+ *
5665
+ * On the Zip CPU, this is the minimum operand B offset to a LOD or STO
5666
+ * operation, which would be a signed 14 bit number.
5667
+ */
5668
+#undef TARGET_MIN_ANCHOR_OFFSET
5669
+#define TARGET_MIN_ANCHOR_OFFSET       zip_min_anchor_offset
5670
+
5671
+/* TARGET_MAX_ANCHOR_OFFSET ... Like TARGET_MIN_ANCHOR_OFFSET, but the maximum
5672
+ * (inclusive) offset that should be applied to section anchors.  The default
5673
+ * value is 0.
5674
+ */
5675
+#undef TARGET_MAX_ANCHOR_OFFSET
5676
+#define TARGET_MAX_ANCHOR_OFFSET       zip_max_anchor_offset
5677
+
5678
+/* TARGET_ASM_OUTPUT_ANCHOR(RTX) ... Write the assembly code to define section
5679
+ * anchor RTX, which is a SYMBOL_REF for which 'SYMBOL_REF_ANCHOR_P(RTL) is
5680
+ * true.  The hook is called with the assembly output position set to the
5681
+ * beginning of SYMBOL_REF_BLOCK(X).
5682
+ *
5683
+ * If ASM_OUTPUT_DEF is available, the hook's default definition uses it to
5684
+ * define the symbol as '. + SYMBOL_REF_BLOCK_OFFSET(RTL)'.  If ASM_OUTPUT_DEF
5685
+ * is not available, the hook's default definition is NULL, which disables the
5686
+ * use of section anchors altogether.
5687
+ *
5688
+ * Section anchors will be very valuable in Zip CPU assembly, therefore we
5689
+ * must define this hook.
5690
+ */
5691
+// #undef      TARGET_ASM_OUTPUT_ANCHOR
5692
+// #define     TARGET_ASM_OUTPUT_ANCHOR        zip_asm_output_anchor
5693
+
5694
+/* TARGET_USE_ANCHORS_FOR_SYMBOL_P(RTX) ... Return true if GCC should attempt
5695
+ * to use anchors to access SYMBOL_REF X.  You can assume SYMBOL_REF_HAS_BLOCK_INFO_P(X) and !SYMBOL_REF_ANCHOR_P(X).
5696
+ *
5697
+ * 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.
5698
+ *
5699
+ * Not knowing anything more, we'll leave the default as is for the Zip CPU.
5700
+ */
5701
+// #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
5702
+// #define TARGET_USE_ANCHORS_FOR_SYMBOL_P     zip_use_anchors_for_symbol_p
5703
+
5704
+/* 17.15 Condition Code Status */
5705
+
5706
+/* 17.15.1 Representation of condition codes using (cc0) --- that's us */
5707
+
5708
+/* CC_STATUS_MDEP ... C code for a data type which is used for declaring
5709
+ * the mdep component of cc_status.  It defaults to int.
5710
+ *
5711
+ * ZipCPU---Int is good for us.
5712
+ */
5713
+
5714
+/* CC_STATUS_MDEP_INIT ... A C expression to initialize the mdep field to
5715
+ * "empty".  The default definition does nothing, since most machines don't
5716
+ * use the field anyway.  If you want to use the field, you should probably
5717
+ * define  this macro to initialize it.
5718
+ */
5719
+
5720
+/* NOTICE_UPDATE_CC(EXP, INSN) ... A C compound statement to set the components
5721
+ * of cc_status appropriately for an insn insn whose body is exp.  It is this
5722
+ * macro's responsibility to recognize insns that set the condition code as
5723
+ * a byproduct of other activity as well as those that explicitly set (cc0).
5724
+ *
5725
+ * ZipCPU --- We need this, as not all expressions set (cc0).
5726
+ *
5727 191 dgisselq
+ * In hind sight, this is the *old* and unsupported way of doing business within
5728
+ * GCC.  To switch to the new way, all instruction definitions within our .md
5729
+ * file have been adjusted to either change or clobber the CC register.
5730
+ *
5731 102 dgisselq
+ */
5732 122 dgisselq
+#ifdef HAVE_cc0
5733 191 dgisselq
+// #define     NOTICE_UPDATE_CC(EXP, INSN)     zip_update_cc_notice(EXP, INSN)
5734
+#error "ZipCPU no longer has CC0"
5735 122 dgisselq
+#endif
5736 102 dgisselq
+
5737
+
5738
+/* 17.15.2 Representation of condition codes using registers */
5739
+/* ... which the ZipCPU doesn't have.  The ZipCPU has a CC0 register, and hence
5740
+ * this section isn't supposed to apply.
5741
+ */
5742
+
5743 122 dgisselq
+/* SELECT_CC_MODE(op, x, y) ... On many machines, the condition code may be
5744
+ * produced by other instructions than compares, for example the branch can use
5745
+ * directyl the condition code set by a subtract instruction.  However, on some
5746
+ * machines when the condition code is set this way some bits (such as the
5747
+ * overflow bit) are not set in the same way as a test instruction, so that a
5748
+ * different branch instruction must be used for some conditional branches.
5749
+ * When this happens, use the machinemode of the condition code register to
5750
+ * record different formats of the condition code register.  Modes can also be
5751
+ * used to reccord which compare instruction (e.g. a signed or an unsigned
5752
+ * comparison) produced the condition codes.
5753
+ *
5754
+ * If other modes than CCmode are required, add them to 'machine-modes.def' and
5755
+ * define SELECT_CC_MODE to choose a mode given an operand of a compare.  This
5756
+ * is needed because the modes have to be chosen not only during RTL generation
5757
+ * but also, for example, by instruction combination.  The result of
5758
+ * SELECT_CC_MODE should be consistent with the mode used in the patterns; ...
5759
+ *
5760
+ * ZipCPU ... We have only one CC Mode, so we'll use the CCmode defined in
5761
+ * machine-modes.def and should be fine with it.  Hence, this doesn't need
5762
+ * to be defined.
5763 102 dgisselq
+ */
5764
+
5765
+/* TARGET_CANONICALIZE_COMPARISON(int,rtx *, rtx *, bool) ... On some machines
5766
+ * (such as the ZipCPU) not all possible comparisons are defined, but you can
5767
+ * convert an invalid comparison into a valid one.  For example, the Alpha
5768
+ * does not have a GT comparison, but you can use an LT comparison instead and
5769
+ * swap the order of the operands.
5770
+ *
5771
+ * On such machines, implement this hook to do any required conversions:  code
5772
+ * is the initial comparison code and op0 and op1 are the left and right
5773
+ * operands of the comparison, respectively.  If op0_preserve_value is true the
5774
+ * implementation is not allowed to change the value of op0 since the value
5775
+ * might be used in RTXs which aren't comparisons.  E.g. the implementation is
5776
+ * not allowed to swap operands in that case.
5777
+ *
5778
+ * GCC will not assume that the comparison resulting from this macro is valid
5779
+ * but will see if the resulting insn matches a pattern in the 'md' file.
5780
+ *
5781
+ * You need not implement this hook if it would never change the comparison
5782
+ * code or operands.
5783
+ *
5784
+ * In the case of the ZipCPU, the ZipCPU only keeps track of 8 possible
5785
+ * comparisons, and bastardizing other comparisons into those 8 is extremely
5786
+ * painful.  Therefore, we *need* this capability to make certain we can use
5787
+ * our comparisons successfully.
5788
+ *
5789
+ * The only problem is ... this hook appears to only be called on non-CC0
5790
+ * machines.  Hence, defining it hasn't done anything for us.
5791
+ */
5792 122 dgisselq
+#define        TARGET_CANONICALIZE_COMPARISON  zip_canonicalize_comparison
5793 102 dgisselq
+
5794 122 dgisselq
+/* REVERSIBLE_CC_MODE(MODE) ... A C expression whose value is one if it is
5795
+ * always safe to reverse a comparison whose mode is MODE.  If SELECT_CC_MODE
5796
+ * can ever return MODE for a floating-point inequality comparison, than
5797
+ * REVERSIBLE_CC_MODE(MODE) must be zero.
5798
+ *
5799
+ * You need not define this macro if it would always return zero or if the
5800
+ * floating-point format is anything other than IEEE_FLOAT_FORMAT.  For example,
5801
+ * here ...
5802
+ *
5803
+ * ZipCPU -- We'll always return zero, so this need not be defined.
5804
+ */
5805
+
5806
+/* REVERSE_CONDITION(CODE,MODE) ... A C expression whose value is reversed
5807
+ * condition code of thecode for comparison done in CC_MODE MODE.  This macro
5808
+ * is used only in case REVERSIBLE_CC_MODE(MODE) is nonzero. ...
5809
+ *
5810
+ * ZipCPU ... Since REVERSIBLE_CC_MODE(MODE) will always be zero, we'll leave
5811
+ * this undefined.
5812
+ */
5813
+
5814
+/* bool TARGET_FIXED_CONDITION_CODE_REGS(int *, int *) ... On targets which do
5815
+ * not use (cc0), and which use a hard register rather than a pseudo-register
5816
+ * to hold condition codes, the regular CSE passes are often not able to
5817
+ * identify cases in which the hard register is set to a common value.  Use this
5818
+ * hook to enable a small pass which optimizes such cases.  This hook should
5819
+ * return true to enable this pass, and it should set the integers to which its
5820
+ * arguments point to the hard register numbers used for condition codes.  When
5821
+ * there is only one such register, as is true on most systems, the integer
5822
+ * pointed to by p2 should  be set to INVALID_REGNUM.
5823
+ *
5824
+ * The default version of this hook returns false.
5825
+ *
5826
+ * ZipCPU --- I like the idea of enabling optimizations.  Let's return
5827
+ * something other than false.
5828
+ */
5829
+#define        TARGET_FIXED_CONDITION_CODE_REGS        zip_fixed_condition_code_regs
5830
+
5831
+/* machine_mode TARGET_CC_MODES_COMPATIBLE(M1,M2) .. On targets which use
5832
+ * multiple condition code modes in class MODE_CC, it is sometimes the case
5833
+ * that a comparison can be validly done in more than one mode.  On such a
5834
+ * system, define this target hook to take two mode arguments and to return a
5835
+ * mode in which both comparisons may be validly done.  If there is no such
5836
+ * mode, return VOIDmode.
5837
+ *
5838
+ * The default version of this hook checks whether the modes are the same.  If
5839
+ * they are, it returns that mode.  If they are different, it returns VOIDmode.
5840
+ *
5841
+ * ZipCPU--Given that we only have the one CCmode, the default definition works
5842
+ * well enough for us.
5843
+ */
5844
+
5845
+/* unsigned int TARGET_FLAGS_REGNUM ... If the target has a dedicated flags
5846
+ * register, and it needs to use the post-reload comparison elimination pass,
5847
+ * then this value should be set appropriately.
5848
+ *
5849
+ * ZipCPU---Looks like we can set this easily enough without any problems.
5850
+ */
5851
+#undef TARGET_FLAGS_REGNUM
5852
+#define        TARGET_FLAGS_REGNUM     zip_CC
5853
+
5854 102 dgisselq
+/* 17.16 Relative costs of operations */
5855
+
5856
+
5857
+// #define     REGISTER_MOVE_COST(MODE,FROM,TO)        ((MODE==DImode)||(MODE==DFmode))?4:2
5858
+// #define     TARGET_REGISTER_MOVE_COST
5859
+// #define     MEMORY_MOVE_COST(MODE, CLASS, IN)       ((MODE==DImode)||(MODE==DFmode))?8:7
5860
+/* TARGET_REGISTER_MOVE_COST(M,FRM,TO) ... This target hook should return the
5861
+ * cost of moving data of mode M from a register in class FRM to one in class
5862
+ * TO.  The classes are expressed using the enumeration values such as
5863
+ * GENERAL_REGS.  A value of 2 is the default; other values are interpreted
5864
+ * relative to that.
5865
+ *
5866
+ * It is not required that the cost always equal 2 when FROM is the same as TO;
5867
+ * on some machines it is expensive to move between registers if they are not
5868
+ * general registers.
5869
+ *
5870
+ * If reload sees ...
5871
+ *
5872
+ * ZipCPU ... We can leave this at its default value of 2.
5873
+ */
5874
+
5875
+/* TARGET_MEMORY_MOVE_COST(MOD,CL,IN) ... This target hook should return the
5876
+ * cost of moving data of mode MOD between a register of class CL and memory.
5877
+ * IN is false if the value is to be written to memory, true if it is to be
5878
+ * read in.  This cost is relative to those in TARGET_REGISTER_MOVE_COST.
5879
+ * If moving between registers and memory is more expensive that between two
5880
+ * registers, you should add this target hook to express the relative cost.
5881
+ *
5882
+ * If you do not add this target hook, GCC uses a default cost of 4 plus the
5883
+ * cost of copying via a secondary reload register, if one is needed.  If your
5884
+ * machine requires a secondary reload register to copy between memory and a
5885
+ * register of CL but the reload mechanism is more complex than copying via
5886
+ * an intermediate, use this target hook to reflect the actual cost of the
5887
+ * move.
5888
+ *
5889
+ * ZipCPU --- Memory moves are more expensive than twice the cost of register
5890
+ * moves, so let's make certain this is defined.
5891
+ */
5892
+#define        TARGET_MEMORY_MOVE_COST zip_memory_move_cost
5893
+
5894
+// #warning "This needs to be double checked, and annotated"
5895 111 dgisselq
+#define        BRANCH_COST(SPEED,PREDICTABLE)          ((PREDICTABLE)?2:5)
5896 102 dgisselq
+
5897
+/* Define this macro as a C expression which is nonzero if accessing less than
5898
+ * a word of memory (i.e. a 'char' or a 'short') is no faster than accessing
5899
+ * a word of memory.
5900
+ */
5901
+#define        SLOW_BYTE_ACCESS        1
5902
+
5903
+/* MOVE_RATIO(SPD) ... The threshold of number of scalar memory-to-memory move
5904
+ * instructions, below which a sequence of instructions should be generated
5905
+ * instead of a string move instruction or a library call.  Increasing the
5906
+ * value will always make code faster, but eventually incurs high cost in
5907
+ * increased code size.
5908
+ */
5909
+#define        MOVE_RATIO(SPD) 5
5910
+
5911
+/* TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(SZ,ALGN,OP,SPD) ...
5912
+ */
5913
+// #undef      TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)
5914
+// #define     TARGET_USE_BY_PIECES_INFRASTRUCTURE_P(S,A,OP,SPD)// needs hook
5915
+
5916
+/* CLEAR_RATIO(SPD) ... The threshold number of scalar move instructions, below
5917
+ * which a sequence of instructions should be generated to clear memory instead
5918
+ * of a string clear instruction or a library call.  Increasing the value will
5919
+ * always make the code faster, but eventually incurs high cost in increased
5920
+ * code size.
5921
+ */
5922
+#define        CLEAR_RATIO(SPD)        MOVE_RATIO(SPD)
5923
+
5924
+/* NO_FUNCTION_CSE ... Define this macro to be true if it is as good or better
5925
+ * to call a constant function address than to call an address kept in a
5926
+ * register.
5927
+ *
5928
+ * On the Zip CPU, constant function addresses--especially relative ones,
5929
+ * can be optimized into a single cycle delay.  Register jumps will always
5930
+ * stall the whole (5-stage) pipeline.
5931
+ */
5932
+#define        NO_FUNCTION_CSE
5933
+
5934 111 dgisselq
+/* TARGET_RTX_COSTS(X,CODE,OUTER,OPNO,TOTAL,SPD) ... This target hook describes
5935
+ * the relative costs of RTL expressions.
5936
+ *
5937
+ * The cost may depend on the precise form of the expression, which is avaialble
5938
+ * for examination in X, and the fact that X appears as operand OPNO of an
5939
+ * expression with rtx code OUTER.  That is, the hook can assume that there is
5940
+ * some RTX Y such that GET_CODE(Y)==OUTER and such that either (a) XEXP(Y,OPNO)
5941
+ * == X or (b) XVEC(Y,OPNO) contains X.
5942
+ *
5943
+ * ...
5944
+ * The hook returns true when all subexpressions of x have been processed and
5945
+ * false when rtx_cost should recurse.
5946 102 dgisselq
+ */
5947 111 dgisselq
+
5948 102 dgisselq
+/* TARGET_ADDRESS_COST(ADDR,MODE,AS, SPD) ... This hook computes the cost of an
5949
+ * addressing mode that contains ADDR.  If not defined, the cost is computed
5950
+ * from the ADDR expression and the TARGET_RTX_COST hook.  In cases where more
5951
+ * than one form of an address is known, the form with the lowest cost will be
5952
+ * used.  If multiple forms have the same, lowest, cost, the one that is the
5953
+ * most complex will be used.
5954
+ *
5955
+ * ZipCPU really has only one address cost, the only type of address it
5956
+ * supports.  Sure, index addressing would cost us more, but we don't support
5957
+ * that so ... I think we're okay defining this as a constant.  Indeed, the
5958
+ * docs state that, "On RISC amchines, all instructions normally have the same
5959
+ * length and execution time.  Hence all addresses will have equal costs."
5960
+ */
5961
+#undef TARGET_ADDRESS_COST
5962
+#define        TARGET_ADDRESS_COST     zip_address_cost
5963
+
5964
+
5965
+/* TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P ... This predicate controls the use
5966
+ * of the eager delay slot filler to disallow speculatively executed
5967
+ * instructions being placed in delay slots.  Targets such as certain MIPS
5968
+ * architectures posess both branches with and without delay slots.  As the
5969
+ * eager delay slot filler can decrease performance, disabling it is beneficial
5970
+ * when ordinary branches are available.  Use of delay slot branches filled
5971
+ * using basic filler is often still desirable as the delay slot can hide a
5972
+ * pipeline bubble.
5973
+ */
5974
+// How should Zip CPU define this--we have no delay slots.
5975
+
5976
+
5977
+/* 17.17 Instruction Scheduler */
5978
+
5979
+#define        TARGET_SCHED_ISSUE_RATE zip_sched_issue_rate
5980
+
5981
+/* 17.18 Dividing the Output into Sections */
5982
+
5983
+/* Switch to the text or data segment. */
5984
+#define        TEXT_SECTION_ASM_OP     "\t.text"
5985
+#define        DATA_SECTION_ASM_OP     "\t.data"
5986
+
5987
+// #undef      TARGET_LIBGCC_SDATA_SECTION
5988
+// #define     TARGET_LIBGCC_SDATA_SECTION     ".sdata"
5989
+
5990
+
5991
+/* 17.19 Position Independent Code */
5992
+
5993
+#define        PIC_OFFSET_TABLE_REGNUM                 zip_GOT
5994
+#define        PIC_OFFSET_TABLE_REG_CALL_CLOBBERED     0
5995
+// #define LEGITIMATE_PIC_OPERAND_P(X) should evaluate to X(GOT) only
5996
+
5997
+/* 17.20 Defining the Output Assembler Language */
5998
+
5999 146 dgisselq
+/* 17.20.4 Output of Data */
6000
+
6001
+#undef TARGET_ASM_ALIGNED_HI_OP
6002
+#undef TARGET_ASM_ALIGNED_SI_OP
6003
+#define        TARGET_ASM_UNALIGNED_HI_OP      "\t.byte\t"
6004
+#define        TARGET_ASM_UNALIGNED_SI_OP      "\t.byte\t"
6005
+/* These hooks (above) specify assembly directives for creating certain kinds
6006
+ * of integer objects.  The TARGET_ASM_BYTE_OP directive creates a byte-sized
6007
+ * object.  The TARGET_ASMALIGNED_HI_OP one creates an aligned two-byte object
6008
+ * and so on.  Any of the hookd may be NULL, indicating that no suitable
6009
+ * directive is available.
6010
+ *
6011
+ * The compiler will print these strings at the start of a new line, followed
6012
+ * immediately by the object's initial value.  In most cases, the string should
6013
+ * contain a tab, a pseudo op, and then another tab.
6014
+ */
6015
+
6016 102 dgisselq
+/* 17.20.4 Output and Generation of Labels */
6017
+
6018
+/* ASM_OUTPUT_LABEL
6019
+ * ... A default definition of this macro is provided which is correct for
6020
+ * most systems.
6021
+ */
6022
+
6023
+/* ASM_OUTPUT_FUNCTION_LABEL
6024
+ * ... if not defined, then the function name is defined in the usual manner
6025
+ * as a label.
6026
+ */
6027
+
6028
+/* ASM_OUTPUT_INTERNAL_LABEL ... Identical to ASM_OUTPUT_LABEL, except that name
6029
+ * is known to refer to a compiler-generated label.  The default definition
6030
+ * uses assemble_name_raw, which is like assemble_name except that it is more
6031
+ * efficient.
6032
+ */
6033
+
6034
+/* SIZE_ASM_OP ... A C string containing the appropriate assembler directive
6035
+ * to specify the size of a symbol, without any arguments.  ON systems that
6036
+ * use ELF, the dfault is "\t.size\t"; on other systems, the default is not to
6037
+ * define this macro.
6038
+ *
6039
+ * Define this amcro only if it is correct to use the default definitions of
6040
+ * ASM_OUTPUT_SIZE_DERECTIVE and ASM_OUTPUT_MEASURED_SIZE for your system.
6041
+ * If you need your own custom definitions of those macros, or if you do not
6042
+ * need explicit symbol sizes at all, do not define this macro.
6043
+ */
6044
+
6045
+/* ASM_OUTPUT_SIZE_DIRECTIVE
6046
+ * ASM_OUTPUT_MEASURED_SIZE
6047
+ */
6048
+
6049
+/* NO_DOLLAR_IN_LABEL ... Define this macro if the assembler does not accept
6050
+ * the character '$' in label names.  By default constructors and destructors
6051
+ * in G++ have "$" in the identifiers.  If this label is defined, '.' is
6052
+ * used instead.
6053
+ */
6054
+
6055
+/* NO_DOT_IN_LABEL ... Define this macro if the assembler does not accept the
6056
+ * character '.' in label names.  By default constructors and destructors in
6057
+ * G++ have names that use '.'.  If this macro is defined, these names are
6058
+ * rewritten to avoid '.'.
6059
+ */
6060
+
6061
+/* TYPE_ASM_OP ... A C string containing the appropriate assembler directive to
6062
+ * specify the type of a symbol, without any arguments.  On systems that use
6063
+ * ELF the default in config/elfos.h is "\t.type\t"; on other systems, the default is not to define this macro.
6064
+ *
6065
+ * Define this macro only if it is correct to use the default definition of
6066
+ * ASM_OUTPUT_TYPE_DIRECTIVE forr your system.  If you need your own custom
6067
+ * definition of this macr, or if you do not need explicit symbol types at all,
6068
+ * do not define this macro.
6069
+ */
6070
+
6071
+/* TYPE OPERAND_FMD ... A
6072
+ */
6073
+
6074
+/* ASM_OUTPUT_TYPE_DIRECTIVE
6075
+ */
6076
+
6077
+/* ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) ...
6078
+ * if this macro is not defined, then the function name is defined in the usual
6079
+ * manner as a label (by means of ASM_OUTPUT_FUNCTION_LABEL).
6080
+ */
6081
+
6082
+/* ASM_DECLARE_FUNCTION_SIZE
6083
+ * ASM_DECLARE_COLD_FUNCTION_NAME
6084
+ * ASM_DECLARE_COLD_FUNCTION_SIZE
6085
+ * ASM_DECLARE_OBJECT_NAME
6086
+ * TARGET_ASM_DECLARE_CONSTANT_NAME
6087
+ */
6088
+/* ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) ... A C statement
6089
+ * (sans semicolon) to output to the stdio stream STREAM any text necessary for
6090
+ * claiming a register REGNO for a global variable DECL with name NAME.
6091
+ *
6092
+ * If you don't defin this macro, that is equivalent to dfining it to do
6093
+ * nothing.
6094
+ */
6095
+
6096
+/* ASM_FINISH_DECLARE_OBJECT
6097
+ * TARGET_ASM_GLOBALIZE_LABEL
6098
+ * TARGET_ASM_GLOBALIZE_DECL_NAME
6099
+ * TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
6100
+ * ASM_WEAKEN_LABEL
6101
+ * ASM_WEAKEN_DECL
6102
+ * ASM_OUTPUT_WEAKREF
6103
+ * SUPPORTS_WEAK
6104
+ * TARGET_SUPPORTS_WEAK
6105
+ * MAKE_DECL_ONE_ONLY
6106
+ * SUPPORTS_ONE_ONLY
6107
+ * TARGTE_ASM_ASSEMBLE_VISIBILITY
6108
+ * TARGET_WEAK_NOT_IN_ARCHIVE_TOC
6109
+ * ASM_OUTPUT_EXTERNAL
6110
+ * TARGET_ASM_EXTERNAL_LIBCALL
6111
+ * TARGET_ASM_MARK_DECLPRESERVED
6112
+ * ASM_OUTPUT_LABELREF
6113
+ * TARGET_MANGLE_ASSEMBLER_NAME
6114
+ * ASM_OUTPUT_SYMBOL_REF
6115
+ * ASM_OUTPUT_LABEL_REF
6116
+ * TARGET_ASM_INTERNAL_LABEL
6117
+ * ASM_OUTPUT_DEBUG_LABEL
6118
+ * ASM_GENERATE_INTERNAL_LABEL
6119
+ * ASM_FORMAT_PRIVATE_NAME
6120
+ */
6121
+
6122
+/* ASM_OUTPUT_DEF ... A C statement to output to the stdio stream STREAM
6123
+ * assembler code which defines (equates) the symbol NAME to have the value
6124
+ * VALUE.
6125
+ *
6126
+ * ZipCPU---So many other things that we need depend upon this, that we need
6127
+ * to implement a non-default version.
6128
+ */
6129
+#define        ASM_OUTPUT_DEF  zip_asm_output_def
6130
+
6131
+/* ASM_OUTPUT_DEF_FROM_DECLS
6132
+ * TARGET_DEFERRED_OUTPUT_DEFS
6133
+ * ASM_OUTPUT_WEAK_ALIAS
6134
+ * OBJ_GEN_METHOD_LABEL
6135
+ */
6136
+
6137
+
6138
+/* 17.20.7 Output of Assembler Instructions */
6139
+
6140 171 dgisselq
+#define        REGISTER_NAMES {                                        \
6141
+       "R0", "R1", "R2",  "R3",  "R4",  "R5", "R6", "R7",      \
6142
+       "R8", "R9", "R10", "R11", "R12", "SP", "CC", "PC",      \
6143
+       "uR0","uR1","uR2", "uR3", "uR4", "uR5","uR6","uR7",     \
6144
+       "uR8","uR9","uR10","uR11","uR12","uSP","uCC","uPC",     \
6145
+       "PSEUDO-AP" }
6146 102 dgisselq
+
6147
+/* REGISTER_PREFIX     (Undefined by default)
6148
+ * LOCAL_LABEL_PREFIX  (Undefined by default)
6149
+ * USER_LABEL_PREFIX   defaults to "*"
6150
+ * IMMEDIATE_PREFIX    (Undefined by default)
6151
+ *
6152
+ * If defined, C string expressions to be used for the '%R', '%L', '%U', and
6153
+ * '%I' options of asm_fprintf (see 'final.c').  These are useful when a single
6154
+ * 'md' file must support multiple assembler formats.  In that case, the various
6155
+ * 'tm.h' files can define these macros differently.
6156
+ */
6157
+// #define     USER_LABEL_PREFIX       "*"
6158
+
6159
+/* Defining memory operand address formats is in this section. */
6160
+
6161
+/* 17.20.10 Assembler Commands for Alignment */
6162
+
6163
+/* JUMP_ALIGN(label) ... The alignment (log base 2) to put in front of label,
6164
+ * which is a common destination of jumps and has no fallthru incoming
6165
+ * edge.  This macro need not be defined if you don't want any special alignment
6166
+ * to be done at such a time.  Most machine descriptions do not currently define
6167
+ * this macro.
6168
+ *
6169
+ * ZipCPU---The assembler should automatically deal with label alignment, so
6170
+ * let's not do anything about it here.
6171
+ */
6172
+
6173
+/* TARGET_ASM_JUMP_ALIGN_MAX_SKIP
6174
+ */
6175
+
6176
+/* LABEL_ALIGN_AFTER_BARRIER
6177
+ * TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
6178
+ */
6179
+
6180
+/* LOOP_ALIGN(label)
6181
+ * TARGET_ASM_LOOP_ALIGN_MAX_SKIP
6182
+ * LABEL_ALIGN
6183
+ * TARGET_ASM_LABEL_ALIGN_MAX_SKIP
6184
+ */
6185
+
6186
+/* ASM_OUTPUT_SKIP(STREAM, NBYTES) A C statement to output to the stdio
6187
+ * stream an assembler instruction to advance the location counter by nbytes
6188
+ * bytes.
6189
+ */
6190
+
6191
+/* TARGET_ASM_LABEL_ALIGN */
6192
+/* Assembler Commands for Alignment */
6193
+#define        ASM_OUTPUT_ALIGN(STREAM,POWER)  \
6194 127 dgisselq
+       { int pwr = POWER; fprintf(STREAM, "\t.p2align %d\n", (pwr<2)?2:pwr); }
6195 102 dgisselq
+
6196
+
6197
+
6198
+/* 17.21 Controlling Debugging Information Format */
6199
+/* 17.22 Cross Compilation and Floating Point */
6200 111 dgisselq
+
6201
+// REAL_VALUE_TYPE
6202
+// REAL_VALUES_EQUAL
6203
+// REAL_VALUES_LESS ... Tess whether x is less than y
6204
+/* REAL_VALUE_FIX ... Truncates x to an unsigned integer, rouding toward zero.
6205
+ * If x is negative, returns zero.
6206
+ */
6207
+// REAL_VALUE_ATOF
6208
+// REAL_VALUE_NEGATIVE
6209
+// REAL_VALUE_ISINF
6210
+// REAL_VALUE_ISNAN
6211
+/* REAL_ARITHMETIC(OUT,CODE,X,Y) ... (Macro) Calculates an arithmetic operation
6212
+ * on two floating point values X and Y, storing the result in OUT (which must
6213
+ * be a variable).
6214
+ *
6215
+ * The operation to be performed is specified by CODE.  Only the following
6216
+ * codes are supported: PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, MAX_EXPR,
6217
+ * MIN_EXPR.
6218
+ *
6219
+ * If REAL_ARITHMETIC is asked to evaluate division by zero and the target's
6220
+ * floating point format cannot represent infinity, it will call abort().
6221
+ * Callers shoudl check for this situation first, using MODE_HAS_INFINITIES.
6222
+ */
6223
+/* REAL_VALUE_NEGATE(X) ... [Macro] Returns the negative of the floating point
6224
+ * value X.
6225
+ */
6226
+/* REAL_VALUE_ABS(X) ... [Macro] Returns the absolute value of X.
6227
+ */
6228 102 dgisselq
+/* 17.23 Mode switching instructions */
6229
+/* 17.24 Defining target-specific uses of __attribute__ */
6230
+#undef TARGET_OPTION_OVERRIDE
6231
+#define        TARGET_OPTION_OVERRIDE  zip_override_options
6232
+
6233
+/* 17.25 Emulating TLS */
6234
+/* 17.26 Defining coprocessor specifics for MIPS targets*/
6235
+
6236
+ // ZipCPU isn't MIPS.
6237
+
6238
+/* 17.27 Parameters for Precompiled Header Validity Checking */
6239
+/* 17.28 C++ ABI parameters */
6240
+/* 17.29 Adding support for named address spaces */
6241
+/* 17.30 Miscellaneous Parameters */
6242
+
6243
+/* HAS_LONG_COND_BRANCH ... Define this boolean macro to indicate whether or
6244
+ * not your architecture has conditional branches that can span all of memory.
6245
+ * It is used in conjunction with an optimization that partitions hot and
6246
+ * cold basic blocks into separate sections of the executable.  If this macro
6247
+ * is set to false, gcc will convert any conditional branches that attempt to
6248
+ * cross between sections into unconditional branches or indirect jumps.
6249
+ *
6250
+ * ZipCPU --- The assembler renders long unconditional branch code without
6251
+ * problems, so we can pretend that such long branches exist.
6252
+ */
6253
+#define        HAS_LONG_COND_BRANCH true
6254
+
6255
+/* HAS_LONG_UNCOND_BRANCH ... Define this boolean macro to indicate whether
6256
+ * or not your architecture has unconditional branches that can span all of
6257
+ * memory.  (ZipCPU does ... via the LOD (PC),PC instruction.)  It is used in
6258
+ * conjunction with an optimization that partitions hot and cold basic blocks
6259
+ * into separate sections of the executable.  If this macro is set to false,
6260
+ * gcc will convert any unconditional branches that attempt to cross between
6261
+ * sections into indirect jumps.
6262
+ *
6263
+ * ZipCPU has the LOD (PC),PC instruction which can be used to implement a long
6264
+ * jump.
6265
+ */
6266
+#define        HAS_LONG_UNCOND_BRANCH  true
6267
+
6268
+/* CASE_VECTOR_MODE ... An alias for a machine mode name.  This is the machine
6269
+ * mode that eleemnts of a jump-table should have.
6270
+ *
6271
+ */
6272
+#define        CASE_VECTOR_MODE        SImode
6273
+
6274
+/* CASE_VECTOR_SHORTEN_MODE(MIN,MAX,BODY) ... Optional: return the preferred
6275
+ * mode for an addr_diff_vec when the minimum and maximum offset are known.
6276
+ * If you define this, it enables extra code in branch shortening to deal with
6277
+ * addr_diff_vec.  To make this work, you also have to define INSN_ALIGN and
6278
+ * make the alignment for addr_diff_vec explicit.  The body argument is provided so that the offset_unsigned and scale flags can be updated.
6279
+ *
6280
+ * ZipCPU---No advantage here.
6281
+ */
6282
+
6283
+/* CASE_VECTOR_PC_RELATIVE ... Define this exrpession to indicate when
6284
+ * jump-tables should contain relative addresses.  You need not define this
6285
+ * macro if jump-tables never contain relative addresses, or jump-tables
6286
+ * should contain relative addresses only when -fPIC or -FPIC is in effect.
6287
+ *
6288
+ * ZipCPU---No advantage in PC-Relative jump tables--except in PIC relative
6289
+ * code.
6290
+ */
6291
+
6292
+/* TARGET_CASE_VALUES_THRESHOLD(VOID) ... This function returns the smallest
6293
+ * number of different values for which it is best to use a jump-table instead
6294
+ * of a tree of conditional branches.  The default is four for machines with a
6295
+ * casesi instruction and five otherwise.  This is best for most machines.
6296
+ *
6297
+ * ZipCPU---Leave at the default.
6298
+ */
6299
+
6300
+/* WORD_REGISTER_OPERATIONS ... Define this macro to 1 if operations between
6301
+ * registers with integral mode smaller than a word are always performed on the
6302
+ * entire register.  Most RISC machines have this property and most CISC
6303
+ * machines do not.
6304
+ *
6305
+ * ZipCPU---We have the property, 'cause we're fairly risk.
6306
+ */
6307
+#undef WORD_REGISTER_OPERATIONS
6308
+#define        WORD_REGISTER_OPERATIONS        1
6309
+
6310
+/* LOAD_EXTEND_OP(MEMODE) ... Define this macro to be a C expression indicating
6311
+ * when insns that read memory in MEMMODE, an integral mode narrower than a
6312
+ * word, set the bits outside of MEMMODE to be either the sign extension or
6313
+ * zero-extension of the data read.  Return SIGN_EXTEND for values of MEMMODE
6314
+ * for which the insn sign-extends, ZERO_EXTEND for which it zero-extends, and
6315
+ * UNKNOWN for other modes.
6316
+ *
6317
+ * Do not define this macro if it would always return UNKNOWN.
6318
+ *
6319
+ * ZipCPU---This should be irrelevant, so we leave it undefined.
6320
+ */
6321
+#undef LOAD_EXTEND_OP
6322
+#define        LOAD_EXTEND_OP(MEM)     SIGN_EXTEND
6323
+
6324
+/* SHORT_IMMEDIATES_SIGN_EXTEND ... Define this macro to 1 if loading short immediate values into registers sign extends.
6325
+ *
6326
+ * ZipCPU---All immediates are sign extended, so yes.
6327
+ */
6328
+#undef SHORT_IMMEDIATES_SIGN_EXTEND
6329
+#define        SHORT_IMMEDIATES_SIGN_EXTEND    1
6330
+
6331
+/* TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
6332
+ */
6333
+
6334
+/* MOVE_MAX ... The maximum number of bytes that a single instruction can move
6335
+ * quickly between memory and registers or between two memory locations.
6336
+ *
6337
+ * ZipCPU --- Although we can move 32-bits at a time, and most people would call
6338
+ * this 4-bytes, the compiler defines a byte as the minimum addressable unit.
6339
+ * Therefore, this is defined to be one.
6340
+ */
6341
+#define        MOVE_MAX        1
6342
+
6343
+/* MAX_MOVE_MAX ... The maximum number of bytes that a single instruction can
6344
+ * move quickly between memory and registers or between two memory ...
6345
+ *
6346
+ * ZipCPU --- this sounds just the same as MOVE_MAX, which is the default
6347
+ * definition of this.
6348
+ */
6349
+
6350
+/* SHIFT_COUNT_TRUNCATED ... A C expression that is nonzero if on this machine
6351
+ * the number of bits actually used for the count of a shift operation is equal
6352
+ * to the number of bits needed to represent the size of the object being
6353
+ * shifted.
6354
+ *
6355
+ * You need not define this macro if it would have the value of zero.
6356
+ *
6357
+ * ZipCPU---A shift of 33 (or more) in either direction will wipe out the
6358
+ * value in the register, therefore this value should be zero, the default.
6359
+ */
6360
+
6361
+/* TARGET_SHIFT_TRUNCATION_MASK(MODE) ... This function describes how the
6362
+ * standard shift patterns for MODE deal with shifts by negative amounts or by
6363
+ * more than the width of the mode.
6364
+ *
6365
+ * ZipCPU---The default is zero, since we didn't define SHIFT_COUNT_TRUNCATED.
6366
+ * This is the case for the ZipCPU as well.
6367
+ */
6368
+
6369
+/* TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) ... A C expression which is nonzero
6370
+ * if on this machine it is safe to "convert" an integer of INPREC bits to one
6371
+ * of OUTPREC bits (where OUTPREC is smaller than INPREC) by merely operating on
6372
+ * it as if it had OUTPREC bist.  On many machines, this expression can be 1.
6373
+ *
6374
+ * ZiPCPU ... If both values are 32-bit, what conversion takes place?  If one is
6375
+ * 64-bit and the other 32-bit ... I suppose it would then be safe.
6376
+ */
6377
+#undef TRULY_NOOP_TRUNCATION
6378
+#define TRULY_NOOP_TRUNCATION(O,I)     1
6379
+
6380
+/* TARGET_MODE_REP_EXTENDED(MODE,REPMODE) ... The representation of an integral
6381
+ * mode can be such that the values are always extended to a wider integral
6382
+ * mode.  Return SIGN_EXTEND if values of MODE are represented in sign-extended
6383
+ * form to REPMODE.  Return UNKNOWN otherwise.  (Currently none of the targets
6384
+ * use zero-extended.
6385
+ *
6386
+ */
6387
+// #undef      TARGET_MODE_REP_EXTENDED
6388
+// #define     TARGET_MODE_REP_EXTENDED(R,M)   SIGN_EXTEND
6389
+
6390
+/* STORE_FLAG_VALUE ... A C expression describing the value returned by a
6391
+ * comparison operator with an integral mode and stored by a store-flag
6392
+ * instruction (cstoremode4) when the condition is true.  This description
6393
+ * must apply to all the cstoremode4 patterns and all the comparison operators
6394
+ * whose results have MODE_INT mode.
6395
+ *
6396
+ * ZipCPU---Doesn't really have a STORE_FLAG_VALUE instruction ...
6397
+ */
6398
+
6399
+/* FLOAT_STORE_FLAG_VALUE
6400
+ *
6401
+ * ZipCPU
6402
+ */
6403
+
6404
+/* VECTOR_STORE_FLAG_VALUE ... define this macro on machines that have vector
6405
+ * comparison operations that return a vector result ...
6406
+ *
6407
+ * ZipCPU---Doesn't support vector operations.
6408
+ */
6409
+
6410
+/* CLZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6411
+ * CTZ_DEFINED_VALUE_AT_ZERO(MODE, VAL)
6412
+ *
6413
+ * A C expression that indicates whetther the architecture defines a value for
6414
+ * clz or ctz with a zero operand.  A result of 0 indicates the value is
6415
+ * 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
6416
+ * entry, then the macro should evaluate to 2.  In cases where the value is
6417
+ * defined, value should be set to this value.
6418
+ * If this macro is not defined, the value of clz or ctz at zero is assumed to
6419
+ * be undefined.
6420
+ *
6421
+ * ZipCPU---Has neither clz nor ctz instructions, so we don't need this.
6422
+ */
6423
+
6424
+/* Pmode ... An alias for the machine mode for pointers.  On most machines,
6425
+ * define this to be the integer mode corresponding to the width of a
6426
+ * hardware pointer.  SImode on 32-bits machines, or DImode on 64-bit machines.
6427
+ * On some machines you must define this to be one of the partial
6428
+ * integer modes, such as PSImode.
6429
+ */
6430
+#undef Pmode
6431
+#define        Pmode   SImode
6432
+
6433
+/* FUNCTION_MODE ... An alais for the machine mode used for memory references to
6434
+ * function being called, in call RTL expressions.  On most CISC machines, where
6435
+ * an instruction can begin at any byte address, this should be QImode.  On most
6436
+ * RISC machines, where all instructions have fixed size and alignment, this
6437
+ * should be a mode with the same size and alignment as the machine instruction
6438
+ * words--typically SImode or HImode.
6439
+ *
6440
+ * ZipCPU---Definitely SImode, as with Pmode.  (All words are 32-bits, including
6441
+ * addresses on the ZipCPU.
6442
+ */
6443
+#undef FUNCTION_MODE
6444
+#define        FUNCTION_MODE   SImode
6445
+
6446
+/* STDC_0_IN_SYSTEM_HEADERS
6447
+ */
6448
+
6449
+/* TARGET_C_PREINCLUDE(V) ... Define this hook to return the name of  a header
6450
+ * file to be included at the start of all compilations, as if it had been
6451
+ * included with #include <file>.  If this hook returns NULL, or is not defined,
6452
+ * or if the header is not found, or if the user specifies -ffreestanding or
6453
+ * -nostdinc, no header is included.
6454
+ *
6455
+ * ZipCPU --- We don't have a standard library defined yet, so we'll leave this
6456
+ * as NULL.
6457
+ */
6458
+#undef TARGET_C_PREINCLUDE
6459
+#define        TARGET_C_PREINCLUDE     NULL
6460
+
6461
+/* TARGET_CXX_IMPLICIT_EXTERN_C(CONST CHAR *) ... Define this hook to add target
6462
+ * specific C++ implicit extern C functions.  If this function returns true
6463
+ * for the name of a file-scope function, that function implicitly gets extern
6464
+ * "C" linkage rather than whatever linkage the declaration would normally have.
6465
+ * An example of such function is WinMain on Win32 targets.
6466
+ *
6467
+ * ZipCPU---Not ready to deal with this yet.
6468
+ */
6469
+
6470
+/* NO_IMPLICIT_EXTERN_C ... Define this macro if the system header files
6471
+ * support C++ as well as C.  This macro inhibits the usual method of using
6472
+ * system header files in C++, which is to pretend that the file's contents
6473
+ * are enclosed in 'extern "C" {...}'.
6474
+ *
6475
+ *
6476
+ * ZipCPU --- Don't have either C or C++ headers, so let's skip this for now.
6477
+ * Eventually, though, I think ZipCPU and C++ would go very well together.
6478
+ */
6479
+
6480
+/* REGISTER_TARGET_PRAGMAS ... Define this macro if you want to implement any
6481
+ * target specific pragmas.
6482
+ *
6483
+ * ZipCPU --- let's not.
6484
+ */
6485
+
6486
+/* HANDLE_PRAGMA_PACK_WITH_EXPANSION ... Define this macro if macros should be
6487
+ * expanded in the arguments of #pragma pack().
6488
+ *
6489
+ * ZipCPU ... why?
6490
+ */
6491
+
6492
+/* TARGET_DEFAULT_PACK_STRUCT ... If your target requires a struct packing
6493
+ * default other than 0 (meaning the machine default), define this macro to
6494
+ * the necessary value (in bytes).  This must be a value that would also be
6495
+ * valid to use with #pragma pack() (that is a small power of two.
6496
+ */
6497
+
6498
+/* DOLLARS_IN_IDENTIFIERS
6499
+ * ZipCPU --- Default (not changing C)
6500
+ */
6501
+
6502
+/* INSN_SETS_ARE_DELAYED(INSN) ... Define this macro as a C expression that
6503
+ * is nonzero if it is safe for the delay slot schedule to place instructions
6504
+ * in the delay slot of INSN, even if they appear to use a resource set or
6505
+ * clobbered in INSN.  INSN is always a ...
6506
+ *
6507
+ * ZipCPU --- You need not define this macro if it would always return zero.
6508
+ */
6509
+
6510
+/* INSN_REFERENCES_ARE_DELAYED(INSN) ... Define this macro as a C expression
6511
+ * that is nonzero if it is safe for the delay slot schedule to place
6512
+ * instructions in the delay slot of INSN, even if they appear to set or clobber
6513
+ * a resource referenced in INSN.  INSN is always a jump_insn or an insn.  On
6514
+ * machines where some insn or jump_insn is really a function call and ...
6515
+ *
6516
+ * ZipCPU --- You need not define this macro if it would always return zero.
6517
+ */
6518
+
6519
+/* MULTIPLE_SYMBOL_SPACES ... Define this macro as a C expression that is
6520
+ * nonzero if, in some cases, global symbols from one translation unit may not
6521
+ * be bound to undefined symbols in another translation unit without user
6522
+ * intervention.  For instance, under Microsoft Windows symbols must be
6523
+ * explicitly imported from shared libraries (DLLs).
6524
+ *
6525
+ * ZipCPU---You need not define this macro if it would always evaluate to zero,
6526
+ * so we won't.
6527
+ */
6528
+
6529
+/* TARGET_MD_ASM_ADJUST
6530
+ */
6531
+/* MATH_LIBRARY ... Define this macro as a C constant ... you only need to
6532
+ * define this macro if the default of "m" is wrong.
6533
+ *
6534
+ * ZipCPU --- as we don't have a math library yet, building one such that "m"
6535
+ * works doesn't sound like a problem.  Let's not define this.
6536
+ */
6537
+
6538
+/* LIBRARY_PATH_ENV ... Define this as a C string constant for the environment
6539
+ * variable that specifies where the linker should look for libraries.
6540
+ *
6541
+ * Just in case we want to add libraries for ZipCPU, let's place them in
6542
+ * /usr/local/zip/lib, so as not to confuse them with our local systems
6543
+ * libraries.
6544
+ */
6545
+#define        LIBRARY_PATH_ENV        "/usr/local/zip/lib"
6546
+
6547
+/* TARGET_POSIX_IO ... Define this macro if the target supports the following
6548
+ * POSIX file fucntions: access, mkdir, and file locking with fcntl/F_SETLKW.
6549
+ *
6550
+ * ZipCPU does not.
6551
+ */
6552
+
6553
+/* MAX_CONDITIONAL_EXECUTE ... A C expression for the maximum number of
6554
+ * instructions to execute via conditional execution instructions instead of a
6555
+ * branch.  A value of BRANCH_COST+1 is the default if the machine does not use
6556
+ * cc0 and 1 if it does use cc0.
6557
+ *
6558
+ * ZipCPU---This sounds good enough for the ZipCPU as well--as long as we have
6559
+ * BRANCH_COST defined.  However, BRANCH_COST is defined as conditionally to
6560
+ * something else, so let's keep looking into this.
6561
+ */
6562
+
6563
+/* IFCVT_MODIFY_TESTS(CEINFO,TRUE,FALSE) ... Used if the target needs to
6564 103 dgisselq
+ * perform machine-dependent modifications on the conditionals used for turning
6565 102 dgisselq
+ * basic blocks into conditionally executed code.  CEINFO points to a data
6566
+ * structure, struct ce_if_block, which contains information about the currently
6567
+ * processed blocks.  TRUE and FALSE are the tests that are used for
6568
+ * converting the then-block and the else-block, respectively.  Set either TRUE
6569
+ * or FALSE to a null pointer if the tests cannot be converted.
6570
+ *
6571
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6572
+ * execution and conditional testing capabilities.
6573
+ */
6574 122 dgisselq
+#define        IFCVT_MODIFY_TESTS(CI,TR,FL)    zip_ifcvt_modify_tests(CI,&TR,&FL)
6575 102 dgisselq
+
6576
+/* IFCVT_MODIFY_MULTIPLE_TESTS(CEINFO, BB, TRUE, FALSE) ... Like
6577
+ * IFCVT_MODIFY_TESTS, but used when converting more complicated if-statements
6578
+ * into conditions combined by and and or operations.  BB contains the basic
6579
+ * block that contains the test that is currently being processed and about to
6580
+ * be turned into a condition.
6581
+ *
6582
+ *
6583
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6584
+ * execution and conditional testing capabilities.
6585
+ */
6586
+// #warning "Need to come back to this."
6587 122 dgisselq
+#define        IFCVT_MODIFY_MULTIPLE_TESTS(CI,BB,TR,FL) TR=NULL_RTX
6588 102 dgisselq
+
6589
+
6590
+/* IFCVT_MODIFY_INSN(CEINFO, PATTERN, INSN) ... A C expression to modify the
6591
+ * PATTERN of an INSN that is to be converted to conditional execution format.
6592
+ * CEINFO points to a data structure, struct ce_if_block, which contains
6593
+ * information about the currently processed blocks.
6594
+ *
6595
+ *
6596
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6597
+ * execution and conditional testing capabilities.
6598
+ */
6599 142 dgisselq
+#define        IFCVT_MODIFY_INSN(CE,PATRN,INSN) zip_ifcvt_modify_insn(CE,PATRN,INSN)
6600 102 dgisselq
+
6601
+
6602
+/* IFCVT_MODIFY_FINAL(CEINFO) ... A C expression to perform any final
6603
+ * machine dependent modifications in converting code to conditional
6604
+ * execution.  The involved basic blocks can be found in struct ce_if_block
6605
+ * structure pointed to be CEINFO.
6606
+ *
6607
+ *
6608
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6609
+ * execution and conditional testing capabilities.
6610
+ */
6611
+// #warning "Need to come back to this."
6612 122 dgisselq
+#define        IFCVT_MODIFY_FINAL(CEINFO)      zip_ifcvt_modify_final(CEINFO)
6613 102 dgisselq
+
6614
+
6615
+/* IFCVT_MODIFY_CANCEL(CEINFO) ... A C expression to cancel any machine
6616
+ * dependent modifications in converting code to conditional execution.  The
6617
+ * involved basic blocks can be found in the struct ce_if_block structure that
6618
+ * is pointed to by CEINFO.
6619
+ *
6620
+ *
6621
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6622
+ * execution and conditional testing capabilities.
6623
+ */
6624
+// #warning "Need to come back to this."
6625 122 dgisselq
+#define        IFCVT_MODIFY_CANCEL(CEINFO)     zip_ifcvt_modify_cancel(CEINFO)
6626 102 dgisselq
+
6627
+
6628
+/* IFCVT_MACHDEP_INIT(CEINFO) ... A C expression to initialize any machine
6629
+ * specific data for if-conversion of the if-block in the CEINFO block structure
6630
+ * that is pointed by CEINFO.
6631
+ *
6632
+ *
6633
+ * ZipCPU --- I need to set this to properly take advantage of our conditional
6634
+ * execution and conditional testing capabilities.
6635
+ */
6636
+// #warning "Need to come back to this."
6637 122 dgisselq
+#define        IFCVT_MACHDEP_INIT(CEINFO)      zip_ifcvt_machdep_init(CEINFO)
6638 102 dgisselq
+
6639
+
6640
+/* TARGET_MACHINE_DEPENDENT_REORG(VOID) ... If non-null, this hook performs a
6641
+ * target specific pass over the instruction stream.  The compiler will run it
6642
+ * at all optimization levels, just before the point at which it normally does
6643
+ * delayed branch scheduling.
6644
+ *
6645
+ * You need not implement the hook if it has nothing to do.
6646
+ *
6647
+ * ZipCPU---This may be part of a later upgrade, but shouldn't be needed to
6648
+ * just get us started.
6649
+ */
6650
+
6651
+
6652
+/* TARGET_INIT_BUILTINS(VOID) ... Define this hook if you ahve any machine
6653
+ * specific builtin functions that need to be defined.  It should be a function
6654
+ * that performs the necessary setup.  Machine specific builtin functions can be
6655
+ * useful to expand special machine instructions that would otherwise not
6656
+ * normally be generated because they have no equivalent in the source language.
6657
+ *
6658
+ * To create a built in function, call the function lang_hooks.builtin_function
6659
+ * which is defined by the language front end.  You can use any type nodes
6660
+ * set up by build_common_tree_nodes; only language front ends that use those
6661
+ * two functions will call "TARGET_INIT_BUILTINS".
6662
+ *
6663
+ * ZipCPU---We need to come back to this.  We should have several built-ins
6664
+ * defined: rtu(), wait(), halt(), save_context(cstackregno), and
6665
+ * restore_context(cstackregno).
6666
+ *
6667
+ */
6668
+#undef TARGET_INIT_BUILTINS
6669
+#define        TARGET_INIT_BUILTINS    zip_init_builtins
6670
+
6671
+/* TARGET_BUILTIN_DECL(CODE,INITP) ... Define this hook if you have any
6672
+ * machine specific builtin functions that need to be defined.  It should be a
6673
+ * function that returns the builtin function declaration for the builtin
6674
+ * function code code.  If there is no such builtin and it cannot be initialized
6675
+ * at this time if INITP is true the function should return NULL_TREE.  If
6676
+ * CODE is out of range the fucntion should return error-mark_node.
6677
+ *
6678
+ * ZipCPU ... needs to be done, don't know how to do it yet.
6679
+ */
6680
+#undef TARGET_BUILTIN_DECL
6681
+#define        TARGET_BUILTIN_DECL     zip_builtin_decl
6682
+
6683
+
6684
+/* TARGET_EXPAND_BUILTIN(TREE,TGT,SUB,MODE,IGNORE) ... Expand a call to a
6685
+ * machine specific built-in function that was set up by TARGET_INIT_BUILTINS.
6686
+ * TREE is the expression for the function call; the result should go to
6687
+ * TGT if that is convenient, and have mode MODE if that is convenient.  SUB
6688
+ * may be used as the target for computing one of EXP's operands.  IGNORE is
6689
+ * non-zero if the value is to be ignored.  This function should return the
6690
+ * result of the call to the built-in function.
6691
+ *
6692
+ * ZipCPU ... needs to do it, just to get our special intrinsic functions
6693
+ */
6694
+#define        TARGET_EXPAND_BUILTIN   zip_expand_builtin
6695
+
6696
+
6697
+/* TARGET_BUILTIN_CHKP_FUNCTION(FCODE) ... Allows the target to redefine
6698
+ * builtin functions used by Pointer Bounds Checker for code instrumentation.
6699
+ *
6700
+ * ZipCPU --- not interested.
6701
+ */
6702
+/* TARGET_CHKP_BOUND_TYPE
6703
+ * TARGET_CHKP_MAKE_BOUNDS_CONSTANT
6704
+ * TARGET_CHKP_INITIALIZE_BOUNDS
6705
+ *
6706
+ * ZipCPU --- Same as last one.
6707
+ */
6708
+
6709
+
6710
+/* TARGET_RESOLVE_OVERLOADED_BUILTIN(LOC, FN, ARGS) ... Select a replacement
6711
+ * for a machine specific built-in function that was set up by
6712
+ * TARGET_INIT_BUILTINS.
6713
+ *
6714
+ * ZipCPU --- If I go to the trouble to create a builtin, why would I want
6715
+ * to then overload it?
6716
+ */
6717
+
6718
+/* TARGET_FOLD_BUILTIN(FN,NARGS,ARGP,IGNORE) ... Fold a call to a machine
6719
+ * specific built-in function that was set up by 'TARGET_INIT_BUILTINS'  FN
6720
+ * is the declaration of the built-in function.  NARGS is the number of
6721
+ * arguments passed to the function; the arguments themselves are pointed to by
6722
+ * ARGP.  The result is another tree, valid for both GIMPLE and GENERIC,
6723
+ * containing as simplified expression for the call's result.  If IGNORE is
6724
+ * true the value will be ignored.
6725
+ *
6726
+ * ZipCPU --- You know, this and the previous couple sound like something
6727
+ * whereby I might be able replace bit-reversal code with my bit reverse
6728
+ * instruction.  That would be very useful, but not necessary to get me
6729
+ * started.
6730
+ */
6731
+
6732
+/* TARGET_GIMPLE_FOLD_BUILTIN
6733
+ * TARGET_COMPARE_VERSION_PRIORITY
6734
+ * TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
6735
+ * TARGET_GENERATE_VERSION_DISPATCHER_BODY
6736
+ * TARGET_CAN_USE_DOLOOP_P
6737
+ * TARGET_INVALID_WITHIN_DOOLOOP
6738
+ * TARGET_LEGITIMATE_COMBINED_INSN
6739
+ * TARGET_CAN_FOLLOW_JUMP
6740
+ * TARGET_COMMUTATIVE_P
6741
+ */
6742
+
6743
+/* TARGET_ALLOCATE_INITIAL_VALUE(REGNO)  ... When the initial value of a hard
6744
+ * register has been copied in a pseudo register, it is often not necessary
6745
+ * ...
6746
+ */
6747
+/* TARGET_UNSPEC_MAY_TRAP_P(RTX,FLAGS)  ... This target hook returns nonzero in
6748
+ * RTX, un unspec or unspec_volatile operation, might cause a trap.  Targets
6749
+ * can use this hook to enhance precision of analysis for unspec and
6750
+ * unspec_volatile operations.  You may call may_trap_p_1 to analyze inner
6751
+ * elements of RTX in which case flags should be passed along.
6752
+ */
6753
+
6754
+/* TARGET_SET_CURRENT_FUNCTION(TREE)  The compiler invokes this hook whenever
6755
+ * it changes its current function context (CFUN).  You can define this
6756
+ * function if the back end needs to perform any initialization or reset
6757
+ * actions on a per-function basis.  For example, it may be used to implement
6758
+ * function attributes that affect register usage or code generation patterns.
6759
+ */
6760
+
6761
+/* TARGET_OBJECT_SUFFIX ... Define this macro to be a C string representing the
6762
+ * suffix for object files on your target machine.  If you do not define this
6763
+ * macro, GCC will use ".o" as the suffix for object files.
6764
+ */
6765
+#define        TARGET_OBJECT_SUFFIX    ".o"
6766
+
6767
+/* TARGET_EXECUTABLE_SUFFIX
6768
+ */
6769
+#define        TARGET_EXECUTABLE_SUFFIX        ""
6770
+
6771
+/* COLLECT_EXPORT_LIST ... If defined, collect2 will scan the individual object
6772
+ * files specified on its command line and create an export list for the linker.
6773
+ * Define this macro for systems like AIX, where the linker discards object
6774
+ * files that are not referenced from main and uses export lists.
6775
+ *
6776
+ * ZipCPU --- shoudln't need this.
6777
+ */
6778
+
6779
+/* MODIFY_JNI_METHOD_CALL(MDECL)  ... Define this macro to a C expression
6780
+ * representing a variant of the method call mdecl, if Java Native Interface
6781
+ * (JNI) methods must be invoked differently from other methods on your
6782
+ * target.  For example, on 32-bit MSWindows, JNI methods must be invoked
6783
+ * using the stdcall calling convention and this macro is then ...
6784
+ *
6785
+ * ZipCPU----Don't need this.  (yet)
6786
+ */
6787
+
6788
+
6789
+/* TARGET_CANNOT_MODIFY_JUMPS_P ... This target hook returns true past the
6790
+ * point in which a new jump instructions could be created.  On machines that
6791
+ * require a register for every jump such as the SHmedia ISA of SH5, this point
6792
+ * would typically be reload, so thiss target hook should be defined to a
6793
+ * function such as:
6794
+ *
6795 117 dgisselq
+ * ZipCPU --- I don't get what this is for.
6796
+ *     Actually, in hind sight, ZipCPU needs this.  Without this, the
6797
+ * compiler will try to reorder basic blocks, shuffling logic around and so
6798
+ * fortch, preventing our comparison optimizations from being used.  By setting
6799
+ * this function appropriately, we can prevent it from reversing conditions into
6800
+ * conditions we don't support.
6801 102 dgisselq
+ */
6802 117 dgisselq
+#define        TARGET_CANNOT_MODIFY_JUMPS_P    zip_cannot_modify_jumps_p
6803 102 dgisselq
+
6804
+/* TARGET_BRANCH_TARGET_REGISTER_CLASS ... This target hook returns a register
6805
+ * class for which branch target register optimizations should be applied.  All
6806
+ * registers in this class should be usable interchangably.  After reload,
6807
+ * registers in this class will be re-allocated and loads will be hoisted out of
6808
+ * loops and be subjected to inter-block scheduling.
6809
+ *
6810
+ * ZipCPU---GENERAL_REGS, but this should be a default already ...
6811
+ */
6812
+
6813
+
6814
+/* TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED ...  Branch target register
6815
+ * optimization will by default exclude callee-saved registers that are not
6816
+ * already live during the current function.  If this target hook returns true,
6817
+ * they will be included.  The target code must then make sure that all target
6818
+ * registers in the class returned by TARGET_BRANCH_REGISTER_CLASS that might
6819
+ * be saved are saaved.
6820
+ *
6821
+ * ZipCPU---
6822
+ */
6823
+
6824
+
6825
+/* TARGET_HAVE_CONDITIONAL_EXECUTION(VOID) ... This target hook returns true
6826
+ * if the target supports conditional execution.  This target hook is required
6827
+ * only when the target has several different modes and they have different
6828
+ * conditional execution capability, such as ARM.
6829
+ *
6830
+ * ZipCPU---Yes!  All instructions may be conditionally executed (except the
6831
+ * long version load immediate ...)
6832
+ */
6833
+#define        TARGET_HAVE_CONDITIONAL_EXECUTION       hook_bool_void_true
6834
+
6835
+/* TARGET_GEN_CCMP_FIRST(PREP,GEN,CODE,OP0,OP1) .. This function prepares to
6836
+ * emit a comparison instruction for the first compare in a sequence of
6837
+ * conditional comparisons.  It returns an appropriate comparison with CC for
6838
+ * passing to gen_ccmp_next or cbranch_optab.  The instructions to prepare the
6839
+ * compare are saved in prep_seq and the compare instructions are saved in
6840
+ * gen_seq.  They will be emitted when all the compares in the conditional
6841
+ * comparison are generated without error.  CODE is the rtx_code of the compare
6842
+ * for op0 and op1.
6843
+ *
6844
+ *
6845
+ * ZipCPU---???
6846
+ */
6847
+
6848
+/* TARGET_GEN_CCMP_NEXT(PREP,GEN,PREV,CMP,OP0,OP1,BITCODE) ... This function
6849
+ * prepares to emit a conditional comparison within a sequence of conditional
6850
+ * comparisons.  It returns an appropriate comparison with CC for passing to
6851
+ * gen_ccmp_next or cbranch_optab.  The insn to prepare the compare are saved
6852
+ * in prep_seq and the compare instructions are saved in gen_seq.  They will be
6853
+ * emitted when all the compares in the conditional comparison are generated
6854
+ * without error.  The pPREV expression is the result of a prior call to either
6855
+ * gen_ccmp_first or gen_ccmp_next.  It may return NULL if the combination of
6856
+ * PREV and this comparison is not supported, otherwise the result must be the
6857
+ * appropriate for passing to gen_ccmp_next or cbranch_optab.  CODE is the RTX
6858
+ * code of the compare for op0 and op1.  BITCODE is AND or IOR, which is the op
6859
+ * on the compares.
6860
+ *
6861
+ *
6862
+ * ZipCPU --- ???
6863
+ */
6864
+
6865
+/* TARGET_LOOP_UNROLL_ADJUST(NUNROLL, LOOP) ... This target hook returns a new
6866
+ * value for the number of times loop should be unrolled.  The parameter NUNROLL
6867
+ * is the number of times the loop is to be unrolled.  The parameter loop is a
6868
+ * pointer to the loop, which is going to be checked for unrolling.  The target
6869
+ * hook is required only when the target has special constraints like maximum number of memory accesses.
6870
+ *
6871
+ *
6872
+ * ZipCPU -- ???
6873
+ */
6874
+
6875
+
6876
+/* POWI_MAX_MULTS ... If defined, this macro is interpreted as a signed integer
6877
+ * C expression that specifies the maximum number of floating point
6878
+ * multiplications that should be emitted when expanding exponentiation by an
6879
+ * integer constant inline.  When this value is defined, exponentiation
6880
+ * requiring more than this number of multiplications is implemented by calling
6881
+ * the system library's pow, powf, or powl routines.  The default value
6882
+ places no upper bound on the multiplication count.
6883
+ *
6884
+ * ZipCPU---As we have no system library pow() routine (yet) ... we're not
6885
+ * ready for this macro.
6886
+ */
6887
+
6888
+
6889
+/* TARGET_EXTRA_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6890
+ * register any extra include files for the target.  The parameter stdinc
6891
+ * indicates if normal include files are present.  The parameter SYSROOT is the
6892
+ * system root directory.  The parameter PFX is the prefix for the GCC
6893
+ * directoiry.
6894
+ *
6895
+ *
6896
+ * ZipCPU---None yet.
6897
+ */
6898
+
6899
+/* TARGET_EXTRA_PRE_INCLUDES(SYSROOT, PFX, STDINC) ... This target hook should
6900
+ * register any extrra include files for the target before any standard headers.
6901
+ * The parameter stdinc indicates if normal include files are present.
6902
+ *
6903
+ * ZipCPU --- None.
6904
+ */
6905
+
6906
+/* TARGET_OPTF(PATH) ... This target hook should register special include paths
6907
+ * for the target.  The parameter path is the integer to register.  On Darwin
6908
+ * systems, this is used for Framework includes, which have semantics that are
6909
+ * different from -I.
6910
+ *
6911
+ *
6912
+ * ZipCPU --- None.
6913
+ */
6914
+
6915
+/* TARGET_USE_LOCAL_THUNK_ALIAS_P(FN) ... This target macro returns if it is
6916
+ * safe to use a local alias for a virtual function FN when constructing
6917
+ * thunks, false otherwise.  By default, the macro returns true for all
6918
+ * functions, if a target supports aliases (i.e. defines ASM_OUTPUT_DEF),
6919
+ * false otherwise.
6920
+ *
6921
+ *
6922
+ * ZipCPU --- ???
6923
+ */
6924
+// #warning "ASM_OUTPUT_DEF's definition has not been considered"
6925
+
6926
+
6927
+/* TARGET_FORMAT_TYPES ... If defined, this macro is the name of a global
6928
+ * variable containing target-specific format checking information for the
6929
+ * -Wformat option.  The default is to have no target-specific format checks.
6930
+ *
6931
+ * ZipCPU --- Default
6932
+ */
6933
+
6934
+/* TARGET_N_FORMAT_TYPES
6935
+ *
6936
+ * ZipCPU --- Default
6937
+ */
6938
+
6939
+/* TARGET_OVERRIDES_FORMAT_ATTRIBUTES ... If defined, this macro is the name of
6940
+ * a global variable containing target-specific format overrides for the
6941
+ * -Wformat option.  The default is to have no target specific format overrides.
6942
+ *
6943
+ * ZipCPU --- Default
6944
+ */
6945
+
6946
+/* TARGET_OVERRIDEES_FORMAT_ATTRIBUTES
6947
+ * TARGET_OVERRIDEES_FORMAT_ATTRIBUTES_COUNT
6948
+ *
6949
+ * If defined, the (first) macro is the name of a global variable containing
6950
+ * target-specific format overrides for the -Wformat option.
6951
+ */
6952
+/* TARGET_OVERRIDES_FORMAT_INIT ... If defined, this macro specifies the
6953
+ * optional initialization routine for target specific customizations of the
6954
+* system printf and scanf formatter settings.
6955
+ */
6956
+
6957
+/* TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN(TLIST,FN,VAL) ... If defined, this
6958
+ * macro returns the diagnostic message when it is illegal to pass an argument
6959
+ * VAL to function FN with prototype TLIST.
6960
+ *
6961
+ * ZipCPU---Default.
6962
+ */
6963
+
6964
+/* TARGET_INVALID_CONVERSION
6965
+ * TARGET_INVALID_UNARY_OP
6966
+ * TARGET_INVALID_BINARY_OP
6967
+ * TARGET_INVALID_PARAMETER_TYPE
6968
+ * TARGET_INVALID_RETURN_TYPE
6969
+ * TARGET_PROMOTED_TYPE
6970
+ * TARGET_CONVERT_TO_TYPE
6971
+ * TARGET_USE_JCR_SECTION_TYPE
6972
+ * OBJC_JBLEN
6973
+ * LIBGCC2_UNWIND_ATTRIBUTE
6974
+ * TARGET_UPDATE_STACK_BOUNDARY
6975
+ * TARGET_GET_DRAP_RTX
6976
+ * TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
6977
+ */
6978
+/* TARGET_CONST_ANCHOR ... On some architectures it can take multiple
6979
+ * instructions to synthesize a constant. If there is another constant already
6980
+ * in a register that is close enough in value then it is preferable that the
6981
+ * new constant is computed from the register using immediate addition or
6982
+ * subtraction.  We accomplish this through CSE.  Besides the value of the
6983
+ * constant we also add a lower and an upper constant anchor to the available
6984
+ * expressions.  These are then queried when encountering new constants.  The
6985
+ * anchors are computed by rounding the constant up and down to a multiple of
6986
+ * the value of TARGET_CONST_ANCHOR.  TARGET_CONST_ANCHOR should be the maximum
6987
+ * positive value accepted by immediate-add plus one.  We currently assume that
6988
+ * the value of TARGET_CONST_ANCHOR is a poewr of 2.  For example, on MIPS,
6989
+ * where add-immediate takes a 16-bit signed value, TARGET_CONST_ANCHOR is set
6990
+ * to 0x8000.  The default value is zero, which disables this optimization.
6991
+ *
6992
+ * ZipCPU---One of the great strengths of the ZipCPU ISA is its ability to
6993
+ * access registers plus immediates.  To use this, we *need* this capability.
6994
+ * So, we define it here. (to 0x20000, or 2^17 because we can handle 18-bits of
6995
+ * signed immediate offsets)
6996
+ *
6997
+ * On ZipCPU---2^17
6998
+ */
6999
+#define        TARGET_CONST_ANCHOR     zip_const_anchor
7000
+
7001
+/* TARGET_ASAN_SHADOW_OFFSET ... Return the offset bitwise ored into shifted
7002
+ * address to get corresponding Address Sanitizer shadow memory address.  NULL
7003
+ * if address Sanitizer is not supported by the target.
7004
+ */
7005
+#define        TARGET_ASAN_SHADOW_OFFSET       NULL
7006
+
7007
+/* TARGET_MEMMODEL_CHECK
7008
+ */
7009
+/* TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ... This value should be set if the result
7010
+ * written by atomic test and set is not exactly 1, i.e. the bool true.
7011
+ */
7012
+/* TARGET_HAS_IFUNC_P ... It returns true if the target supports GNU indirect
7013
+ * functions.  The support includes the assembler, linker, and dynamic linker.
7014
+ * The default value of this hook is based on target's libc.
7015
+ */
7016
+#define        TARGET_HAS_IFUNC_P      hook_bool_void_true
7017
+
7018
+/* TARGET_ATOMIC_ALIGN_FOR_MODE(MODE) ... If defined, this function returns
7019
+ * an appropriate alignment in bits for an atomic object of machine mode
7020
+ * MODE.  If 0 is returned then the default alignment for the specified mode
7021
+ * is used.
7022
+ *
7023
+ * ZipCPU---Both default and 2 would be valid.  We'll stick to the default.
7024
+ */
7025
+
7026
+/* TARGET_ATOMIC_ASSIGN_EXPAND_FENV --- ISO C11 requires atomic compound
7027
+ * assignments that may raise floating-point exceptions to raise exceptions
7028
+ * corresponding to the arithmetic operation whose result was successfully
7029
+ * stored in a compare-and-exchange sequence.  This requires code equivalent to
7030
+ * calls to feholdexcept, feclearexcept and feupdateenv to be generated at
7031
+ * appropriate points in the compare-and-exchange sequence.  This hook should
7032
+ * set *hold to an expression equivalent
7033
+ *
7034
+ * ZipCPU --- ???
7035
+ */
7036
+
7037
+/* TARGET_RECORD_OFFLOAD_SYMBOL ... Used when offloaded functions are seen in
7038
+ * the compilation unit and no named sections are available.  It is called once
7039
+ * for each symbol that must be recorded in the offload function and variable
7040
+ * table.
7041
+ *
7042
+ * ZipCPU --- Offloaded functions?
7043
+ */
7044
+
7045
+/* TARGET_OFFLOAD_OPTIONS
7046
+ *
7047
+ * ZipCPU---none defined
7048
+ */
7049
+
7050
+/* TARGET_SUPPORTS_WIDE_INT ... On older ports, large integers are stored
7051
+ * in CONST_DOUBLE rtl objects.  Newer ports define TARGET_SUPPORTS_WIDE_INT
7052
+ * to be nonzero to indicate that large integers are stored in CONST_WIDE_INT
7053
+ * rtl objects.  The CONST_WIDE_INT allows very large integer constants to be
7054
+ * represented.  CONST_DOUBLE is limited to twice the size of the hosts
7055
+ * HOST_WIDE_INT representation.
7056
+ *
7057
+ * ZipCPU---We don't need these yet, so this isn't yet relevant.  (These ints
7058
+ * are wider than DImode ...)
7059
+ */
7060
+#define        TARGET_SUPPORTS_WIDE_INT        0
7061
+
7062
+
7063
+/* Now, for the prototype functions ...*/
7064
+// These have been moved to zip-protos.h
7065
+
7066
+// extern void zip_init_builtins(void);
7067
+// extern void zip_asm_output_anchor(rtx x);
7068
+// extern bool zip_legitimate_address_p(enum machine_mode mode, rtx x, bool string);
7069
+// extern void zip_asm_trampoline_template(FILE *);
7070
+// extern void zip_initial_elimination_offset(int from, int to);
7071
+// extern void zip_print_operand(FILE *stream, rtx *x, int code);
7072
+// extern void zip_print_operand_address(FILE *stream, rtx *x);
7073
+// extern void zip_asm_output_def(FILE *s, const char *n, const char *v);
7074
+// extern void zip_update_cc_notice(rtx exp, rtx_insn *insn);
7075
+// extern      int zip_address_operand(rtx op);
7076
+// extern      int zip_const_address_operand(rtx op);
7077
+// extern void zip_expand_prologue(void);
7078
+// extern void zip_expand_epilogue(void);
7079
+// extern bool zip_gen_move_rtl(rtx, rtx);
7080
+// extern bool zip_load_address_lod(rtx, rtx);
7081
+// extern bool zip_load_address_sto(rtx, rtx);
7082
+// extern void zip_print_operand(FILE *fp, rtx x, int code);
7083
+// extern void zip_print_operand_address(FILE *fp, rtx x);
7084
+// extern bool zip_use_return_insn(void);
7085
+
7086 111 dgisselq
+#define        UQQmode USQmode
7087
+#define        UHQmode USQmode
7088
+#define        UHAmode USAmode
7089
+#define        QQmode  SQmode
7090
+#define        HQmode  SQmode
7091 102 dgisselq
+#define        QImode  SImode
7092
+#define        HImode  SImode
7093 111 dgisselq
+#define        QAmode  SAmode
7094
+#define        HAmode  SAmode
7095 102 dgisselq
+
7096
+#include "insn-modes.h"
7097
+#include "zip-protos.h"
7098
+
7099
+#endif /* GCC_ZIP_H */
7100
+
7101
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
7102
--- gcc-5.3.0-original/gcc/config/zip/zip.md    1969-12-31 19:00:00.000000000 -0500
7103 191 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-09-15 11:37:25.730251033 -0400
7104
@@ -0,0 +1,3463 @@
7105 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7106
+;;
7107
+;; Filename:   zip.md
7108
+;;
7109
+;; Project:    Zip CPU -- a small, lightweight, RISC CPU soft core
7110
+;;
7111
+;; Purpose:    This is the machine description of the Zip CPU as needed by the
7112
+;;             GNU compiler collection (GCC).
7113
+;;
7114
+;;
7115
+;; Creator:    Dan Gisselquist, Ph.D.
7116
+;;             Gisselquist Technology, LLC
7117
+;;
7118
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7119
+;;
7120
+;; Copyright (C) 2015, Gisselquist Technology, LLC
7121
+;;
7122
+;; This program is free software (firmware): you can redistribute it and/or
7123
+;; modify it under the terms of  the GNU General Public License as published
7124
+;; by the Free Software Foundation, either version 3 of the License, or (at
7125
+;; your option) any later version.
7126
+;;
7127
+;; This program is distributed in the hope that it will be useful, but WITHOUT
7128
+;; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
7129
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7130
+;; for more details.
7131
+;;
7132
+;; License:    GPL, v3, as defined and found on www.gnu.org,
7133
+;;             http://www.gnu.org/licenses/gpl.html
7134
+;;
7135
+;;
7136
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7137
+;;
7138
+;;
7139
+;; - Immediate integer operand constraints
7140
+;;     'I'     -2^22 ... 2^22-1, or -4194304 .. 4194303        (LDI insn)
7141
+;;     'M'     -2^12 ... 2^12-1, or -4096 ... 4095             (MOV offset)
7142
+;;     'N'     -2^14 ... 2^14-1, or -16384 ... 16383           (OpB offset)
7143
+;;     'O'     -2^17 ... 2^17-1, or -131072 ... 131071         (OpB Immediate)
7144
+;;     'R'     0...31                                          (Shift value)
7145
+;; - Memory constraints
7146 111 dgisselq
+;;     "Q"     Op-B capable references to memory
7147
+;;     "S"     References to constant memory
7148 102 dgisselq
+;; - Address constraints
7149 111 dgisselq
+;;     "U"     Op-B capable address that references to memory
7150
+;;     "T"     Constant memory addresses
7151 102 dgisselq
+(define_constraint "M"
7152
+  "An 13-bit signed immediate such as a MOV instruction can handle"
7153
+  (and (match_code "const_int")
7154
+       (match_test "(ival < 0x1000) && (ival >= -0x1000)")))
7155
+(define_constraint "N"
7156
+  "An 14-bit signed immediate offset such as an Op-B register offset"
7157
+  (and (match_code "const_int")
7158
+       (match_test "(ival < 0x2000) && (ival >= -0x2000)")))
7159
+(define_constraint "O"
7160
+  "An 18-bit signed immediate such as an Op-B Immediate can handle"
7161
+  (and (match_code "const_int")
7162
+       (match_test "(ival < 0x20000) && (ival >= -0x20000)")))
7163
+(define_constraint "R"
7164
+  "Bits that a value may be shifted"
7165
+  (and (match_code "const_int")
7166
+       (match_test "(ival < 32) && (ival >= 0)")))
7167
+;;
7168
+;
7169
+;
7170
+; Our builtin functions, by identifier
7171
+;
7172
+(define_constants
7173 117 dgisselq
+       [(UNSPEC_RTU             1)
7174
+       (UNSPEC_HALT             2)
7175
+       (UNSPEC_IDLE             3)
7176
+       (UNSPEC_SYSCALL          4)
7177
+       (UNSPEC_SAVE_CONTEXT     5)
7178
+       (UNSPEC_RESTORE_CONTEXT  6)
7179
+       (UNSPEC_BITREV           7)
7180
+       (UNSPEC_GETUCC           8)
7181
+       (UNSPEC_GETCC            9)
7182
+       (UNSPEC_LDILO           10)
7183 127 dgisselq
+       ; (UNSPEC_RAW_CALL      11)
7184 102 dgisselq
+       ])
7185
+;
7186
+;
7187
+; Registers by name
7188
+(define_constants
7189
+  [(RTN_REG            0)      ; Return address register
7190
+   (RTNV_REG           1)      ; Subroutine return value register
7191
+   (AP_REG             10)     ; Hopefully never used
7192
+   (GBL_REG            11)     ; Hopefully never used, but just in case ...
7193
+   (FP_REG             12)
7194
+   (SP_REG             13)
7195
+   (CC_REG             14)
7196
+   (PC_REG             15)
7197
+  ])
7198
+;
7199
+;
7200
+;
7201
+
7202
+;; Predicates
7203
+(define_predicate "zip_const_address_operand_p"
7204
+       (match_code "symbol_ref,const,label_ref,code_label")
7205
+{
7206
+       return zip_const_address_operand(op);
7207
+})
7208
+
7209
+(define_predicate "zip_address_operand_p"
7210
+       (match_code "reg,plus")
7211
+{
7212 111 dgisselq
+       return zip_pd_opb_operand(op);
7213 102 dgisselq
+})
7214
+
7215 111 dgisselq
+(define_predicate "zip_opb_operand_p"
7216 122 dgisselq
+       (match_code "reg,plus,const_int,subreg")
7217 111 dgisselq
+{
7218
+       return zip_pd_opb_operand(op);
7219
+})
7220
+
7221 122 dgisselq
+(define_predicate "zip_opb_immv_p"
7222
+       (match_code "const_int")
7223
+{
7224
+       return (INTVAL(op)<((1<<13)-1))&&(INTVAL(op)>=-((1<<13)));
7225
+})
7226
+
7227 111 dgisselq
+(define_predicate "zip_opb_single_operand_p"
7228 122 dgisselq
+       (match_code "reg,subreg,const_int")
7229 111 dgisselq
+{
7230
+       return zip_pd_opb_operand(op);
7231
+})
7232
+
7233 102 dgisselq
+(define_predicate "zip_mov_operand_p"
7234
+       (match_code "reg,plus")
7235
+{
7236
+       return zip_pd_mov_operand(op);
7237
+})
7238
+
7239
+(define_predicate "zip_memory_operand_p"
7240
+       (match_code "mem")
7241
+{
7242 111 dgisselq
+       return zip_pd_opb_operand(XEXP(op,0));
7243 102 dgisselq
+})
7244
+
7245 111 dgisselq
+(define_predicate "zip_imm_operand_p"
7246
+       (match_code "const_int")
7247
+{
7248
+       return zip_pd_imm_operand(op);
7249
+})
7250
+
7251
+(define_predicate "zip_mvimm_operand_p"
7252
+       (match_code "const_int")
7253
+{
7254
+       return zip_pd_mvimm_operand(op);
7255
+})
7256
+
7257
+(define_predicate "zip_movdst_operand_p"
7258
+       (match_code "mem,reg,subreg")
7259
+{
7260
+       if (MEM_P(op)) // Check for valid store address
7261
+               return zip_pd_opb_operand(XEXP(op,0));
7262 122 dgisselq
+       else if (SUBREG_P(op))
7263
+               return 1;
7264
+       else if ((REG_P(op))||(SUBREG_P(op)))
7265
+               return register_operand(op, GET_MODE(op));
7266 111 dgisselq
+       return 1;
7267
+})
7268
+
7269
+(define_predicate "zip_movsrc_operand_p"
7270
+       (match_code "mem,reg,subreg,const_int,const,symbol_ref,label_ref,code_label")
7271
+{
7272
+       if (MEM_P(op))
7273
+               return zip_pd_opb_operand(XEXP(op,0));
7274
+       else if (GET_CODE(op)==PLUS)
7275
+               return zip_pd_opb_operand(op);
7276 122 dgisselq
+       else if (SUBREG_P(op)) {
7277
+               //; As far as predicates are concerned, subregs must be valid.
7278
+               //; The details of them are settled within the constraints.
7279
+               return 1;
7280
+       } else if ((REG_P(op))||(SUBREG_P(op)))
7281
+               return register_operand(op,SImode);
7282
+       else if (CONST_INT_P(op))
7283
+               return 1;
7284 111 dgisselq
+       return 1;
7285
+})
7286
+
7287 102 dgisselq
+;; Constraints
7288
+;
7289
+(define_memory_constraint "S"
7290
+       "Any memory referenced by a constant address, possibly unknown at compile time"
7291
+       (and (match_code "mem")
7292
+               (match_test "zip_ct_const_address_operand(XEXP(op,0))")))
7293
+(define_memory_constraint "Q"
7294
+       "Any memory addressed suitably for a load or store instruction"
7295
+       (and (match_code "mem")
7296
+               (match_test "zip_ct_address_operand(XEXP(op,0))")))
7297
+(define_address_constraint "U"
7298
+       "An address suitable for a load or store instruction"
7299
+       (and (match_code "reg,plus")
7300
+               (match_test "zip_ct_address_operand(op)")))
7301
+(define_address_constraint "T"
7302
+       "Any constant address, to include those made by symbols unknown at compile time"
7303
+       (and (match_code "label_ref,code_label,symbol_ref,const")
7304
+               (match_test "zip_ct_const_address_operand(op)")))
7305
+;
7306
+;
7307
+;; Attributes
7308
+;
7309
+(define_attr "predicable"  "no,yes" (const_string "yes"))
7310
+(define_attr "conditional" "no,yes" (const_string "no"))
7311
+(define_attr "ccresult" "set,unknown,unchanged,validzn" (const_string "set"))
7312
+;
7313
+; Mode attributes
7314
+; (define_mode_iterator ZI [QI HI SI])
7315
+; (define_mode_attr zipa [(QI "") (HI "") (SI "")])
7316
+(define_mode_iterator ZI [SI])
7317
+(define_mode_attr zipa [(SI "")])
7318
+;
7319
+;
7320
+;
7321
+;; Instructions
7322
+;
7323
+; (define_insn
7324
+;      optional name
7325
+;      RTL template -- a vector of incomplete RTL expressions describing the
7326
+;              semantics of the instruction.  It is incomplete because it may
7327
+;              contain match_operand, match_operator, and match_dup expressions
7328
+;      The condition --- contains a C expression, may be an empty string
7329
+;      output template or output statement--fragment of C code returning a str
7330
+;      Attributes --
7331
+;      )
7332
+;
7333
+; (match_operand:m n predicate constraint)
7334
+;      Placeholder for operand #n of the instruction
7335
+;      Predicate       string that is the name of a fucntion w/ 2 arguments:
7336
+;                              (expression, machine mode)
7337
+;              we can build functions:
7338
+;                      "isregister"    to describe a register
7339
+;                      "isimmediate"   to describe an immediate
7340
+;                      "offsetreg"     to describe a register plus offset
7341
+;                      "anyregister"   to describe *ANY* register (uRx or Rx)
7342
+;              But ... functions "address_operand", "immediate_operand",
7343
+;                      "register_operand", "indirect_operand"
7344
+;              "comparison_operatot" and "ordered_comparison_operator"
7345
+;              are also available--be aware, they include more comparisons
7346
+;              than Zip CPU can do.
7347
+;
7348
+;
7349
+;
7350
+;
7351
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7352
+;;
7353
+;; Move instructions: both
7354
+;      (arbitrary) from variables to variables, but this gets
7355
+;              expanded into:
7356
+;      from registers to registers
7357
+;      from immediates to registers
7358
+;;
7359
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7360
+;
7361
+;
7362
+;
7363
+(define_expand "mov<mode>"
7364 111 dgisselq
+       [(set (match_operand:ZI 0 "nonimmediate_operand" "")
7365
+               (match_operand:ZI 1 "general_operand" ""))]
7366 102 dgisselq
+       ""
7367 111 dgisselq
+       {//; Everything except mem=const or mem=mem can be done easily
7368
+       //; extern void zip_debug_rtx_pfx(const char *, const_rtx);
7369
+       //; fprintf(stderr, "ZIP-GEN-MOVE\n");
7370
+       //; zip_debug_rtx_pfx("FROM: ", operands[1]);
7371
+       //; zip_debug_rtx_pfx("TO  : ", operands[0]);
7372
+
7373
+       //; Need to load into a register between memory slots
7374
+       if ((MEM_P(operands[0]))&&(MEM_P(operands[1]))) {
7375
+               //; fprintf(stderr, "GEN-MOVSI: MEM -> MEM\n");
7376
+               if (can_create_pseudo_p()) {
7377
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[1]));
7378
+                       emit_insn(gen_movsi(tmp,operands[1]));
7379
+                       operands[1] = tmp;
7380
+               }
7381 102 dgisselq
+       }
7382 111 dgisselq
+
7383
+       //; Op[0] has a bad address, need to legitimize it
7384
+       if ((MEM_P(operands[0]))&&
7385
+               ((zip_const_address_operand(XEXP(operands[0],0)))
7386
+               ||(!zip_pd_opb_operand(XEXP(operands[0],0))))
7387
+               )
7388
+               {
7389
+               //; fprintf(stderr, "GEN-MOVSI: Not to a MEM(REG)\n");
7390
+               if (can_create_pseudo_p()) {
7391
+                       rtx tmp = gen_reg_rtx(Pmode);
7392
+                       //; Load the address into a register
7393
+                       emit_insn(gen_movsi(tmp,XEXP(operands[0],0)));
7394
+                       XEXP(operands[0],0) = tmp;
7395
+                       mark_reg_pointer(tmp,1);
7396
+               }
7397
+       }
7398
+       //; Op[1] is a constant.  Need to load into a register before we can
7399
+       //; place it into memory.
7400
+       if ((MEM_P(operands[0]))&&
7401
+               ((CONSTANT_P(operands[1]))
7402
+               ||(CONST_INT_P(operands[1])))) {
7403
+               //; fprintf(stderr, "GEN-MOVSI: CONST -> MEM\n");
7404
+               //; zip_debug_rtx_pfx("MEM  : ", operands[0]);
7405
+               //; zip_debug_rtx_pfx("CONST: ", operands[1]);
7406
+               if (can_create_pseudo_p()) {
7407
+                       rtx tmp = gen_reg_rtx(GET_MODE(operands[0]));
7408
+                       emit_insn(gen_movsi(tmp,operands[1]));
7409
+                       operands[1] = tmp;
7410
+               }
7411
+       }
7412
+       //; Op[1] has a bad address, need to legitimize it
7413
+       if ((MEM_P(operands[1]))&&
7414
+               //; (!REG_P(XEXP(operands[1],0)))
7415
+               ((zip_const_address_operand(XEXP(operands[1],0)))
7416 122 dgisselq
+               ||(!zip_pd_opb_operand(XEXP(operands[1],0))))) {
7417 111 dgisselq
+               //; fprintf(stderr, "GEN-MOVSI: Not from a MEM(REG)\n");
7418
+               if (can_create_pseudo_p()) {
7419
+                       rtx tmp = gen_reg_rtx(Pmode);
7420
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7421
+                       XEXP(operands[1],0) = tmp;
7422
+               } else if (REG_P(operands[0])) { //; Can we steal Op[0]'s reg?
7423
+                       rtx tmp = operands[0];
7424
+                       emit_insn(gen_movsi(tmp,XEXP(operands[1],0)));
7425
+                       XEXP(operands[1],0) = tmp;
7426
+               }
7427
+       }
7428
+       }
7429 102 dgisselq
+       [(set_attr "ccresult" "unchanged")])
7430 111 dgisselq
+(define_insn "movsi_raw"
7431
+       [(set (match_operand:SI 0 "zip_movdst_operand_p" "=r,Q,r,r")
7432
+               (match_operand:SI 1 "zip_movsrc_operand_p" "r,r,Q,i"))]
7433 122 dgisselq
+       "(register_operand(operands[0],SImode))||(register_operand(operands[1],SImode))"
7434 111 dgisselq
+       "@
7435
+       MOV\t%1,%0
7436
+       STO\t%1,%0
7437
+       LOD\t%1,%0
7438
+       LDI\t%1,%0"
7439
+       [(set_attr "ccresult" "unchanged")])
7440 102 dgisselq
+(define_insn "mov<mode>_reg"   ; Register to register move
7441
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7442
+               (match_operand:ZI 1 "register_operand" "r"))]
7443
+       ""
7444
+       "MOV    %1,%0"
7445
+       [(set_attr "ccresult" "unchanged")])
7446 124 dgisselq
+(define_insn "mov<mode>_reg_off" ; Register to register move, used by prologue
7447 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7448
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
7449 111 dgisselq
+                       (match_operand:ZI 2 "zip_mvimm_operand_p" "M")))
7450
+               ]
7451 102 dgisselq
+       ""
7452
+       "MOV    %2(%1),%0"
7453
+       [(set_attr "ccresult" "unchanged")])
7454 103 dgisselq
+;(define_insn "mov<mode>_lod"  ; Load from memory
7455
+;      [(set (match_operand:ZI 0 "register_operand" "=r")
7456
+;              (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7457
+;      ""
7458
+;      "LOD    %1,%0"
7459
+;      [(set_attr "ccresult" "unchanged")])
7460
+;(define_insn "mov<mode>_sto"  ; Store into memory
7461
+;      [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7462
+;              (match_operand:ZI 1 "register_operand" "r"))]
7463
+;      ""
7464
+;      "STO    %1,%0"
7465
+;      [(set_attr "ccresult" "unchanged")])
7466
+(define_expand "mov<mode>_lod" ; Load from memory
7467 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7468
+               (match_operand:ZI 1 "zip_memory_operand_p" "Q"))]
7469 103 dgisselq
+       "")
7470
+(define_insn "*movsi_lod"
7471
+       [(set (match_operand:SI 0 "register_operand" "=r")
7472 111 dgisselq
+               (match_operand:SI 1 "zip_memory_operand_p" ""))]
7473 102 dgisselq
+       ""
7474 103 dgisselq
+       "LOD\t%1,%0"
7475
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7476 124 dgisselq
+(define_insn "movsi_lod_off" ; used by epilogue code
7477
+       [(set (match_operand:SI 0 "register_operand" "=r")
7478
+               (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
7479
+                       (match_operand:SI 2 "const_int_operand" "N"))))]
7480
+       ""
7481
+       "LOD\t%2(%1),%0"
7482
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7483 103 dgisselq
+(define_expand "mov<mode>_sto" ; Store into memory
7484 102 dgisselq
+       [(set (match_operand:ZI 0 "zip_memory_operand_p" "=Q")
7485
+               (match_operand:ZI 1 "register_operand" "r"))]
7486 103 dgisselq
+       "")
7487
+(define_insn "*movsi_sto"
7488 111 dgisselq
+       [(set (match_operand:SI 0 "zip_memory_operand_p" "=Q")
7489 103 dgisselq
+               (match_operand:SI 1 "register_operand" "r"))]
7490 102 dgisselq
+       ""
7491 111 dgisselq
+       "STO\t%1,%0"
7492 103 dgisselq
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7493 124 dgisselq
+(define_insn "movsi_sto_off" ; used by prologue code
7494
+       [(set (mem:SI (plus:SI
7495
+                       (match_operand:SI 0 "register_operand" "r")
7496
+                       (match_operand:SI 1 "const_int_operand" "N")))
7497
+               (match_operand:SI 2 "register_operand" "r"))]
7498
+       ""
7499
+       "STO\t%2,%1(%0)"
7500
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
7501 102 dgisselq
+(define_insn "mov<mode>_ldi"   ; Load immediate
7502
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7503
+               (match_operand:ZI 1 "immediate_operand" "ipU"))]
7504
+       ""
7505
+       "LDI    %1,%0"
7506
+       [(set_attr "ccresult" "unchanged")])
7507
+;
7508
+;
7509
+;
7510
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7511
+;;
7512
+;; Load and store multiple values
7513
+;;
7514
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7515
+;
7516
+; So far, from the code I've seen from GCC's output,
7517
+; these instructions do not appear to be necessary.
7518
+;
7519
+;(define_insn "load_multiple"
7520
+;      for(a=0; a<%2; a++)
7521
+;              LOD a(%1),%0+a
7522
+;(define_insn "store_multiple"
7523
+;      for(a=0; a<%2; a++)
7524
+;              STO %0+a,a(%1)
7525
+; pushsi -- Do not define, compiler will work around it nicely w/o our help
7526
+;
7527
+;
7528
+;
7529
+;
7530
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7531
+;;
7532 127 dgisselq
+;; Substitution Pattern
7533
+;;
7534
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7535
+;
7536
+;
7537
+(define_subst "cc_substitution"
7538
+       ; The pattern may not have any match_dup expressions.
7539
+       [(set (match_operand:SI 0 "" "") (match_operand:SI 1 "" ""))
7540
+               (clobber (reg:CC CC_REG))]
7541
+       ""
7542
+       [(set (match_dup 0) (match_dup 1))
7543
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))
7544
+       ])
7545
+;
7546
+(define_subst_attr "cc_subst" "cc_substitution" "_raw" "_clobber")
7547
+;
7548
+;
7549
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7550
+;;
7551 102 dgisselq
+;; General arithmetic instructions
7552
+;;
7553
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7554
+;
7555
+;
7556
+;
7557
+;
7558 111 dgisselq
+(define_expand "add<mode>3" ; Fastest/best instruction always goes first
7559 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7560 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7561 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7562 127 dgisselq
+       ])
7563
+(define_insn_and_split "add<mode>3_split_reg"
7564
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7565
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7566
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7567
+       ""
7568
+       "#"     ; This code means the instruction *must* be split
7569
+       "(reload_completed)&&(REG_P(operands[0]))&&(REG_P(operands[1]))&&(REGNO(operands[0])==REGNO(operands[1]))"
7570
+       [(parallel [(set (match_dup 0) (plus:ZI (match_dup 1) (match_dup 2)))
7571
+               (clobber (reg:CC CC_REG))])]
7572
+       ""
7573
+       [(set_attr "predicable" "yes")])
7574
+(define_insn_and_split "add<mode>3_split_off"
7575
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7576
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7577
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7578
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7579
+       ""
7580
+       "#"     ; This code means the instruction *must* be split
7581
+       "(reload_completed)&&(REG_P(operands[0]))&&(REG_P(operands[1]))&&(REGNO(operands[0])==REGNO(operands[1]))"
7582
+       [(parallel [(set (match_dup 0) (plus:ZI (match_dup 1)
7583
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7584
+               (clobber (reg:CC CC_REG))])]
7585
+       ""
7586
+       [(set_attr "predicable" "yes")])
7587
+(define_insn "addsi3_reg_clobber"
7588 122 dgisselq
+       [(set (match_operand:SI 0 "register_operand" "=r")
7589
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7590
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7591 127 dgisselq
+       (clobber (reg:CC CC_REG))]
7592
+       ""
7593
+       "ADD    %2,%0"
7594
+       [(set_attr "ccresult" "set")])
7595
+(define_insn "addsi3_reg_raw"
7596
+       [(set (match_operand:SI 0 "register_operand" "=r")
7597
+               (plus:SI (match_operand:SI 1 "register_operand" "0")
7598
+                       (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7599 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7600 102 dgisselq
+       ""
7601
+       "ADD    %2,%0"
7602
+       [(set_attr "ccresult" "set")])
7603 127 dgisselq
+(define_insn "add<mode>3_off_raw"
7604 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7605 103 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7606
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7607 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7608
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7609 102 dgisselq
+       ""
7610
+       "ADD    %3+%2,%0"
7611
+       [(set_attr "ccresult" "set")])
7612 127 dgisselq
+(define_insn "add<mode>3_off_clobber"
7613
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7614
+               (plus:ZI (match_operand:ZI 1 "register_operand" "0")
7615
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7616
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7617
+       (clobber (reg:CC CC_REG))]
7618
+       ""
7619
+       "ADD    %3+%2,%0"
7620
+       [(set_attr "ccresult" "set")])
7621 102 dgisselq
+;
7622
+;
7623
+;
7624 103 dgisselq
+(define_expand "sub<mode>3"
7625 138 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7626 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7627 138 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
7628 127 dgisselq
+(define_insn_and_split "sub<mode>3_split_reg"
7629 103 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7630
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7631 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7632
+       ""
7633
+       "#"
7634
+       "(reload_completed)"
7635
+       [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1) (match_dup 2)))
7636
+       (clobber (reg:CC CC_REG))])]
7637
+       ""
7638 138 dgisselq
+       [(set_attr "ccresult" "set") (set_attr "predicable" "yes")])
7639 127 dgisselq
+(define_insn "sub<mode>3_reg_raw"
7640
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7641
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7642 111 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7643 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7644 102 dgisselq
+       ""
7645
+       "SUB    %2,%0"
7646
+       [(set_attr "ccresult" "set")])
7647 127 dgisselq
+(define_insn "sub<mode>3_reg_clobber"
7648 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7649 103 dgisselq
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7650 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7651
+       (clobber (reg:CC CC_REG))]
7652
+       ""
7653
+       "SUB    %2,%0"
7654
+       [(set_attr "ccresult" "set")])
7655
+(define_insn_and_split "sub<mode>3_off_split"
7656
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7657
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7658 103 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7659 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7660
+       ""
7661
+       "#"
7662
+       "(reload_completed)"
7663
+       [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1)
7664
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7665
+       (clobber (reg:CC CC_REG))])]
7666
+       ""
7667
+       [(set_attr "ccresult" "set")])
7668
+(define_insn "sub<mode>3_off_raw"
7669
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7670
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7671
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7672 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7673
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7674 102 dgisselq
+       ""
7675
+       "SUB    %3+%2,%0"
7676
+       [(set_attr "ccresult" "set")])
7677 127 dgisselq
+(define_insn "sub<mode>3_off_clobber"
7678
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7679
+               (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7680
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "%r")
7681
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7682
+       (clobber (reg:CC CC_REG))]
7683
+       ""
7684
+       "SUB    %3+%2,%0"
7685
+       [(set_attr "ccresult" "set")])
7686 138 dgisselq
+(define_insn "mul<mode>3_oldstyle"
7687 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7688
+               (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
7689
+                       (match_operand:ZI 2 "register_operand" "r")))
7690 122 dgisselq
+       (clobber (match_scratch:ZI 3 "=r"))
7691
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7692 102 dgisselq
+       ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
7693 138 dgisselq
+       "(!ZIP_LONGMPY)"
7694 102 dgisselq
+       "MOV    %1,%0
7695
+       MPYS    %2,%0
7696
+       MOV     %1,%3
7697
+       ROL     16,%3
7698
+       MPYS    %2,%3
7699
+       ROL     16,%3
7700
+       AND     0x0ffff,%3
7701
+       ADD     %3,%0
7702
+       MOV     %2,%3
7703
+       ROL     16,%3
7704
+       MPYS    %1,%3
7705
+       ROL     16,%3
7706
+       AND     0x0ffff,%3
7707
+       ADD     %3,%0"
7708
+       [(set_attr "ccresult" "unknown")])
7709 138 dgisselq
+;
7710
+;
7711
+(define_expand "mul<mode>3"
7712
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7713
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7714
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))]
7715
+       "(ZIP_LONGMPY)")
7716
+(define_insn_and_split "mul<mode>3_split_reg"
7717
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7718
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7719
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
7720
+       "(ZIP_LONGMPY)"
7721
+       "#"
7722
+       "(reload_completed)"
7723
+       [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1) (match_dup 2)))
7724
+       (clobber (reg:CC CC_REG))])]
7725
+       ""
7726
+       [(set_attr "ccresult" "set")])
7727
+(define_insn_and_split "mul<mode>3_split_off"
7728
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7729
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7730
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7731
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
7732
+       "(ZIP_LONGMPY)"
7733
+       "#"
7734
+       "(reload_completed)"
7735
+       [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1)
7736
+                       (plus:ZI (match_dup 2) (match_dup 3))))
7737
+       (clobber (reg:CC CC_REG))])]
7738
+       ""
7739
+       [(set_attr "ccresult" "set")])
7740
+(define_insn "mul<mode>3_reg_clobber"
7741
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7742
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7743
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7744
+       (clobber (reg:CC CC_REG))]
7745
+       "(ZIP_LONGMPY)"
7746
+       "MPY\t%2,%0"
7747
+       [(set_attr "ccresult" "set")])
7748
+(define_insn "mul<mode>3_reg_raw"
7749
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7750
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7751
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7752
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7753
+       "(ZIP_LONGMPY)"
7754
+       "MPY\t%2,%0"
7755
+       [(set_attr "ccresult" "set")])
7756
+(define_insn "mul<mode>3_off_raw"
7757
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7758
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7759
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7760
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7761
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7762
+       "(ZIP_LONGMPY)"
7763
+       "MPY\t%3+%2,%0"
7764
+       [(set_attr "ccresult" "set")])
7765
+(define_insn "mul<mode>3_off_clobber"
7766
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7767
+               (mult:ZI (match_operand:ZI 1 "register_operand" "0")
7768
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7769
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7770
+       (clobber (reg:CC CC_REG))]
7771
+       "(ZIP_LONGMPY)"
7772
+       "MPY\t%3+%2,%0"
7773
+       [(set_attr "ccresult" "set")])
7774
+;
7775
+;
7776
+(define_expand "smulsi3_highpart"
7777
+       [(set (match_operand:SI 0 "register_operand" "=r")
7778
+           (truncate:SI (ashiftrt:DI (mult:DI
7779
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7780
+               (sign_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
7781
+               (const_int 32))))]
7782
+       "(ZIP_LONGMPY)")
7783
+(define_insn_and_split "smulsi3_highpart_split_reg"
7784
+       [(set (match_operand:SI 0 "register_operand" "=r")
7785
+           (truncate:SI (ashiftrt:DI (mult:DI
7786
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7787
+               (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7788
+               (const_int 32))))]
7789
+       "(ZIP_LONGMPY)"
7790
+       "#"
7791
+       "(reload_completed)"
7792
+       [(parallel [(set (match_dup 0)
7793
+               (truncate:SI (ashiftrt:DI
7794
+                       (mult:DI
7795
+                               (sign_extend:DI (match_dup 1))
7796
+                               (sign_extend:DI (match_dup 2)))
7797
+                       (const_int 32))))
7798
+       (clobber (reg:CC CC_REG))])]
7799
+       ""
7800
+       [(set_attr "ccresult" "set")])
7801
+(define_insn_and_split "smulsi3_highpart_split_off"
7802
+       [(set (match_operand:SI 0 "register_operand" "=r")
7803
+          (truncate:SI (ashift:DI (mult:DI
7804
+               (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7805
+               (sign_extend:DI
7806
+                       (plus:SI (match_operand:SI 2 "register_operand" "r")
7807
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7808
+                       (const_int 32))))]
7809
+       "(ZIP_LONGMPY)"
7810
+       "#"
7811
+       "(reload_completed)"
7812
+       [(parallel [(set (match_dup 0)
7813
+               (truncate:SI (ashiftrt:DI
7814
+                       (mult:SI
7815
+                               (sign_extend:DI (match_dup 1))
7816
+                               (sign_extend:DI
7817
+                                       (plus:SI (match_dup 2) (match_dup 3))))
7818
+                       (const_int 32))))
7819
+       (clobber (reg:CC CC_REG))])]
7820
+       ""
7821
+       [(set_attr "ccresult" "set")])
7822
+(define_insn "smulsi3_highpart_reg_clobber"
7823
+       [(set (match_operand:SI 0 "register_operand" "=r")
7824
+            (truncate:SI (ashiftrt:DI
7825
+               (mult:SI
7826
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7827
+                 (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7828
+               (const_int 32))))
7829
+       (clobber (reg:CC CC_REG))]
7830
+       "(ZIP_LONGMPY)"
7831
+       "MPYSHI\t%2,%0"
7832
+       [(set_attr "ccresult" "set")])
7833
+(define_insn "smulsi3_highpart_reg_raw"
7834
+       [(set (match_operand:SI 0 "register_operand" "=r")
7835
+           (truncate:SI (ashiftrt:DI
7836
+               (mult:SI
7837
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7838
+                 (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7839
+               (const_int 32))))
7840
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7841
+       "(ZIP_LONGMPY)"
7842
+       "MPYSHI\t%2,%0"
7843
+       [(set_attr "ccresult" "set")])
7844
+(define_insn "smulsi3_highpart_off_raw"
7845
+       [(set (match_operand:SI 0 "register_operand" "=r")
7846
+           (truncate:SI (ashiftrt:DI
7847
+               (mult:SI
7848
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7849
+                 (sign_extend:DI (plus:SI
7850
+                               (match_operand:SI 2 "register_operand" "r")
7851
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7852
+               (const_int 32))))
7853
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7854
+       "(ZIP_LONGMPY)"
7855
+       "MPYSHI\t%3+%2,%0"
7856
+       [(set_attr "ccresult" "set")])
7857
+(define_insn "smulsi3_highpart_off_clobber"
7858
+       [(set (match_operand:SI 0 "register_operand" "=r")
7859
+           (truncate:SI (ashiftrt:DI
7860
+               (mult:SI
7861
+                 (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
7862
+                 (sign_extend:DI (plus:SI
7863
+                       (match_operand:SI 2 "register_operand" "r")
7864
+                       (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7865
+               (const_int 32))))
7866
+       (clobber (reg:CC CC_REG))]
7867
+       "(ZIP_LONGMPY)"
7868
+       "MPYSHI\t%3+%2,%0"
7869
+       [(set_attr "ccresult" "set")])
7870
+;
7871
+;
7872
+(define_expand "umulsi3_highpart"
7873
+       [(set (match_operand:SI 0 "register_operand" "=r")
7874
+           (truncate:SI (ashiftrt:DI (mult:DI
7875
+               (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7876
+               (zero_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
7877
+               (const_int 32))))]
7878
+       "(ZIP_LONGMPY)")
7879
+(define_insn_and_split "umulsi3_highpart_split_reg"
7880
+       [(set (match_operand:SI 0 "register_operand" "=r")
7881
+           (truncate:SI (ashiftrt:DI (mult:DI
7882
+               (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7883
+               (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7884
+               (const_int 32))))]
7885
+       "(ZIP_LONGMPY)"
7886
+       "#"
7887
+       "(reload_completed)"
7888
+       [(parallel [(set (match_dup 0)
7889
+               (truncate:SI (ashiftrt:DI
7890
+                       (mult:SI
7891
+                               (zero_extend:DI (match_dup 1))
7892
+                               (zero_extend:DI (match_dup 2)))
7893
+                       (const_int 32))))
7894
+       (clobber (reg:CC CC_REG))])]
7895
+       ""
7896
+       [(set_attr "ccresult" "set")])
7897
+(define_insn_and_split "umulsi3_highpart_split_off"
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
7903
+                       (plus:SI (match_operand:SI 2 "register_operand" "r")
7904
+                               (match_operand:SI 3 "zip_opb_immv_p" "N"))))
7905
+               (const_int 32))))]
7906
+       "(ZIP_LONGMPY)"
7907
+       "#"
7908
+       "(reload_completed)"
7909
+       [(parallel [(set (match_dup 0)
7910
+               (truncate:SI (ashiftrt:DI
7911
+                       (mult:DI
7912
+                               (zero_extend:DI (match_dup 1))
7913
+                               (zero_extend:DI
7914
+                                       (plus:SI (match_dup 2) (match_dup 3))))
7915
+                       (const_int 32))))
7916
+       (clobber (reg:CC CC_REG))])]
7917
+       ""
7918
+       [(set_attr "ccresult" "set")])
7919
+(define_insn "umulsi3_highpart_reg_clobber"
7920
+       [(set (match_operand:SI 0 "register_operand" "=r")
7921
+           (truncate:SI (ashiftrt:DI
7922
+               (mult:DI
7923
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7924
+                   (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7925
+               (const_int 32))))
7926
+       (clobber (reg:CC CC_REG))]
7927
+       "(ZIP_LONGMPY)"
7928
+       "MPYSHI\t%2,%0"
7929
+       [(set_attr "ccresult" "set")])
7930
+(define_insn "umulsi3_highpart_reg_raw"
7931
+       [(set (match_operand:SI 0 "register_operand" "=r")
7932
+           (truncate:SI (ashiftrt:DI
7933
+               (mult:DI
7934
+                  (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7935
+                  (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
7936
+               (const_int 32))))
7937
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7938
+       "(ZIP_LONGMPY)"
7939
+       "MPYSHI\t%2,%0"
7940
+       [(set_attr "ccresult" "set")])
7941
+(define_insn "umulsi3_highpart_off_raw"
7942
+       [(set (match_operand:SI 0 "register_operand" "=r")
7943
+           (truncate:SI (ashiftrt:DI
7944
+               (mult:DI
7945
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7946
+                   (zero_extend:DI (plus:SI
7947
+                               (match_operand:SI 2 "register_operand" "r")
7948
+                               (match_operand:DI 3 "zip_opb_immv_p" "N"))))
7949
+               (const_int 32))))
7950
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7951
+       "(ZIP_LONGMPY)"
7952
+       "MPYSHI\t%3+%2,%0"
7953
+       [(set_attr "ccresult" "set")])
7954
+(define_insn "umulsi3_highpart_off_clobber"
7955
+       [(set (match_operand:SI 0 "register_operand" "=r")
7956
+           (truncate:SI (ashiftrt:DI
7957
+               (mult:DI
7958
+                   (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
7959
+                   (zero_extend:DI (plus:SI
7960
+                       (match_operand:SI 2 "register_operand" "r")
7961
+                       (match_operand:DI 3 "zip_opb_immv_p" "N"))))
7962
+               (const_int 32))))
7963
+       (clobber (reg:CC CC_REG))]
7964
+       "(ZIP_LONGMPY)"
7965
+       "MPYSHI\t%3+%2,%0"
7966
+       [(set_attr "ccresult" "set")])
7967
+;
7968
+;
7969 111 dgisselq
+(define_expand "div<mode>3"
7970 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7971 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7972 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7973
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7974 111 dgisselq
+       "(ZIP_DIVIDE)")
7975
+(define_insn "div<mode>3_reg"
7976
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7977
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7978 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
7979
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7980 111 dgisselq
+       "(ZIP_DIVIDE)"
7981 102 dgisselq
+       "DIVS   %2,%0"
7982
+       [(set_attr "ccresult" "set")])
7983
+(define_insn "div<mode>3_off"
7984
+       [(set (match_operand:ZI 0 "register_operand" "=r")
7985 103 dgisselq
+               (div:ZI (match_operand:ZI 1 "register_operand" "0")
7986
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
7987 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
7988
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
7989 111 dgisselq
+       "(ZIP_DIVIDE)"
7990 102 dgisselq
+       "DIVS   %3+%2,%0"
7991
+       [(set_attr "ccresult" "set")])
7992 111 dgisselq
+(define_expand "udiv<mode>3"
7993 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
7994 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
7995 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
7996
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
7997 111 dgisselq
+       "(ZIP_DIVIDE)")
7998
+(define_insn "udiv<mode>3_reg"
7999
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8000
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
8001 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8002
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8003 111 dgisselq
+       "(ZIP_DIVIDE)"
8004 102 dgisselq
+       "DIVU   %2,%0"
8005
+       [(set_attr "ccresult" "set")])
8006
+(define_insn "udiv<mode>3_off"
8007
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8008 103 dgisselq
+               (udiv:ZI (match_operand:ZI 1 "register_operand" "0")
8009
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8010 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8011
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8012 111 dgisselq
+       "(ZIP_DIVIDE)"
8013 102 dgisselq
+       "DIVU   %3+%2,%0"
8014
+       [(set_attr "ccresult" "set")])
8015
+;;
8016
+;; modsi3
8017
+;; umodsi3
8018
+;;
8019
+(define_insn "umin<mode>3"
8020
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8021
+               (umin:ZI (match_operand:ZI 1 "register_operand" "%0")
8022
+                       (match_operand:ZI 2 "register_operand" "r")))
8023 122 dgisselq
+       (clobber (reg:CC CC_REG))
8024 102 dgisselq
+       ]
8025
+       ""
8026
+       "CMP    %0,%2
8027
+       MOV.C   %2,%0"
8028
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8029
+(define_insn "umax<mode>3"
8030
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8031
+               (umax:ZI (match_operand:ZI 1 "register_operand" "%0")
8032
+                       (match_operand:ZI 2 "register_operand" "r")))
8033 122 dgisselq
+       (clobber (reg:CC CC_REG))
8034 102 dgisselq
+       ]
8035
+       ""
8036
+       "CMP    %2,%0
8037
+       MOV.C   %2,%0"
8038
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8039
+(define_insn "smin<mode>3"
8040
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8041
+               (smin:ZI (match_operand:ZI 1 "register_operand" "%0")
8042
+                       (match_operand:ZI 2 "register_operand" "r")))
8043 122 dgisselq
+       (clobber (reg:CC CC_REG))
8044 102 dgisselq
+       ]
8045
+       ""
8046
+       "CMP    %2,%0
8047
+       MOV.GT  %2,%0"
8048
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8049
+(define_insn "smax<mode>3"
8050
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8051
+               (smax:ZI (match_operand:ZI 1 "register_operand" "%0")
8052
+                       (match_operand:ZI 2 "register_operand" "r")))
8053 122 dgisselq
+       (clobber (reg:CC CC_REG))
8054 102 dgisselq
+       ]
8055
+       ""
8056
+       "CMP    %0,%2
8057
+       MOV.LT  %2,%0"
8058
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8059 127 dgisselq
+;
8060
+;
8061 111 dgisselq
+(define_expand "and<mode>3"
8062 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8063 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8064 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
8065
+(define_insn_and_split "and<mode>3_reg_split"
8066 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8067
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8068 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8069
+       ""
8070
+       "#"
8071
+       "(reload_completed)"
8072
+       [(parallel [(set (match_dup 0) (and:ZI (match_dup 1) (match_dup 2)))
8073
+       (clobber (reg:CC CC_REG))])]
8074
+       ""
8075
+       [(set_attr "ccresult" "set")])
8076
+(define_insn "and<mode>3_reg_raw"
8077
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8078
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8079 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8080
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8081 102 dgisselq
+       ""
8082
+       "AND    %2,%0"
8083
+       [(set_attr "ccresult" "set")])
8084 127 dgisselq
+(define_insn "and<mode>3_reg_clobber"
8085 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8086 127 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "%0")
8087
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8088
+       (clobber (reg:CC CC_REG))]
8089
+       ""
8090
+       "AND    %2,%0"
8091
+       [(set_attr "ccresult" "set")])
8092
+(define_insn_and_split "and<mode>3_off_split"
8093
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8094 102 dgisselq
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8095
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8096 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8097
+       ""
8098
+       "#"
8099
+       "(reload_completed)"
8100
+       [(parallel [(set (match_dup 0) (and:ZI (match_dup 1)
8101
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8102
+       (clobber (reg:CC CC_REG))])]
8103
+       ""
8104
+       [(set_attr "ccresult" "set")])
8105
+(define_insn "and<mode>3_off_raw"
8106
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8107
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8108
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8109 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8110
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8111 102 dgisselq
+       ""
8112
+       "AND    %3+%2,%0"
8113
+       [(set_attr "ccresult" "set")])
8114 127 dgisselq
+(define_insn "and<mode>3_off_clobber"
8115
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8116
+               (and:ZI (match_operand:ZI 1 "register_operand" "0")
8117
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8118
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8119
+       (clobber (reg:CC CC_REG))]
8120
+       ""
8121
+       "AND    %3+%2,%0"
8122
+       [(set_attr "ccresult" "set")])
8123
+;
8124
+;
8125 111 dgisselq
+(define_expand "ior<mode>3"
8126 127 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8127 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8128 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))])
8129
+(define_insn_and_split "ior<mode>3_reg_split"
8130 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8131
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8132 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8133
+       ""
8134
+       "#"
8135
+       "(reload_completed)"
8136
+       [(parallel [(set (match_dup 0) (ior:ZI (match_dup 1) (match_dup 2)))
8137
+       (clobber (reg:CC CC_REG))])]
8138
+       ""
8139
+       [(set_attr "ccresult" "set")])
8140
+(define_insn "ior<mode>3_reg_raw"
8141
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8142
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8143 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8144
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8145 102 dgisselq
+       ""
8146
+       "OR     %2,%0"
8147
+       [(set_attr "ccresult" "set")])
8148 127 dgisselq
+(define_insn "ior<mode>3_reg_clobber"
8149 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8150 127 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "%0")
8151
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8152
+       (clobber (reg:CC CC_REG))]
8153
+       ""
8154
+       "OR     %2,%0"
8155
+       [(set_attr "ccresult" "set")])
8156
+(define_insn_and_split "ior<mode>3_off_split"
8157
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8158 102 dgisselq
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8159
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8160 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8161
+       ""
8162
+       "#"
8163
+       "(reload_completed)"
8164
+       [(parallel [(set (match_dup 0) (ior:ZI (match_dup 1)
8165
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8166
+       (clobber (reg:CC CC_REG))])]
8167
+       ""
8168
+       [(set_attr "ccresult" "set")])
8169
+(define_insn "ior<mode>3_off_raw"
8170
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8171
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8172
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8173 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8174
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8175 102 dgisselq
+       ""
8176
+       "OR     %3+%2,%0"
8177
+       [(set_attr "ccresult" "set")])
8178 127 dgisselq
+(define_insn "ior<mode>3_off_clobber"
8179
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8180
+               (ior:ZI (match_operand:ZI 1 "register_operand" "0")
8181
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8182
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8183
+       (clobber (reg:CC CC_REG))]
8184
+       ""
8185
+       "OR     %3+%2,%0"
8186
+       [(set_attr "ccresult" "set")])
8187
+;
8188
+;
8189
+;
8190 111 dgisselq
+(define_expand "xor<mode>3"
8191 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
8192 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8193 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_operand_p" "")))
8194
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])]
8195
+       "")
8196 127 dgisselq
+(define_insn_and_split "xor<mode>3_reg_split"
8197 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8198
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8199 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
8200
+       ""
8201
+       "#"
8202
+       "(reload_completed)"
8203
+       [(parallel [(set (match_dup 0) (xor:ZI (match_dup 1) (match_dup 2)))
8204
+       (clobber (reg:CC CC_REG))])]
8205
+       ""
8206
+       [(set_attr "ccresult" "set")])
8207
+(define_insn "xor<mode>3_reg_raw"
8208
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8209
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8210 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8211
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8212 102 dgisselq
+       ""
8213
+       "XOR    %2,%0"
8214
+       [(set_attr "ccresult" "set")])
8215 127 dgisselq
+(define_insn "xor<mode>3_reg_clobber"
8216 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8217 127 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "%0")
8218
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
8219
+       (clobber (reg:CC CC_REG))]
8220
+       ""
8221
+       "XOR    %2,%0"
8222
+       [(set_attr "ccresult" "set")])
8223
+(define_insn_and_split "xor<mode>3_off_split"
8224
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8225 102 dgisselq
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8226
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8227 127 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
8228
+       ""
8229
+       "#"
8230
+       "(reload_completed)"
8231
+       [(parallel [(set (match_dup 0) (xor:ZI (match_dup 1)
8232
+                       (plus:ZI (match_dup 2) (match_dup 3))))
8233
+       (clobber (reg:CC CC_REG))])]
8234
+       ""
8235
+       [(set_attr "ccresult" "set")])
8236
+(define_insn "xor<mode>3_off_raw"
8237
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8238
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8239
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8240 122 dgisselq
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8241
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8242 102 dgisselq
+       ""
8243
+       "XOR    %3+%2,%0"
8244
+       [(set_attr "ccresult" "set")])
8245 127 dgisselq
+(define_insn "xor<mode>3_off_clobber"
8246
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8247
+               (xor:ZI (match_operand:ZI 1 "register_operand" "0")
8248
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "r")
8249
+                               (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
8250
+       (clobber (reg:CC CC_REG))]
8251
+       ""
8252
+       "XOR    %3+%2,%0"
8253
+       [(set_attr "ccresult" "set")])
8254 102 dgisselq
+;(define_insn "addv<mode>4"
8255
+       ;[(set (match_operand:ZI 0 "register_operand" "=r")
8256
+               ;(plus:ZI (match_operand:ZI 1 "register_operand" "%r")
8257
+                       ;(match_operand:ZI 2 "general_operand" "rO")))
8258 122 dgisselq
+       ;(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
8259 102 dgisselq
+                       ;(label_ref (match_operand 3))
8260
+                       ;(pc)))]
8261
+       ;""
8262
+       ;"MOV   %1,%0
8263
+       ;ADD    %2,%0
8264
+       ;BV     %3"
8265
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8266
+;;(define_insn "subvsi4"
8267
+;;     MOV     %1,%0
8268
+;;     SUB     %2,%0
8269
+;;     BV      %3
8270
+;;(mulvsi4)
8271
+;;(define_insn "uaddvsi4"
8272
+;;     ADD     %2,%0
8273
+;;     BC      %3
8274
+;;(define_insn "usubvsi4"
8275
+;;     MOV     %1,%0
8276
+;;     SUB     %2,%0
8277
+;;     BC      %3
8278
+;;
8279
+;; (define_insn "umulvsi4"
8280
+;;     ... ???)
8281
+;;
8282 127 dgisselq
+(define_expand "ashr<mode>3"
8283 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8284
+               (ashiftrt: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 "ashr<mode>3_split"
8287
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8288
+               (ashiftrt: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) (ashiftrt:ZI (match_dup 1) (match_dup 2)))
8294
+       (clobber (reg:CC CC_REG))])]
8295
+       ""
8296
+       [(set_attr "ccresult" "set")])
8297
+(define_insn "ashr<mode>3_raw"
8298
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8299
+               (ashiftrt: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 102 dgisselq
+       ""
8303
+       "ASR    %2,%0"
8304
+       [(set_attr "ccresult" "set")])
8305 127 dgisselq
+(define_insn "ashr<mode>3_clobber"
8306 111 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8307 127 dgisselq
+               (ashiftrt: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
+       "ASR    %2,%0"
8312
+       [(set_attr "ccresult" "set")])
8313
+;
8314
+;
8315
+(define_expand "ashl<mode>3"
8316
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8317 111 dgisselq
+               (ashift: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 "ashl<mode>3_split"
8320
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8321
+               (ashift: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) (ashift:ZI (match_dup 1) (match_dup 2)))
8327
+       (clobber (reg:CC CC_REG))])]
8328
+       ""
8329
+       [(set_attr "ccresult" "set")])
8330
+(define_insn "ashl<mode>3_raw"
8331
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8332
+               (ashift:ZI (match_operand:ZI 1 "register_operand" "0")
8333 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8334
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8335 111 dgisselq
+       ""
8336 122 dgisselq
+       "LSL    %2,%0"
8337 111 dgisselq
+       [(set_attr "ccresult" "set")])
8338 127 dgisselq
+(define_insn "ashl<mode>3_clobber"
8339 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8340 127 dgisselq
+               (ashift: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
+       "LSL    %2,%0"
8345
+       [(set_attr "ccresult" "set")])
8346
+;
8347
+;
8348
+(define_expand "lshr<mode>3"
8349
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8350 102 dgisselq
+               (lshiftrt: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 "lshr<mode>3_split"
8353
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8354
+               (lshiftrt: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) (lshiftrt:ZI (match_dup 1) (match_dup 2)))
8360
+       (clobber (reg:CC CC_REG))])]
8361
+       ""
8362
+       [(set_attr "ccresult" "set")])
8363
+(define_insn "lshr<mode>3_raw"
8364
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8365
+               (lshiftrt:ZI (match_operand:ZI 1 "register_operand" "0")
8366
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8367 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8368 102 dgisselq
+       ""
8369
+       "LSR    %2,%0"
8370
+       [(set_attr "ccresult" "set")])
8371 127 dgisselq
+(define_insn "lshr<mode>3_clobber"
8372 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8373 127 dgisselq
+               (lshiftrt: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
+       "LSR    %2,%0"
8378
+       [(set_attr "ccresult" "set")])
8379
+;
8380
+;
8381
+(define_expand "rotl<mode>3"
8382
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8383 102 dgisselq
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8384 127 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))])
8385
+(define_insn_and_split "rotl<mode>3_split"
8386
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8387
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8388
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))]
8389
+       ""
8390
+       "#"
8391
+       "(reload_completed)"
8392
+       [(parallel [(set (match_dup 0) (rotate:ZI (match_dup 1) (match_dup 2)))
8393
+       (clobber (reg:CC CC_REG))])]
8394
+       ""
8395
+       [(set_attr "ccresult" "set")])
8396
+(define_insn "rotl<mode>3_raw"
8397
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8398
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8399 122 dgisselq
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8400
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8401 102 dgisselq
+       ""
8402
+       "ROL    %2,%0"
8403
+       [(set_attr "ccresult" "set")])
8404 127 dgisselq
+(define_insn "rotl<mode>3_clobber"
8405
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8406
+               (rotate:ZI (match_operand:ZI 1 "register_operand" "0")
8407
+                       (match_operand:ZI 2 "zip_opb_single_operand_p" "rR")))
8408
+       (clobber (reg:CC CC_REG))]
8409
+       ""
8410
+       "ROL    %2,%0"
8411
+       [(set_attr "ccresult" "set")])
8412 102 dgisselq
+;
8413 127 dgisselq
+;
8414
+;
8415 102 dgisselq
+(define_insn "neg<mode>2"
8416
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8417
+               (neg:ZI (match_operand:ZI 1 "register_operand" "r")))
8418 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8419 102 dgisselq
+       ""
8420
+       "NEG    %1,%0"
8421
+       [(set_attr "ccresult" "validzn")])
8422
+(define_insn "abs<mode>2"
8423
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8424
+               (abs:ZI (match_operand:ZI 1 "register_operand" "0")))
8425 122 dgisselq
+       (clobber (reg:CC CC_REG))]
8426 102 dgisselq
+       ""
8427
+       "TEST   %0
8428
+       NEG.LT  %0"
8429
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8430
+(define_insn "popcount<mode>2"
8431
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8432
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
8433 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8434 102 dgisselq
+       ""
8435
+       "POPC   %1,%0"
8436
+       [(set_attr "ccresult" "set")])
8437
+(define_expand "parity<mode>2"
8438 122 dgisselq
+       [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
8439 102 dgisselq
+               (popcount:ZI (match_operand:ZI 1 "register_operand" "r")))
8440 127 dgisselq
+               (clobber (reg:CC CC_REG))])
8441 122 dgisselq
+       (parallel [
8442
+               (set (match_dup 0) (and:ZI (match_dup 0) (const_int -2)))
8443
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
8444 102 dgisselq
+       ])
8445
+(define_insn "one_cmpl<mode>2"
8446
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8447
+               (not:ZI (match_operand:ZI 1 "register_operand" "0")))
8448 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
8449 102 dgisselq
+       ""
8450
+       "XOR    -1,%0"
8451
+       [(set_attr "ccresult" "set")])
8452
+;
8453
+;
8454
+;
8455
+;
8456 117 dgisselq
+;
8457 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8458
+;;
8459
+;; General arithmetic instructions -- double words
8460
+;;
8461
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8462
+;
8463
+;
8464
+;
8465 111 dgisselq
+(define_expand "movdi3"
8466
+       [(set (match_operand:DI 0 "nonimmediate_operand" "")
8467
+               (match_operand:DI 1 "general_operand" ""))])
8468
+(define_insn "movdi_lod"
8469
+       [(set (match_operand:DI 0 "register_operand" "=r")
8470 122 dgisselq
+               (mem:DI (match_operand:SI 1 "zip_opb_operand_p" "")))]
8471 111 dgisselq
+       ""
8472
+       {
8473 122 dgisselq
+               if (REG_P(operands[1]))
8474 111 dgisselq
+                       return "LOD\t(%1),%H0\n\tLOD\t1(%1),%L0";
8475 122 dgisselq
+               else if (GET_CODE(operands[1])==PLUS) {
8476
+                       if ((REG_P(XEXP(operands[1],0)))
8477
+                               &&(CONST_INT_P(XEXP(operands[1],1)))) {
8478 111 dgisselq
+                               static  char    buf[64];
8479
+                               sprintf(buf,
8480
+                                       "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
8481 138 dgisselq
+                                       (long)INTVAL(XEXP(operands[1],1)),
8482
+                                       (long)INTVAL(XEXP(operands[1],1)+1));
8483 111 dgisselq
+                               return buf;
8484
+                       }
8485 122 dgisselq
+               } return "BREAK";
8486 111 dgisselq
+       }
8487
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8488
+(define_insn "movdi_sto"
8489
+       [(set (mem:DI (match_operand:SI 0 "zip_opb_operand_p" ""))
8490
+               (match_operand:DI 1 "register_operand" "r"))]
8491
+       ""
8492
+       {
8493
+               if (REG_P(operands[0]))
8494
+                       return "STO\t%H0,(%1)\n\tSTO\t%L0,1(%1)";
8495
+               else if (GET_CODE(operands[0])==PLUS) {
8496
+                       if ((REG_P(XEXP(operands[0],0)))
8497
+                               &&(CONST_INT_P(XEXP(operands[0],1)))) {
8498
+                               static  char    buf[64];
8499
+                               sprintf(buf,
8500
+                                       "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
8501 138 dgisselq
+                                       (long)INTVAL(XEXP(operands[0],1)),
8502
+                                       (long)INTVAL(XEXP(operands[0],1)+1));
8503 111 dgisselq
+                               return buf;
8504
+                       }
8505 127 dgisselq
+               } return "BREAK";
8506 111 dgisselq
+       }
8507
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8508
+(define_insn "movdi_ldi"
8509
+       [(set (match_operand:DI 0 "register_operand" "=r")
8510
+               (match_operand:DI 1 "immediate_operand" "i"))]
8511
+       ""
8512
+       "LDI\t%H1,%H0\n\tLDI\t%L1,%L0"
8513
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8514 102 dgisselq
+(define_insn "adddi3" ; Fastest/best instruction always goes first
8515
+       [(set (match_operand:DI 0 "register_operand" "=r")
8516 103 dgisselq
+               (plus:DI (match_operand:DI 1 "register_operand" "0")
8517 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
8518 122 dgisselq
+       (clobber (reg:CC CC_REG))
8519 102 dgisselq
+       ]
8520
+       ""
8521
+       "ADD    %L2,%L0\n\tADD.C\t1,%H0\n\tADD\t%H2,%H0"
8522
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8523
+;
8524
+(define_insn "subdi3"
8525
+       [(set (match_operand:DI 0 "register_operand" "=r")
8526 103 dgisselq
+               (minus:DI (match_operand:DI 1 "register_operand" "0")
8527 102 dgisselq
+                       (match_operand:DI 2 "register_operand" "r")))
8528 122 dgisselq
+       (clobber (reg:CC CC_REG))
8529 102 dgisselq
+       ]
8530
+       ""
8531
+       "SUB    %L2,%L0\n\tSUB.C\t1,%H0\n\tSUB\t%H2,%H0"
8532
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8533
+;
8534
+(define_insn "anddi3"
8535
+       [(set (match_operand:DI 0 "register_operand" "=r")
8536
+               (and:DI (match_operand:DI 1 "register_operand" "%0")
8537
+                       (match_operand:DI 2 "register_operand" "r")))
8538 122 dgisselq
+       (clobber (reg:CC CC_REG))
8539 102 dgisselq
+       ]
8540
+       ""
8541
+       "AND    %L2,%L0\n\tAND\t%H2,%H0"
8542
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8543
+;
8544
+(define_insn "iordi3"
8545
+       [(set (match_operand:DI 0 "register_operand" "=r")
8546
+               (ior:DI (match_operand:DI 1 "register_operand" "%0")
8547
+                       (match_operand:DI 2 "register_operand" "r")))
8548 122 dgisselq
+       (clobber (reg:CC CC_REG))
8549 102 dgisselq
+       ]
8550
+       ""
8551
+       "OR     %2,%0\n\tOR\t%H2,%H0"
8552
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8553
+;
8554
+(define_insn "xordi3"
8555
+       [(set (match_operand:DI 0 "register_operand" "=r")
8556
+               (xor:DI (match_operand:DI 1 "register_operand" "%0")
8557
+                       (match_operand:DI 2 "register_operand" "r")))
8558 122 dgisselq
+       (clobber (reg:CC CC_REG))
8559 102 dgisselq
+       ]
8560
+       ""
8561
+       "XOR    %2,%0\n\tXOR\t%H2,%H0"
8562
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8563
+;
8564
+(define_insn "negdi2"
8565
+       [(set (match_operand:DI 0 "register_operand" "=r")
8566 122 dgisselq
+               (neg:DI (match_operand:DI 1 "register_operand" "0")))
8567
+       (clobber (reg:CC CC_REG))
8568
+       ]
8569 102 dgisselq
+       ""
8570
+       "XOR    -1,%L0\n\tXOR\t-1,%H0\n\tADD\t1,%L0\n\tADD.C\t1,%H0"
8571
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8572
+;
8573
+(define_insn "absdi2"
8574 122 dgisselq
+       [(set (match_operand:DI 0 "register_operand" "=r")
8575
+               (abs:DI (match_operand:DI 1 "register_operand" "0")))
8576
+       (clobber (match_scratch:SI 2 "=r"))
8577
+       (clobber (reg:CC CC_REG))
8578
+       ]
8579 102 dgisselq
+       ""
8580
+       "CLR    %2
8581
+       TEST    %H0             ; Problem, we can't tell conditions
8582
+       LDILO.LT        1,%2
8583
+       XOR.LT  -1,%L0
8584
+       XOR.LT  -1,%H0
8585
+       ADD     %2,%L0
8586 122 dgisselq
+       ADD.C   1,%H0"
8587 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8588
+(define_insn "one_cmpldi2"
8589
+       [(set (match_operand:DI 0 "register_operand" "=r")
8590
+               (not:DI (match_operand:DI 1 "register_operand" "0")))
8591 122 dgisselq
+       (clobber (reg:CC CC_REG))
8592 102 dgisselq
+       ]
8593
+       ""
8594
+       "XOR    -1,%L0\n\tXOR\t-1,%H0"
8595
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8596
+(define_insn "umindi3"
8597
+       [(set (match_operand:DI 0 "register_operand" "=r")
8598
+               (umin:DI (match_operand:DI 1 "register_operand" "%0")
8599
+                       (match_operand:DI 2 "register_operand" "r")))
8600 122 dgisselq
+       (clobber (reg:CC CC_REG))
8601 102 dgisselq
+       ]
8602
+       ""
8603
+       "CMP    %H0,%H2
8604
+       CMP.Z   %L0,%L2
8605
+       MOV.C   %H2,%H0
8606
+       MOV.C   %L2,%L0"
8607
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8608
+(define_insn "umaxdi3"
8609
+       [(set (match_operand:DI 0 "register_operand" "=r")
8610
+               (umax:DI (match_operand:DI 1 "register_operand" "%0")
8611
+                       (match_operand:DI 2 "register_operand" "r")))
8612 122 dgisselq
+       (clobber (reg:CC CC_REG))
8613 102 dgisselq
+       ]
8614
+       ""
8615
+       "CMP    %H2,%H0
8616
+       CMP.Z   %L2,%L0
8617
+       MOV.C   %H2,%H0
8618
+       MOV.C   %L2,%L0"
8619
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8620
+(define_insn "popcountdi2"
8621
+       [(set (match_operand:SI 0 "register_operand" "=r")
8622 122 dgisselq
+               (popcount:SI (match_operand:DI 1 "register_operand" "r")))
8623 102 dgisselq
+       (clobber (match_scratch:SI 2 "=r"))
8624 122 dgisselq
+       (clobber (reg:CC CC_REG))
8625 102 dgisselq
+       ]
8626
+       ""
8627
+       "POPC   %L1,%0
8628
+       POPC    %H1,%2
8629
+       ADD     %2,%0"
8630
+       [(set_attr "predicable" "no") (set_attr "ccresult" "set")])
8631
+(define_expand "paritydi2"
8632
+       [(set (match_operand:SI 0 "register_operand" "=r")
8633
+               (popcount (match_operand:DI 1 "register_operand" "r")))
8634
+       (set (match_dup 0) (and:SI (match_dup 0) (const_int -2)))
8635
+       ])
8636 117 dgisselq
+;(define_insn "extendsidi2"
8637
+;      [(set (match_operand:DI 0 "register_operand" "=r")
8638
+;              (sign_extend:DI (match_operand:SI 0 "register_operand" "r")))]
8639
+;      ""
8640
+;      "TEST\t%1\nMOV\t%1,%L0\nCLR\t%L1\nLDI.LT\t-1,%L1"
8641
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8642
+;(define_insn "mulsidi3"
8643
+;      [(set (match_operand:DI 0 "register_operand" "=r")
8644
+;              (mult:SI (match_operand:SI 1 "register_operand" "%r")
8645
+;                      (match_operand:SI 2 "register_operand" "r")))
8646
+;      (clobber (match_scratch:SI 3 "=r"))]
8647
+;      ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
8648
+;      ""
8649
+;      "MOV    %1,%L0
8650
+;      MPYS    %2,%L0                  ; L0 = R2 * R1
8651
+;      MOV     %1,%3                   ; R3 = R1
8652
+;      ROL     16,%3                   ; R3 = (R1 <<< 16)
8653
+;      MPYS    %2,%3                   ; R3 = (R1 <<< 16) * R2
8654
+;      ROL     16,%3                   ; R3 = upper bits of (R1<<<16)*R2
8655
+;      AND     0x0ffff,%3
8656
+;      ADD     %3,%L0                  ; L0 = L0 + R3 = L0  + (R1>>16)*R2
8657
+;      MOV     %2,%3
8658
+;      ROL     16,%3
8659
+;      MPYS    %1,%3
8660
+;      ROL     16,%3
8661
+;      AND     0x0ffff,%3
8662
+;      ADD     %3,%0"
8663
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8664
+
8665 102 dgisselq
+;
8666
+; Still missing DI instructions for smin:DI, smax:DI, movdicc, adddicc,
8667
+;      mult:di, div:di, divu:di
8668
+;
8669
+;
8670
+;
8671
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8672
+;;
8673
+;; Conditional arithmetic instructions
8674
+;;
8675
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8676
+;
8677
+;
8678
+;
8679
+;
8680
+(define_expand "cstore<mode>4" ; Store 0 or 1 in %0 based on cmp between %2&%3
8681 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 2 "register_operand" "r")
8682
+               (match_operand:ZI 3 "zip_opb_operand_p" "rO")))
8683 102 dgisselq
+       (set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8684
+                       (match_operator 1 "ordered_comparison_operator"
8685 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
8686 102 dgisselq
+                       (const_int 1) (const_int 0)))]
8687
+       ""
8688
+       )
8689
+(define_insn "cstoredi4" ; Store 0 or 1 in %0 based on cmp between %2&%3
8690
+       [(set (match_operand:SI 0 "register_operand" "=r")
8691
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
8692 122 dgisselq
+                       [(match_operand:DI 2 "register_operand" "r")
8693
+                               (match_operand:DI 3 "register_operand" "r")])
8694
+                       (const_int 1) (const_int 0)))
8695
+       (clobber (reg:CC CC_REG))]
8696 102 dgisselq
+       ""
8697
+       {
8698
+               switch(GET_CODE(operands[1])) {
8699
+               case EQ:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.Z\t1,%0\n";
8700
+               case NE:        return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.NZ\t%L3,%L2\n\tLDILO.NZ\t1,%0\n";
8701
+               case LTU:       return "CLR\t%0\n\tCMP\t%H3,%H2\n\tCMP.Z\t%L3,%L2\n\tLDILO.C\t1,%0\n";
8702
+               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";
8703
+               case GTU:       return "CLR\t%0\n\tCMP\t%H2,%H3\n\tCMP.Z\t%L2,%L3\n\tLDILO.C\t1,%0\n";
8704
+               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";
8705
+               default:
8706
+                       gcc_unreachable();
8707
+               }
8708
+       }
8709
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8710
+;
8711
+;
8712
+;
8713
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8714
+;;
8715
+;; Comparison instructions, both compare and test
8716
+;;
8717
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8718
+;
8719
+;
8720
+;
8721
+;; This will only work so well, since the direction of the compare is
8722
+;; important in unsigned compares.
8723
+;;
8724 122 dgisselq
+(define_expand "cmp<mode>"
8725
+       [(set (reg:CC CC_REG) (compare:CC
8726
+               (match_operand:ZI 0 "register_operand" "r")
8727
+               (match_operand:ZI 1 "nonmemory_operand" "")))]
8728 102 dgisselq
+       ""
8729 122 dgisselq
+       {
8730
+               if (!zip_opb_operand_p(operands[1],SImode)) {
8731
+                       if (can_create_pseudo_p()) {
8732
+                               //; fprintf(stderr, "Generating pseudo register for compare\n");
8733
+                               rtx tmp = gen_reg_rtx(SImode);
8734
+                               emit_insn(gen_movsi(tmp,operands[1]));
8735
+                               operands[1] = tmp;
8736
+                       } else FAIL;
8737
+               }
8738
+       })
8739
+(define_insn "cmp<mode>_reg"
8740
+       [(set (reg:CC CC_REG) (compare:CC
8741
+               (match_operand:ZI 0 "register_operand" "r")
8742
+               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO")))]
8743
+       ""
8744 102 dgisselq
+       "CMP\t%1,%0"
8745
+       [(set_attr "ccresult" "set")])
8746
+(define_insn "cmp<mode>_off"
8747 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8748
+               (match_operand:ZI 0 "register_operand" "r")
8749 146 dgisselq
+               (plus:ZI (match_operand:ZI 1 "register_operand" "r")
8750 122 dgisselq
+                       (match_operand 2 "zip_opb_immv_p" "N"))))]
8751 102 dgisselq
+       ""
8752
+       "CMP\t%2+%1,%0"
8753
+       [(set_attr "ccresult" "set")])
8754
+(define_insn "test<mode>"
8755 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_operand:ZI 0 "register_operand" "r")
8756
+                               (match_operand:ZI 1 "zip_opb_single_operand_p" "rO"))
8757 102 dgisselq
+                       (const_int 0)))]
8758
+       ""
8759
+       "TEST   %1,%0"
8760
+       [(set_attr "ccresult" "set")])
8761
+(define_insn "test<mode>_off"
8762 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
8763
+               (and:ZI (match_operand:ZI 0 "register_operand" "r")
8764
+                       (plus:ZI
8765
+                               (match_operand:ZI 1 "register_operand" "r")
8766
+                               (match_operand:ZI 2 "zip_opb_immv_p" "N")))
8767
+               (const_int 0)))]
8768 102 dgisselq
+       ""
8769
+       "TEST   %2+%1,%0"
8770
+       [(set_attr "ccresult" "set")])
8771
+(define_insn "nop"
8772
+       [(const_int 0)]
8773
+       ""
8774
+       "NOOP"
8775
+       [(set_attr "ccresult" "unchanged")])
8776
+;
8777
+;
8778
+;
8779
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8780
+;;
8781
+;; Conditional execution predicates
8782
+;;
8783
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8784
+;
8785
+; Sadly, these aren't complete like they should be.  Although these are all of
8786
+; the conditional execution prefixes that the Zip CPU supports, GCC looks for
8787
+; other conditions then these.  That is, (cond_exec ...) is not as well
8788
+; recognized as (if_then_else ...).  So we have to duplicate things to support
8789
+; both methods.
8790
+;
8791
+(define_cond_exec
8792 122 dgisselq
+       [(ne (reg:CC CC_REG) (const_int 0))]
8793 102 dgisselq
+       ""
8794
+       "(NZ)"
8795
+       [(set_attr "conditional" "yes")])
8796
+(define_cond_exec
8797 122 dgisselq
+       [(lt (reg:CC CC_REG) (const_int 0))]
8798 102 dgisselq
+       ""
8799
+       "(LT)"
8800
+       [(set_attr "conditional" "yes")])
8801
+(define_cond_exec
8802 122 dgisselq
+       [(eq (reg:CC CC_REG) (const_int 0))]
8803 102 dgisselq
+       ""
8804
+       "(Z)"
8805
+       [(set_attr "conditional" "yes")])
8806
+(define_cond_exec
8807 122 dgisselq
+       [(gt (reg:CC CC_REG) (const_int 0))]
8808 102 dgisselq
+       ""
8809
+       "(GT)"
8810
+       [(set_attr "conditional" "yes")])
8811
+(define_cond_exec
8812 122 dgisselq
+       [(ge (reg:CC CC_REG) (const_int 0))]
8813 102 dgisselq
+       ""
8814
+       "(GE)"
8815
+       [(set_attr "conditional" "yes")])
8816
+(define_cond_exec
8817 122 dgisselq
+       [(ltu (reg:CC CC_REG) (const_int 0))]
8818 102 dgisselq
+       ""
8819
+       "(C)"
8820
+       [(set_attr "conditional" "yes")])
8821
+;
8822
+;
8823
+;
8824
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8825
+;;
8826
+;; Conditional move instructions, since these won't accept conditional
8827
+;;     execution RTL
8828
+;;
8829
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8830
+;
8831
+; // Look for #define HAVE_conditional_move to understand how these might be
8832
+; // used.
8833
+;
8834
+(define_insn "set_zero_or_one<mode>"
8835
+       [(set (match_operand:ZI 0 "register_operand" "=r") (if_then_else:ZI
8836
+                       (match_operator 1 "ordered_comparison_operator"
8837 122 dgisselq
+                                       [(reg:CC CC_REG) (const_int 0)])
8838 102 dgisselq
+                       (const_int 1) (const_int 0)))]
8839
+       ""
8840
+       { return (zip_set_zero_or_one(operands[1], operands[0]));
8841
+       }
8842
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8843 127 dgisselq
+(define_expand "mov<mode>cc"
8844 102 dgisselq
+       [(set (match_operand:ZI 0 "register_operand" "=r")
8845 127 dgisselq
+               (if_then_else:ZI (match_operand 1 "comparison_operator")
8846 102 dgisselq
+                       (match_operand:ZI 2 "general_operand" "rio")
8847
+                       (match_operand:ZI 3 "nonmemory_operand" "rio")))]
8848
+       ""
8849
+       {
8850 142 dgisselq
+       if (zip_expand_movsicc(operands[0], operands[1], operands[2], operands[3]))
8851
+               DONE;
8852
+       else
8853
+               FAIL;
8854 127 dgisselq
+       })
8855
+(define_insn_and_split "movsicc_bare"
8856
+       [(set (match_operand:SI 0 "register_operand" "=r")
8857 191 dgisselq
+               (if_then_else:SI (match_operator 1 "ordered_comparison_operator"
8858 127 dgisselq
+                               [(reg:CC CC_REG) (const_int 0)])
8859
+                       (match_operand:SI 2 "general_operand" "rio")
8860
+                       (match_operand:SI 3 "register_operand" "0")))]
8861
+       "(zip_supported_condition(GET_CODE(operands[1])))"
8862
+       "#"
8863
+       "(reload_completed)"
8864
+       [(cond_exec (match_operator 1 "ordered_comparison_operator"
8865
+                               [(reg:CC CC_REG) (const_int 0)])
8866
+                       (set (match_dup 0) (match_dup 2)))]
8867
+       "" [(set_attr "predicable" "no")])
8868 102 dgisselq
+(define_insn "add<mode>cc"
8869
+       [(set (match_operand:ZI 0 "register_operand" "=r,r")
8870
+               (if_then_else:ZI (match_operator 1 "ordered_comparison_operator"
8871 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
8872 102 dgisselq
+                       (plus:ZI (match_operand:ZI 2 "register_operand" "0,r")
8873
+                               (match_operand:ZI 3 "nonmemory_operand" "rO,M"))
8874
+                       (match_dup 0)))]
8875
+       ""
8876
+       {
8877
+       return zip_addsicc(operands[0], operands[1], operands[2], operands[3]);
8878
+       }
8879
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8880
+;
8881
+;
8882
+;
8883
+; While an interesting approach, the following suffers from problems when the
8884
+; move amount is constant.  At anything less than four, moves should not require
8885
+; the movmemSI instruction.  At anything greater, if constant, the initial tests
8886
+; are not required and should result in a hardcoded result.  Practically,
8887
+; though, this should really be a define_expand instruction, calling on the
8888 127 dgisselq
+; RTX's of all the respective subinstructions found below.  Or, perhaps, it is
8889
+; better as a subroutine?
8890 102 dgisselq
+;
8891
+;(define_insn "movmemSI"
8892
+;      [(parallel [(set (mem:BLK (match_operand 0 "register_operand" "+r"));Dst
8893
+;                      (mem:BLK (match_operand 1 "register_operand" "+r")));Src
8894
+;              (use (match_operand:SI 2 "register_operand" "+r"))]); Length
8895
+;              (match_operand 3 "" "")                 ;Alignment
8896
+;              (clobber (match_scratch:SI 4 "=r"))
8897
+;              (clobber (match_scratch:SI 5 "=r"))
8898
+;              (clobber (match_scratch:SI 6 "=r"))
8899
+;              (clobber (match_scratch:SI 7 "=r"))]
8900
+;      ""
8901
+;      "TEST\t1,%2
8902
+;      LOD.NZ\t%1,%4
8903
+;      STO.NZ\t%4,%0
8904
+;      ADD.NZ\t1,%0
8905
+;      ADD.NZ\t1,%1
8906
+;      TEST\t2,%2
8907
+;      LOD.NZ\t%1,%4
8908
+;      LOD.NZ\t1(%1),%5
8909
+;      STO.NZ\t%4,(%0)
8910
+;      STO.NZ\t%4,1(%0)
8911
+;      ADD.NZ\t2,%0
8912
+;      ADD.NZ\t2,%1
8913
+;      AND\t-4,%2
8914
+;      BZ\t.Lskp%=\n.Ltop%=:
8915
+;      LOD\t(%1),%4
8916
+;      LOD\t1(%1),%5
8917
+;      LOD\t2(%1,%6
8918
+;      LOD\t3(%1),%7
8919
+;      STO\t%4,(%1)
8920
+;      STO\t%5,1(%1)
8921
+;      STO\t%6,2(%1)
8922
+;      STO\t%7,3(%1)
8923
+;      SUB\t4,%2
8924
+;      BZ\t%.Lskp%=
8925
+;      BRA\t.Ltop%=\n.Lskp%=:"
8926
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8927
+;(define_insn "setmemsi"
8928
+;      [(parallel
8929
+;              [(set (mem:BLK
8930
+;                      (match_operand 0 "register_operand" "+r")); Destination
8931
+;                      (match_operand:SI 2 "register_operand" "r")) ; Source
8932
+;              (use (match_operand:SI 1 "register_operand" "+r"))])  ; Length
8933
+;              (match_operand 3 "" "")]
8934
+;      ""
8935
+;      "TEST\t1,%1
8936
+;      STO.NZ\t%2,(%0)
8937
+;      ADD.NZ\t1,%0
8938
+;      TEST\t2,%1
8939
+;      STO.NZ\t%2,(%0)
8940
+;      STO.NZ\t%2,1(%0)
8941
+;      ADD.NZ\t2,%0
8942
+;      AND\t-4,%1
8943
+;      BZ\t.Lskp%=\n.Ltop%=:\n
8944
+;      STO\t%2,(%0)
8945
+;      STO\t%2,1(%0)
8946
+;      STO\t%2,2(%0)
8947
+;      STO\t%2,3(%0)
8948
+;      SUB\t%4,%0
8949
+;      BZ\t.Lskp%=
8950
+;      BRA\t.Ltop%=\n.Lskp%=:"
8951
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
8952
+;;
8953
+;
8954
+;
8955
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8956
+;;
8957
+;; Control flow instructions
8958
+;;
8959
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8960
+;
8961
+;
8962
+;
8963
+(define_expand "jump"
8964
+       [(set (pc)
8965
+               (label_ref (match_operand 0 "" "")))]); // Was general-op, "mro"
8966 127 dgisselq
+(define_insn "jump_const"
8967
+       [(set (pc)
8968 102 dgisselq
+               (match_operand:SI 0 "zip_const_address_operand_p" ""))]
8969
+       ""
8970
+       "BRA    %0"
8971
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8972
+(define_insn "jump_label"      ; Must be modeless, VOIDmode, not SI or any othr
8973
+       [(set (pc)      ; Otherwise it won't accept jumps to labels
8974
+               (label_ref (match_operand 0 "" "")))]
8975
+       ""
8976
+       "BRA    %0"
8977
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
8978
+;
8979
+; This is really the same thing as an indirect jump ... the big difference
8980
+; is that the zip_address_operand_p checks for an "N" type condition, not an
8981
+; "M" type condition ... a bug, but one that works for now.  (The assembler
8982
+; should be able to catch and except on it ...)
8983
+;
8984
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
8985
+(define_insn "jump_variable"
8986
+       [(set (pc)
8987
+               (match_operand:SI 0 "zip_address_operand_p" ""))]
8988
+       ""
8989
+       "JMP    %0"
8990
+       [(set_attr "ccresult" "unchanged")])
8991
+;
8992
+; Indirect jumps ... both to registers, and registers plus offsets
8993
+;
8994
+(define_insn "indirect_jump"
8995
+       [(set (pc)
8996
+               (match_operand:SI 0 "register_operand" "r"))]
8997
+       ""
8998
+       "JMP    %0"
8999
+       [(set_attr "ccresult" "unchanged")])
9000
+(define_insn "indirect_jump_mem"
9001
+       [(set (pc) (match_operand:SI 0 "zip_memory_operand_p" "o"))]
9002
+       ""
9003
+       "LOD    %0,PC"
9004
+       [(set_attr "ccresult" "unchanged")])
9005
+(define_insn "indirect_jump_off"
9006
+       [(set (pc)
9007
+               (plus:SI (match_operand:SI 0 "register_operand" "r")
9008
+                       (match_operand:SI 1 "const_int_operand" "M")))]
9009
+       ""
9010
+       "JMP    %1(%0)"
9011
+       [(set_attr "ccresult" "unchanged")])
9012
+;;
9013
+; cbranchsi4
9014
+;;     Op 0 = the comparison operator (le,lt,eq,ne,gt,ge,and usgn ltu,geu,etc.)
9015
+;;     Op 1&2 the operands of the compare instruction
9016
+;;     Op 3 is the jump label
9017
+;;
9018
+;;
9019
+;; #warning Need to adjust this so that the "LT" code doesnt get generated ...
9020
+;;
9021
+(define_expand "cbranch<mode>4"
9022 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_operand:ZI 1 "register_operand" "r")
9023
+               (match_operand:ZI 2 "zip_opb_operand_p" "rO")))
9024 102 dgisselq
+       (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator"
9025 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9026 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
9027
+                       (pc)))]
9028
+       ""
9029
+       {
9030 125 dgisselq
+               if (true) {
9031 117 dgisselq
+               extern void zip_debug_rtx_pfx(const char *, const_rtx);
9032 102 dgisselq
+               //; Two branches give us no end of difficulty when implementing.
9033
+               //; Let's check for these two branch codes, and swap the
9034
+               //; comparison to simplify them.
9035 122 dgisselq
+               //; fprintf(stderr, "CBRANCH\n");
9036
+               //; zip_debug_rtx_pfx("- CMP: ", operands[0]);
9037
+               //; zip_debug_rtx_pfx("- A  : ", operands[1]);
9038
+               //; zip_debug_rtx_pfx("- B  : ", operands[2]);
9039
+               //; zip_debug_rtx_pfx("- JMP: ", operands[3]);
9040 117 dgisselq
+               //; Can we do better if we reverse some compares?
9041 102 dgisselq
+               if ((GET_CODE(operands[0])==GTU)&&(REG_P(operands[2]))) {
9042 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GTU,?,REG,?)\n");
9043
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
9044 102 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9045
+                       DONE;
9046
+               } else if((GET_CODE(operands[0])==GEU)&&(REG_P(operands[2]))) {
9047 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(GEU,?,REG,?)\n");
9048
+                       emit_insn(gen_cmpsi_off(operands[2], operands[1],
9049
+                                       GEN_INT(1)));
9050
+                       emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9051 102 dgisselq
+                       DONE;
9052 117 dgisselq
+               } else if ((GET_CODE(operands[0])==LE)&&(REG_P(operands[2]))) {
9053 122 dgisselq
+                       //; fprintf(stderr, "CBRANCH:(LE,?,REG,?)\n");
9054 117 dgisselq
+                       //; Swap operands, turn into a GTE compare
9055 122 dgisselq
+                       emit_insn(gen_cmpsi(operands[2], operands[1]));
9056 117 dgisselq
+                       emit_jump_insn(gen_cbranch_jmp_ge(operands[3]));
9057
+                       DONE;
9058 102 dgisselq
+               } // ; Otherwise ... just handle the branch normally
9059
+
9060
+               //; Except ... we can do better for some instructions, such as
9061
+               //; LE.  While we could exchange CMP Rx,Ry into -1(Rx),Ry, it
9062
+               //; would be difficult to explain to users why MIN_INT didn't
9063
+               //; compare properly.  Hence we only adjust constant integers.
9064
+               //;
9065 122 dgisselq
+               if (GET_CODE(operands[0])==LE) {
9066
+                       if ((CONST_INT_P(operands[2]))
9067 117 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
9068 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LE,?,#,?)\n");
9069
+                               emit_insn(gen_cmpsi(operands[1],
9070
+                                               GEN_INT(INTVAL(operands[2])+1)));
9071
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9072
+                               DONE;
9073
+                       //; Now for the controversial ones--where we add one
9074
+                       //; when it may or may not be permissable.  For now, we
9075
+                       //; just do it anyway and postpone the philosophical
9076
+                       //; discussion for later.
9077
+                       } else if (REG_P(operands[2])) {
9078
+                               emit_insn(gen_cmpsi_off(operands[1],
9079
+                                               operands[2],GEN_INT(1)));
9080
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9081
+                               DONE;
9082
+                       } else if ((GET_CODE(operands[2])==PLUS)
9083
+                               &&(REG_P(XEXP(operands[2],0)))
9084
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
9085
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
9086
+                               emit_insn(gen_cmpsi_off(operands[1],
9087
+                                               XEXP(operands[2],0),
9088
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
9089
+                               emit_jump_insn(gen_cbranch_jmp_lt(operands[3]));
9090
+                               DONE;
9091
+                       }
9092
+               } else if (GET_CODE(operands[0])==LEU) {
9093
+                       if ((CONST_INT_P(operands[2]))
9094 102 dgisselq
+                               &&(INTVAL(operands[2])<(1<<17)-2)) {
9095 122 dgisselq
+                               //; fprintf(stderr, "CBRANCH:(LEU,?,#,?)\n");
9096
+                               emit_insn(gen_cmpsi(operands[1],
9097
+                                               GEN_INT(INTVAL(operands[2])+1)));
9098
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9099
+                               DONE;
9100
+                       //; Now for the controversial ones--this time having
9101
+                       //; to do with unsigned compares.
9102
+                       } else if (REG_P(operands[2])) {
9103
+                               emit_insn(gen_cmpsi_off(operands[1],
9104
+                                                       operands[2],GEN_INT(1)));
9105
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9106
+                               DONE;
9107
+                       } else if ((GET_CODE(operands[2])==PLUS)
9108
+                               &&(REG_P(XEXP(operands[2],0)))
9109
+                               &&(CONST_INT_P(XEXP(operands[2],1)))
9110
+                               &&(INTVAL(XEXP(operands[2],1))<((1<<13)-2))) {
9111
+                               emit_insn(gen_cmpsi_off(operands[1],
9112
+                                       XEXP(operands[2],0),
9113
+                                       GEN_INT(INTVAL(XEXP(operands[2],1))+1)));
9114
+                               emit_jump_insn(gen_cbranch_jmp_ltu(operands[3]));
9115
+                               DONE;
9116
+                       }
9117 124 dgisselq
+               }}
9118 102 dgisselq
+       })
9119
+(define_insn "cbranch_jmp_eq"
9120 122 dgisselq
+       [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
9121 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9122
+                (pc)))]
9123
+       ""
9124
+       "BZ\t%0"
9125
+       [(set_attr "predicable" "no")
9126
+               (set_attr "conditional" "yes")
9127
+               (set_attr "ccresult" "unchanged")])
9128
+(define_insn "cbranch_jmp_neq"
9129 122 dgisselq
+       [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
9130 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9131
+                (pc)))]
9132
+       ""
9133
+       "BNZ\t%0"
9134
+       [(set_attr "predicable" "no")
9135
+               (set_attr "conditional" "yes")
9136
+               (set_attr "ccresult" "unchanged")])
9137
+(define_insn "cbranch_jmp_lt"
9138 122 dgisselq
+       [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9139 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9140
+                (pc)))]
9141
+       ""
9142
+       "BLT\t%0"
9143
+       [(set_attr "predicable" "no")
9144
+               (set_attr "conditional" "yes")
9145
+               (set_attr "ccresult" "unchanged")])
9146
+(define_insn "cbranch_jmp_le"
9147 122 dgisselq
+       [(set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
9148 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9149
+                (pc)))]
9150
+       ""
9151
+       "BLT\t%0
9152
+       BZ\t%0"
9153
+       [(set_attr "predicable" "no")
9154
+               (set_attr "conditional" "yes")
9155
+               (set_attr "ccresult" "unchanged")])
9156
+(define_insn "cbranch_jmp_gt"
9157 122 dgisselq
+       [(set (pc) (if_then_else (gt (reg:CC CC_REG) (const_int 0))
9158 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9159
+                (pc)))]
9160
+       ""
9161
+       "BGT\t%0"
9162
+       [(set_attr "predicable" "no")
9163
+               (set_attr "conditional" "yes")
9164
+               (set_attr "ccresult" "unchanged")])
9165
+(define_insn "cbranch_jmp_ge"
9166 122 dgisselq
+       [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
9167 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9168
+                (pc)))]
9169
+       ""
9170
+       "BGE\t%0"
9171
+       [(set_attr "predicable" "no")
9172
+               (set_attr "conditional" "yes")
9173
+               (set_attr "ccresult" "unchanged")])
9174
+(define_insn "cbranch_jmp_ltu"
9175 122 dgisselq
+       [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9176 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9177
+                (pc)))]
9178
+       ""
9179
+       "BC\t%0"
9180
+       [(set_attr "predicable" "no")
9181
+               (set_attr "conditional" "yes")
9182
+               (set_attr "ccresult" "unchanged")])
9183
+(define_insn "cbranch_jmp_gtu"
9184 122 dgisselq
+       [(set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
9185 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9186 122 dgisselq
+                (pc)))
9187
+       ;(clobber (reg:CC CC_REG))
9188
+       ]
9189 102 dgisselq
+       ""      ; Flip the condition, and then we can jump
9190 127 dgisselq
+       "BC\t.Lgtu%=\n\tBZ\t.Lgtu%=\n\tBRA\t%0\n.Lgtu%=:"
9191 102 dgisselq
+       [(set_attr "predicable" "no")
9192
+               (set_attr "conditional" "yes")
9193
+               (set_attr "ccresult" "unknown")])
9194
+(define_insn "cbranch_jmp_leu"
9195 122 dgisselq
+       [(set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
9196 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9197
+                (pc)))]
9198
+       ""      ; Need to check for both LTU (i.e. C) and Z
9199
+       "BC\t%0
9200
+       BZ\t%0"
9201
+       [(set_attr "predicable" "no")
9202
+               (set_attr "conditional" "yes")
9203
+               (set_attr "ccresult" "unchanged")])
9204
+(define_insn "cbranch_jmp_geu"
9205 122 dgisselq
+       [(set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
9206 102 dgisselq
+                (label_ref (match_operand 0 "" ""))
9207 122 dgisselq
+                (pc)))
9208
+       ;(clobber (reg:CC CC_REG))
9209
+       ]
9210 127 dgisselq
+       ""
9211
+       "BC\t.Lgeu%=\n\tBRA\t%0\n.Lgeu%=:"
9212 102 dgisselq
+       [(set_attr "predicable" "no")
9213
+               (set_attr "conditional" "yes")
9214
+               (set_attr "ccresult" "unknown")])
9215
+(define_insn "cbranchdi4"
9216
+       [(set (pc) (if_then_else
9217
+               (match_operator 0 "ordered_comparison_operator"
9218
+                       [(match_operand:DI 1 "register_operand" "r")
9219 122 dgisselq
+                               (match_operand:DI 2 "register_operand" "r")])
9220 102 dgisselq
+                       (label_ref (match_operand 3 "" ""))
9221
+                       (pc)))
9222 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9223 102 dgisselq
+       ""
9224
+       {
9225
+               switch(GET_CODE(operands[0])) {
9226
+               case EQ:
9227
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBZ\t%3";
9228
+               case NE:
9229
+                       return "CMP\t%H2,%H1\n\tCMP.NZ\t%L2,%L1\n\tBNZ\t%3";
9230
+               case LE:
9231
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
9232
+               case GT:
9233
+                       return "CMP\t%H1,%H2\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L1,%L2\n\tBC\t%3\n.Ldi%=:";
9234
+               case LT:
9235
+                       return "CMP\t%H2,%H1\n\tBLT\t%3\n\tBNZ\t.Ldi%=\n\tCMP\t%L2,%L1\n\tBC\t%3\n.Ldi%=:";
9236
+               case GE:
9237
+                       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%=:";
9238
+               case LTU:
9239
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n";
9240
+               case LEU:
9241
+                       return "CMP\t%H2,%H1\n\tCMP.Z\t%L2,%L1\n\tBC\t%3\n\tBZ\t%3";
9242
+               case GTU:
9243
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\n";
9244
+               case GEU:
9245
+                       return "CMP\t%H1,%H2\n\tCMP.Z\t%L1,%L2\n\tBC\t%3\nBZ\t%3";
9246
+               default:
9247
+                       gcc_unreachable();
9248
+               }
9249
+       }
9250
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9251
+;
9252
+;
9253
+;
9254
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9255
+;;
9256 191 dgisselq
+;; Looping constructs
9257
+;;
9258
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9259
+;
9260
+;
9261
+;
9262
+(define_insn "decrement_and_branch_until_zero"
9263
+       [(set (pc)
9264
+               (if_then_else
9265
+                       (ge (plus:SI (match_operand:SI 0 "register_operand" "+r")
9266
+                               (const_int -1)) (const_int 0))
9267
+                       (label_ref (match_operand 1 "" ""))
9268
+                       (pc)))
9269
+       (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))
9270
+       ;(set (reg:CC CC_REG)
9271
+               ;(compare:CC (minus:SI (match_dup 0) (const_int 1))
9272
+                       ;(const_int 0)))
9273
+       (clobber (reg:CC CC_REG))]
9274
+       ""
9275
+       "ADD\t-1,%0\n\tBLT\t.Ldec%=\n\tBRA\t%1\n.Ldec%=:"
9276
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9277
+;
9278
+;
9279
+(define_insn "doloop_end"
9280
+       [(set (pc)
9281
+               (if_then_else
9282
+                       (ne (plus:SI (match_operand:SI 0 "register_operand" "+r")
9283
+                               (const_int -1)) (const_int 0))
9284
+                       (label_ref (match_operand 1 "" ""))
9285
+                       (pc)))
9286
+       (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))
9287
+       ; (set (reg:CC CC_REG)
9288
+               ; (compare:CC (minus:SI (match_dup 0) (const_int 1))
9289
+                       ; (const_int 0)))
9290
+       (clobber (reg:CC CC_REG))]
9291
+       "(reload_completed)"
9292
+       "ADD\t-1,%0\n\tBZ\t.Lloop%=\n\tBRA\t%1\n.Lloop%=:"
9293
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9294
+;
9295
+; Since we have a doloop_end, we must also have a doloop_begin.  Since the
9296
+; ZipCPU has no special begin looping instruction, we'll simply define this
9297
+; as a null instruction.
9298
+(define_expand "doloop_begin" [(const_int 0)] "(0)")
9299
+;
9300
+;
9301
+;
9302
+;
9303
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9304
+;;
9305 102 dgisselq
+;; Subroutine call
9306
+;;
9307
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9308
+;
9309
+;
9310
+; There are two types of calls: "call" and "call_value".
9311
+;
9312
+; Each of these types of calls are then expanded into one of:
9313
+;
9314
+;      _const          - A call to a constant address, such as a symbol
9315
+;                      reference or a fixed location
9316
+;
9317
+;      _label          - This should be the same as _const, except that for
9318
+;                      some reason the RTL and matching rules are separate.
9319
+;                      Hence we have a separate rule for this.
9320
+;
9321
+;      _mem            - The memory address we wish to jump to is stored in
9322
+;                      memory somewhere, and we have only a pointer.  In this
9323
+;                      case, we load that pointer straight to the PC and go.
9324
+;
9325
+;      _var            - The address to jump to is given as an offset to a
9326
+;                      register, such as X+R3.  This is an indirect jump.
9327
+;                      Although we support it, it does require different RTL
9328
+;                      code.
9329
+;
9330
+(define_expand "call"
9331
+       [(call (match_operand 0 "" "")
9332
+               (match_operand 1 "" ""))]
9333
+       ""
9334
+       {
9335
+               if (MEM_P(operands[0])) {
9336
+                       // This should always be the case
9337
+                       rtx addr = XEXP(operands[0],0);
9338
+                       if (zip_const_address_operand_p(addr, SImode)) {
9339 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_void_call_const()\n");
9340 102 dgisselq
+                               emit_call_insn(gen_void_call_const(addr,
9341
+                                               operands[1]));
9342
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
9343
+                                                       XEXP(addr,0)))) {
9344
+                               emit_call_insn(gen_void_call_mem(XEXP(addr,0),
9345
+                                                                operands[1]));
9346
+                       } else {
9347
+                               emit_call_insn(gen_void_call_var(addr,
9348
+                                                                operands[1]));
9349
+                       }
9350
+                       DONE;
9351
+               }
9352
+       })
9353
+;
9354 191 dgisselq
+(define_expand "sibcall"
9355
+       [(call (mem:SI (match_operand 0 "zip_const_address_operand_p" ""))
9356
+               (match_operand 1 "" ""))
9357
+       (use (match_operand 2 "" ""))
9358
+       (use (reg:SI RTN_REG))
9359
+       (simple_return)]
9360
+       ""
9361
+       {
9362
+               if (MEM_P(operands[0])) {
9363
+                       // This should always be the case
9364
+                       rtx addr = XEXP(operands[0],0);
9365
+                       if (zip_const_address_operand_p(addr, SImode)) {
9366
+                               //; fprintf(stderr, "Generating gen_void_call_const()\n");
9367
+                               emit_call_insn(gen_void_sibcall_const(addr,
9368
+                                               operands[1]));
9369
+                       } else if ((MEM_P(addr))&&(zip_address_operand(
9370
+                                                       XEXP(addr,0)))) {
9371
+                               emit_call_insn(gen_void_sibcall_mem(XEXP(addr,0),
9372
+                                                                operands[1]));
9373
+                       } else {
9374
+                               emit_call_insn(gen_void_sibcall_var(addr,
9375
+                                                                operands[1]));
9376
+                       }
9377
+                       DONE;
9378
+               }
9379
+       }) ; "BAR\t%0\n"
9380 102 dgisselq
+;
9381 191 dgisselq
+(define_insn "void_sibcall_const"
9382
+       [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9383
+                       (match_operand 1 "const_int_operand" "n"))
9384
+               (use (reg:SI RTN_REG))
9385
+               (clobber (reg:CC CC_REG))
9386
+               (simple_return)]
9387
+       ""
9388
+       "BRA\t%0"
9389
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9390
+(define_insn "void_sibcall_mem"
9391
+       [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9392
+                       (match_operand 1 "const_int_operand" "n"))
9393
+               (use (reg:SI RTN_REG))
9394
+               (clobber (reg:CC CC_REG))
9395
+               (simple_return)]
9396
+       ""
9397
+       "LOD\t%0,PC"
9398
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9399 102 dgisselq
+;
9400 191 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9401
+(define_insn "void_sibcall_var"
9402
+       [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9403
+                       (match_operand 1 "const_int_operand" "n"))
9404
+               (use (reg:SI RTN_REG))
9405
+               (clobber (reg:CC CC_REG))
9406
+               (simple_return)]
9407
+       ""
9408
+       "JMP\t%0"
9409
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9410
+;
9411
+(define_expand "sibcall_value"
9412
+       [(set (match_operand 0 "register_operand" "")
9413
+               (call (mem:SI
9414
+                       (match_operand 1 "zip_const_address_operand_p" ""))
9415
+               (match_operand 2 "" "")))
9416
+       (use (match_operand 3 "" ""))
9417
+       (use (reg:SI RTN_REG))
9418
+       (clobber (reg:CC CC_REG))
9419
+       (simple_return)]
9420
+       ""
9421
+       {
9422
+               if (MEM_P(operands[1])) {
9423
+                       rtx addr = XEXP(operands[1],0);
9424
+                       if (zip_const_address_operand_p(addr, SImode)) {
9425
+                               emit_call_insn(gen_reg_sibcall_const(addr, operands[2]));
9426
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
9427
+                               emit_call_insn(gen_reg_sibcall_mem(XEXP(addr,0), operands[2]));
9428
+                       } else {
9429
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9430
+                               emit_call_insn(gen_reg_sibcall_var(addr, operands[2]));
9431
+                       }
9432
+                       DONE;
9433
+               }
9434
+       })
9435
+;
9436
+;
9437
+;
9438
+;
9439 102 dgisselq
+; How do we want to do this better?
9440
+;      Replace the RTL w/
9441
+;              return_label= gen_label_rtx();
9442
+;              emit_movsi(gen_rtx_REG(zip_R0),plus_constant(
9443
+;                      gen_rtx_REG(zip_PC),return_label));
9444
+;              emit_jump(label_rtx(
9445
+;
9446
+;              emit_label(return_label);
9447
+;
9448
+; The problem is: we can't!  GCC distinguishes between jumps and calls when
9449
+; optimizing, and it doesn't see the need to keep the label around.  Thus, the
9450
+; label gets removed and the call gets lost.  Hence we do it this way (below).
9451
+; I'll probably bastardize a means of getting a new codelabel that GCC doesn't
9452
+; recognize as such, but for now we'll use .Lcall# as our label.
9453
+;
9454
+(define_insn "void_call_const"
9455 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9456 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9457 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9458
+               (clobber (reg:CC CC_REG))]
9459 102 dgisselq
+       ""
9460
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
9461
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9462
+(define_insn "void_call_mem"
9463 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9464 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9465 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9466
+               (clobber (reg:CC CC_REG))]
9467 102 dgisselq
+       ""
9468
+       "MOV    .Lcall%=(PC),R0\;LOD\t%0,PC\n.Lcall%=:"
9469
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9470
+;
9471
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9472
+(define_insn "void_call_var"
9473 122 dgisselq
+       [(call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9474 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n"))
9475 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9476
+               (clobber (reg:CC CC_REG))]
9477 102 dgisselq
+       ""
9478
+       "MOV    .Lcall%=(PC),R0\;JMP\t%0\n.Lcall%=:"
9479
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9480 191 dgisselq
+;
9481
+;
9482 102 dgisselq
+(define_expand "call_value"
9483 122 dgisselq
+       [(parallel [(set (reg:SI RTNV_REG)
9484 102 dgisselq
+               (call (match_operand:SI 1 "" "")
9485 111 dgisselq
+                       (match_operand 2 "const_int_operand" "n")))
9486 122 dgisselq
+       (set (match_operand:SI 0 "register_operand" "=r") (reg:SI RTNV_REG))
9487
+       (clobber (reg:CC CC_REG))])]
9488 102 dgisselq
+       ""
9489
+       {
9490 122 dgisselq
+               //; extern void zip_debug_rtx(const_rtx);
9491
+               //; fprintf(stderr, "ZIP.MD::CALL-VALUE()\n");
9492
+               //; zip_debug_rtx(operands[1]);
9493 102 dgisselq
+               if (MEM_P(operands[1])) {
9494 122 dgisselq
+                       //; fprintf(stderr, "ZIP.MD::CALL-VALUE() MEM_P\n");
9495
+                       //; zip_debug_rtx(operands[1]);
9496
+                       //; This should always be the case
9497 102 dgisselq
+                       rtx addr = XEXP(operands[1],0);
9498
+                       if (zip_const_address_operand_p(addr, SImode)) {
9499 122 dgisselq
+                               //; fprintf(stderr, "Generating gen_reg_call_const()\n");
9500 102 dgisselq
+                               emit_call_insn(gen_reg_call_const(addr, operands[2]));
9501
+                       } else if ((MEM_P(addr))&&(zip_address_operand(XEXP(addr,0)))) {
9502 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9503 102 dgisselq
+                               emit_call_insn(gen_reg_call_mem(XEXP(addr,0), operands[2]));
9504
+                       } else {
9505 122 dgisselq
+                               //; fprintf(stderr, "ZIP.MD::CALL-VALUE() INDIRECT\n");
9506 102 dgisselq
+                               emit_call_insn(gen_reg_call_var(addr, operands[2]));
9507
+                       }
9508
+                       DONE;
9509
+               }
9510
+       })
9511
+(define_insn "reg_call_const"
9512 122 dgisselq
+       [(set (reg:SI RTNV_REG)
9513 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9514 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
9515 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9516
+               (clobber (reg:CC CC_REG))]
9517 102 dgisselq
+       ""
9518
+       "MOV    .Lcall%=(PC),R0\;BRA\t%0\n.Lcall%=:"
9519
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9520
+(define_insn "reg_call_mem"
9521
+       [(set (reg:SI RTNV_REG)
9522 111 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9523
+                       (match_operand 1 "const_int_operand" "n")))
9524 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9525
+               (clobber (reg:CC CC_REG))]
9526 102 dgisselq
+       ""
9527 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tLOD\t%0,PC\n.Lcall%=:"
9528 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9529 111 dgisselq
+;
9530 102 dgisselq
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9531
+(define_insn "reg_call_var"
9532 122 dgisselq
+       [(set (reg:SI RTNV_REG)
9533 102 dgisselq
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9534 111 dgisselq
+                       (match_operand 1 "const_int_operand" "n")))
9535 122 dgisselq
+               (clobber (reg:SI RTN_REG))
9536
+               (clobber (reg:CC CC_REG))]
9537 102 dgisselq
+       ""
9538 111 dgisselq
+       "MOV    .Lcall%=(PC),R0\n\tJMP\t%0\n.Lcall%=:"
9539 102 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9540
+;
9541
+;
9542
+;
9543 191 dgisselq
+(define_insn "reg_sibcall_const"
9544
+       [(set (reg:SI RTNV_REG)
9545
+               (call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p" ""))
9546
+                       (match_operand 1 "const_int_operand" "n")))
9547
+               (use (reg:SI RTN_REG))
9548
+               (clobber (reg:CC CC_REG))
9549
+               (simple_return)]
9550
+       ""
9551
+       "BRA\t%0"
9552
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9553
+(define_insn "reg_sibcall_mem"
9554
+       [(set (reg:SI RTNV_REG)
9555
+               (call (mem:SI (match_operand:SI 0 "zip_memory_operand_p" "Q"))
9556
+                       (match_operand 1 "const_int_operand" "n")))
9557
+               (use (reg:SI RTN_REG))
9558
+               (clobber (reg:CC CC_REG))
9559
+               (simple_return)]
9560
+       ""
9561
+       "LOD\t%0,PC"
9562
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9563
+;
9564
+; #warning "This predicate is appropriate for non-moves, but not for JMPs"
9565
+(define_insn "reg_sibcall_var"
9566
+       [(set (reg:SI RTNV_REG)
9567
+               (call (mem:SI (match_operand:SI 0 "zip_address_operand_p" ""))
9568
+                       (match_operand 1 "const_int_operand" "n")))
9569
+               (use (reg:SI RTN_REG))
9570
+               (clobber (reg:CC CC_REG))
9571
+               (simple_return)]
9572
+       ""
9573
+       "JMP\t%0"
9574
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
9575
+;
9576
+;
9577
+;
9578 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9579
+;;
9580
+;; Frame manipulation RTX
9581
+;;
9582
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9583
+;
9584
+;
9585
+;
9586
+(define_expand "prologue"
9587
+       [(const_int 0)]
9588
+       ""
9589
+       "{ zip_expand_prologue(); DONE; }")
9590 191 dgisselq
+(define_expand "sibcall_epilogue"
9591
+       [(return)]
9592
+       ""
9593
+       "{ zip_sibcall_epilogue(); DONE; }")
9594 102 dgisselq
+(define_expand "epilogue"
9595
+       [(return)]
9596
+       ""
9597
+       "{ zip_expand_epilogue(); DONE; }")
9598
+(define_expand "return" ; In order to use the function predicate, this *must*
9599
+       [(return)]      ; be a define_expand
9600
+       "zip_use_return_insn()")
9601
+       ; "JMP  R0"
9602
+       ; [(set_attr "ccresult" "unchanged")])
9603
+(define_insn "*return" ; A "*" -- means it cannot be called from C
9604
+       [(return)]
9605
+       ""
9606
+       "JMP    R0"
9607
+       [(set_attr "ccresult" "unchanged")])
9608
+(define_insn "simple_return"   ; A "*" -- means it cannot be called from C
9609
+       [(simple_return)]
9610
+       ""
9611
+       "JMP    R0"
9612
+       [(set_attr "ccresult" "unchanged")])
9613 191 dgisselq
+(define_insn "return_if_eq"
9614
+       [(set (pc) (if_then_else (eq (reg:CC CC_REG) (const_int 0))
9615
+                       (return) (pc)))]
9616
+       "zip_use_return_insn()"
9617
+       "JMP.Z  R0"
9618
+       [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
9619
+(define_insn "return_if_ne"
9620
+       [(set (pc) (if_then_else (ne (reg:CC CC_REG) (const_int 0))
9621
+                       (return) (pc)))]
9622
+       "zip_use_return_insn()"
9623
+       "JMP.NZ R0"
9624
+       [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
9625
+(define_insn "return_if_lt"
9626
+       [(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
9627
+                       (return) (pc)))]
9628
+       "zip_use_return_insn()"
9629
+       "JMP.LT R0"
9630
+       [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
9631
+(define_insn "return_if_gt"
9632
+       [(set (pc) (if_then_else (gt (reg:CC CC_REG) (const_int 0))
9633
+                       (return) (pc)))]
9634
+       "zip_use_return_insn()"
9635
+       "JMP.GT R0"
9636
+       [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
9637
+(define_insn "return_if_gte"
9638
+       [(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
9639
+                       (return) (pc)))]
9640
+       "zip_use_return_insn()"
9641
+       "JMP.GTE        R0"
9642
+       [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
9643
+(define_insn "return_if_ltu"
9644
+       [(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
9645
+                       (return) (pc)))]
9646
+       "zip_use_return_insn()"
9647
+       "JMP.C  R0"
9648
+       [(set_attr "ccresult" "unchanged") (set_attr "predicable" "no")])
9649 102 dgisselq
+;
9650
+;
9651
+;
9652
+;;;;;;;;;;;;;;;;;;;;;;;;;;
9653
+;;
9654
+;; Zip Builtin Functions
9655
+;;
9656
+;;;;;;;;;;;;;;;;;;;;;;;;;;
9657
+;
9658
+;
9659
+;
9660
+(define_insn "zip_rtu"
9661
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_RTU)
9662 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9663 102 dgisselq
+       "(!ZIP_USER)"
9664
+       "RTU"
9665
+       [(set_attr "ccresult" "unknown")])
9666 171 dgisselq
+(define_insn "zip_busy"
9667
+       [(set (pc) (minus:SI (pc) (const_int 1)))]
9668
+       ""
9669
+       "BUSY"
9670
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9671 102 dgisselq
+(define_insn "zip_halt" ; Needs to be unspec_volatile, or optimizer will opt out
9672
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_HALT)
9673 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9674 102 dgisselq
+       "(!ZIP_USER)"
9675
+       "HALT"
9676
+       [(set_attr "ccresult" "unknown")])
9677
+(define_insn "zip_idle"
9678
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_IDLE)
9679 122 dgisselq
+       (clobber (reg:CC CC_REG))]
9680 102 dgisselq
+       ""
9681
+       "WAIT"
9682
+       [(set_attr "ccresult" "unknown")])
9683
+(define_insn "zip_syscall"
9684
+       [(unspec_volatile [(reg:SI CC_REG)] UNSPEC_SYSCALL)]
9685
+       ""
9686
+       "CLR\tCC"
9687
+       [(set_attr "ccresult" "unknown")])
9688
+;
9689
+;
9690
+; Operator "save_context"
9691
+;
9692 117 dgisselq
+;      Okay, so we're not really reading and writing operand 0, %0, however
9693
+;      if we don't list it as a "+r" register, the compiler may allocate it
9694
+;      among the other registers, thus we clobber it in the middle of the
9695
+;      operation before the task is complete.
9696 102 dgisselq
+;
9697
+(define_insn "zip_save_context"
9698 117 dgisselq
+       [(unspec_volatile
9699
+                       [ (match_operand:SI 0 "register_operand" "+r") ]
9700 102 dgisselq
+                       UNSPEC_SAVE_CONTEXT)
9701
+               (clobber (match_scratch:SI 1 "=r"))
9702
+               (clobber (match_scratch:SI 2 "=r"))
9703
+               (clobber (match_scratch:SI 3 "=r"))
9704 117 dgisselq
+               (clobber (match_scratch:SI 4 "=r"))]
9705 102 dgisselq
+       "(!ZIP_USER)"
9706
+       "MOV\tuR0,%1
9707
+       MOV\tuR1,%2
9708
+       MOV\tuR2,%3
9709
+       MOV\tuR3,%4
9710
+       STO\t%1,%0
9711
+       STO\t%2,1(%0)
9712
+       STO\t%3,2(%0)
9713
+       STO\t%4,3(%0)
9714
+       MOV\tuR4,%1
9715
+       MOV\tuR5,%2
9716
+       MOV\tuR6,%3
9717
+       MOV\tuR7,%4
9718
+       STO\t%1,4(%0)
9719
+       STO\t%2,5(%0)
9720
+       STO\t%3,6(%0)
9721
+       STO\t%4,7(%0)
9722
+       MOV\tuR8,%1
9723
+       MOV\tuR9,%2
9724
+       MOV\tuR10,%3
9725
+       MOV\tuR11,%4
9726
+       STO\t%1,8(%0)
9727
+       STO\t%2,9(%0)
9728
+       STO\t%3,10(%0)
9729
+       STO\t%4,11(%0)
9730
+       MOV\tuR12,%1
9731
+       MOV\tuSP,%2
9732
+       MOV\tuCC,%3
9733
+       MOV\tuPC,%4
9734
+       STO\t%1,12(%0)
9735
+       STO\t%2,13(%0)
9736
+       STO\t%3,14(%0)
9737
+       STO\t%4,15(%0)"
9738 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
9739 117 dgisselq
+;
9740
+; See the comment above about why operand 0, %0, *must* be a "+r" operand,
9741
+; even though we don't really read (or change) its value throughout this
9742
+; operation.
9743
+;
9744 102 dgisselq
+(define_insn "zip_restore_context"
9745
+       [(unspec_volatile [
9746 117 dgisselq
+               (match_operand:SI 0 "register_operand" "+r")] UNSPEC_RESTORE_CONTEXT)
9747 102 dgisselq
+       (clobber (match_scratch:SI 1 "=r"))
9748
+       (clobber (match_scratch:SI 2 "=r"))
9749
+       (clobber (match_scratch:SI 3 "=r"))
9750 117 dgisselq
+       (clobber (match_scratch:SI 4 "=r"))]
9751 102 dgisselq
+       "(!ZIP_USER)"
9752
+       "LOD\t0(%0),%1
9753
+       LOD\t1(%0),%2
9754
+       LOD\t2(%0),%3
9755
+       LOD\t3(%0),%4
9756
+       MOV\t%1,uR0
9757
+       MOV\t%2,uR1
9758
+       MOV\t%3,uR2
9759
+       MOV\t%4,uR3
9760
+       LOD\t4(%0),%1
9761
+       LOD\t5(%0),%2
9762
+       LOD\t6(%0),%3
9763
+       LOD\t7(%0),%4
9764
+       MOV\t%1,uR4
9765
+       MOV\t%2,uR5
9766
+       MOV\t%3,uR6
9767
+       MOV\t%4,uR7
9768
+       LOD\t8(%0),%1
9769
+       LOD\t9(%0),%2
9770
+       LOD\t10(%0),%3
9771
+       LOD\t11(%0),%4
9772
+       MOV\t%1,uR8
9773
+       MOV\t%2,uR9
9774
+       MOV\t%3,uR10
9775
+       MOV\t%4,uR11
9776
+       LOD\t12(%0),%1
9777
+       LOD\t13(%0),%2
9778
+       LOD\t14(%0),%3
9779
+       LOD\t15(%0),%4
9780
+       MOV\t%1,uR12
9781
+       MOV\t%2,uSP
9782
+       MOV\t%3,uCC
9783
+       MOV\t%4,uPC"
9784 122 dgisselq
+       [(set_attr "predicable" "no") (set_attr "ccresult" "unchanged")])
9785 102 dgisselq
+(define_insn "zip_bitrev"
9786
+       [(set (match_operand:SI 0 "register_operand" "=r")
9787
+               (unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_BITREV))
9788
+       ]
9789
+       ""
9790
+       "BREV\t%1,%0"
9791 122 dgisselq
+       [(set_attr "ccresult" "unchanged")])
9792 102 dgisselq
+(define_insn "zip_cc"
9793
+       [(set (match_operand:SI 0 "register_operand" "=r")
9794
+               (unspec:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9795
+       ""
9796
+       "MOV\tCC,%0"
9797
+       [(set_attr "ccresult" "unchanged")])
9798 117 dgisselq
+(define_insn "zip_ucc"
9799
+       [(set (match_operand:SI 0 "register_operand" "=r")
9800
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETUCC))]
9801
+       ""
9802
+       "MOV\tuCC,%0"
9803
+       [(set_attr "ccresult" "unchanged")])
9804 111 dgisselq
+(define_insn "zip_cc_sto"
9805
+       [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
9806 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9807 111 dgisselq
+       ""
9808
+       "STO\tCC,(%0)"
9809
+       [(set_attr "ccresult" "unchanged")])
9810
+(define_insn "zip_cc_sto_off"
9811
+       [(set (mem:SI (plus:SI
9812
+                       (match_operand:SI 0 "register_operand" "r")
9813
+                       (match_operand:SI 1 "const_int_operand" "N")))
9814 117 dgisselq
+               (unspec_volatile:SI [(reg:SI CC_REG)] UNSPEC_GETCC))]
9815 111 dgisselq
+       ""
9816
+       "STO\tCC,%1(%0)"
9817
+       [(set_attr "ccresult" "unchanged")])
9818 102 dgisselq
+(define_insn "ldilo"
9819
+       [(set (match_operand:SI 0 "register_operand" "=r")
9820
+               (unspec:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_LDILO))]
9821
+       ""
9822
+       "LDILO  %1,%0"
9823
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9824
+
9825
+;
9826
+;
9827 171 dgisselq
+; Missing still: zip_break(idno)
9828
+; Would also be nice to have a zip_reg builtin, allowing us to read or write
9829
+; a register, as in zip_reg(5)=40;.  Not sure what this means, though, when the
9830
+; number placed into this is not constant, or how to specify that it must *only*
9831
+; be constant.  Thats actually the problem with both proposals, zip_break(id)
9832
+; and zip_reg(regno)--both depend upon a compile time constant to work.
9833 102 dgisselq
+;
9834 171 dgisselq
+;
9835
+
9836
+;
9837
+;
9838
+;
9839 102 dgisselq
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9840
+;;
9841
+;; Floating point Op-codes
9842
+;;
9843
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9844
+;
9845
+;
9846
+;
9847
+(define_insn "addsf3"
9848
+       [(set (match_operand:SF 0 "register_operand" "=r")
9849
+               (plus:SF (match_operand:SF 1 "register_operand" "0")
9850 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9851
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9852 102 dgisselq
+       "(ZIP_FPU)"
9853
+       "FPADD  %2,%0"
9854
+       [(set_attr "ccresult" "unknown")])
9855
+(define_insn "subsf3"
9856
+       [(set (match_operand:SF 0 "register_operand" "=r")
9857
+               (minus:SF (match_operand:SF 1 "register_operand" "0")
9858 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9859
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9860 102 dgisselq
+       "(ZIP_FPU)"
9861
+       "FPSUB  %2,%0"
9862
+       [(set_attr "ccresult" "unknown")])
9863
+(define_insn "mulsf3"
9864
+       [(set (match_operand:SF 0 "register_operand" "=r")
9865
+               (mult:SF (match_operand:SF 1 "register_operand" "0")
9866 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9867
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9868 102 dgisselq
+       "(ZIP_FPU)"
9869
+       "FPMUL  %2,%0"
9870
+       [(set_attr "ccresult" "unknown")])
9871
+(define_insn "divsf3"
9872
+       [(set (match_operand:SF 0 "register_operand" "=r")
9873
+               (div:SF (match_operand:SF 1 "register_operand" "0")
9874 122 dgisselq
+                       (match_operand:SF 2 "register_operand" "r")))
9875
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
9876 102 dgisselq
+       "(ZIP_FPU)"
9877
+       "FPDIV  %2,%0"
9878
+       [(set_attr "ccresult" "unknown")])
9879 111 dgisselq
+(define_expand "negsf2"
9880
+       [(set (match_operand:SF 0 "register_operand" "=r")
9881
+               (neg:SF (match_operand:SF 1 "register_operand" "0")))
9882
+       ]
9883
+       ""
9884
+       {
9885
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
9886
+               if (can_create_pseudo_p()) {
9887
+                       rtx tmp = gen_reg_rtx(SImode);
9888
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x80000000,SImode)));
9889 122 dgisselq
+                       emit_insn(gen_xorsi3(operands[0], operands[0], tmp));
9890 111 dgisselq
+                       DONE;
9891
+               } else {
9892
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9893 122 dgisselq
+                       emit_insn(gen_iorsi3(operands[0], operands[0],
9894
+                               gen_int_mode(1,SImode)));
9895 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9896
+                       DONE;
9897
+               }
9898
+       })
9899
+(define_expand "abssf2"
9900 122 dgisselq
+       [(set (match_operand:SF 0 "register_operand" "=r")
9901
+               (abs:SF (match_operand:SF 1 "register_operand" "0")))
9902 111 dgisselq
+       ]
9903
+       ""
9904
+       {
9905
+               operands[0] = gen_rtx_SUBREG(SImode, operands[0], 0);
9906
+               if (can_create_pseudo_p()) {
9907
+                       rtx tmp = gen_reg_rtx(SImode);
9908
+                       emit_insn(gen_movsi_ldi(tmp,gen_int_mode(0x7fffffff,SImode)));
9909 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0], tmp));
9910 111 dgisselq
+                       DONE;
9911
+               } else {
9912
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9913 122 dgisselq
+                       emit_insn(gen_andsi3(operands[0], operands[0],
9914
+                               gen_int_mode(-2,SImode)));
9915 111 dgisselq
+                       emit_insn(gen_zip_bitrev(operands[0],operands[0]));
9916
+                       DONE;
9917
+               }
9918
+       })
9919 102 dgisselq
+;
9920
+;
9921
+;
9922
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9923
+;;
9924
+;; Trap Instruction
9925
+;;
9926
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9927
+;
9928
+;
9929
+; The ZipCPU doesn't really have a "trap" instruction per se.  The goal is that
9930
+; *nothing* should ever trap, and so we should never get here.  However, the
9931
+; compiler seems to want a trap instruction for some reason.  (It keeps us
9932
+; from calling the abort() function, if we don't define these ...)  So let's
9933
+; just grab onto the break instruction and declare it to be a trap instruction
9934
+; for our purposes.  Alternatively, we might've used a syscall, but ... this
9935
+; will work for both user and system instructions.
9936
+;
9937
+(define_insn "trap"
9938
+       [(trap_if (const_int 1) (const_int 0))]
9939
+       ""
9940
+       "BREAK"
9941
+       [(set_attr "predicable" "yes") (set_attr "ccresult" "unchanged")])
9942
+;
9943
+(define_expand "ctrap<mode>4"
9944 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
9945
+               (match_operand:ZI 1 "register_operand" "r")
9946
+               (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
9947 102 dgisselq
+       (trap_if (match_operator 0 "ordered_comparison_operator"
9948 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9949 102 dgisselq
+                       (match_operand 3 "const_int_operand" "O"))]
9950
+       ""
9951
+       )
9952
+(define_insn "trapif"
9953
+       [(trap_if (match_operator 0 "ordered_comparison_operator"
9954 122 dgisselq
+                       [(reg:CC CC_REG) (const_int 0)])
9955 102 dgisselq
+                       (match_operand 1 "const_int_operand" "O"))]
9956
+       ""
9957
+       "BREAK\t%1"
9958
+       [(set_attr "predicable" "no")])
9959
+;
9960
+;
9961
+;
9962
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9963
+;;
9964
+;; Unimplemented (or not yet implemented) RTL Codes
9965
+;;
9966
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9967
+;
9968
+;
9969
+;
9970
+;(define_insn "sync_compare_and_swapsi"
9971
+;      [(set ...
9972
+;              )]
9973
+;      "(ZIP_ATMOC)"
9974
+;      LOCK            (alu)           // Hmmm ... need to modify if I will
9975
+;      LOD     %1,%0   OP-VALID        // operate on the value before the store
9976
+;      CMP     %0,%2   DCD-valid
9977
+;      STO.Z   %2,%1   PF-valid
9978
+;
9979
+;(define_insn "sync_lock_test_and_setsi"
9980
+;      LOCK
9981
+;      LOD     %1,%0
9982
+;      STO     %0,%1
9983
+;
9984
+;(define_insn "sync_lock_releasesi"
9985
+;      STO     %1,%0
9986
+;
9987
+;
9988
+;(define_insn "negvsi3"
9989
+;      "MOV    %1,%0
9990
+;      XOR     -1,%0
9991
+;      ADD     1,%0
9992
+;      BV      %2"
9993
+;      "")
9994 124 dgisselq
+;
9995
+; Match:
9996
+;      CMP     R1,R0
9997
+;      BGTU    lbl
9998
+; Transform to:
9999
+;      CMP     R0,R1
10000
+;      BC      lbl
10001
+;
10002 117 dgisselq
+(define_peephole2
10003 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
10004
+               (match_operand:SI 0 "register_operand")
10005
+               (match_operand:SI 1 "register_operand")))
10006
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
10007
+                       (label_ref (match_operand 2 ""))
10008 117 dgisselq
+                       (pc)))]
10009 127 dgisselq
+       "(ZIP_PEEPHOLE)"
10010 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 1) (match_dup 0)))
10011
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
10012 117 dgisselq
+                       (label_ref (match_dup 2))
10013
+                       (pc)))]
10014
+       "")
10015 127 dgisselq
+(define_peephole2
10016
+       [(match_scratch:SI 3 "=r")
10017
+       (set (reg:CC CC_REG) (compare:CC
10018
+               (match_operand:SI 0 "register_operand")
10019
+               (match_operand 1 "const_int_operand")))
10020
+       (match_dup 3)
10021
+       (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
10022
+                       (label_ref (match_operand 2 ""))
10023
+                       (pc)))]
10024
+       "(ZIP_PEEPHOLE)"
10025
+       [(set (match_dup 3) (match_dup 1))
10026
+       (set (reg:CC CC_REG) (compare:CC (match_dup 3) (match_dup 0)))
10027
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
10028
+                       (label_ref (match_dup 2))
10029
+                       (pc)))]
10030
+       "")
10031
+;(define_peephole2
10032
+;      [(set (reg:CC CC_REG) (compare:CC
10033
+;              (match_operand:SI 0 "register_operand")
10034
+;              (match_operand 1 "const_int_operand")))
10035
+;      (set (pc) (if_then_else (gtu (reg:CC CC_REG) (const_int 0))
10036
+;                      (label_ref (match_operand 2 ""))
10037
+;                      (pc)))]
10038
+;      ""
10039
+;      [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
10040
+;      (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
10041
+;                      (label_ref (match_dup 2))
10042
+;                      (pc)))]
10043
+;      "operands[1] = GEN_INT(INTVAL(operands[1])-1);")
10044 124 dgisselq
+;
10045
+;
10046
+; Match:
10047
+;      CMP     R1,R0
10048
+;      BGEU    lbl
10049
+; Transform to:
10050
+;      CMP     1(R0),R1
10051
+;      BC      lbl
10052
+;
10053 117 dgisselq
+(define_peephole2
10054 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
10055
+               (match_operand:SI 0 "register_operand")
10056
+               (match_operand:SI 1 "register_operand")))
10057
+       (set (pc) (if_then_else (geu (reg:CC CC_REG) (const_int 0))
10058
+                       (label_ref (match_operand 2 ""))
10059 117 dgisselq
+                       (pc)))]
10060 127 dgisselq
+       "(ZIP_PEEPHOLE)"
10061 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
10062 146 dgisselq
+               (match_dup 1) (plus:SI (match_dup 0) (const_int 1))))
10063 122 dgisselq
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
10064 117 dgisselq
+                       (label_ref (match_dup 2))
10065
+                       (pc)))]
10066
+       "")
10067 124 dgisselq
+;
10068
+;
10069
+; Match:
10070
+;      CMP     R1,R0
10071
+;      BGE     lbl
10072
+; Transform to:
10073
+;      CMP     1(R0),R1
10074
+;      BLT     lbl
10075 142 dgisselq
+; ... why?  when we support a BGE instruction?
10076
+;(define_peephole2
10077
+       ;[(set (reg:CC CC_REG) (compare:CC
10078
+               ;(match_operand:SI 0 "register_operand")
10079
+               ;(match_operand:SI 1 "register_operand")))
10080
+       ;(set (pc) (if_then_else (ge (reg:CC CC_REG) (const_int 0))
10081
+                       ;(label_ref (match_operand 2 ""))
10082
+                       ;(pc)))]
10083
+       ;"(ZIP_PEEPHOLE)"
10084
+       ;[(set (reg:CC CC_REG) (compare:CC (match_dup 1)
10085
+                       ;(plus:SI (match_dup 0) (const_int 1))))
10086
+       ;(set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
10087
+                       ;(label_ref (match_dup 2))
10088
+                       ;(pc)))]
10089
+       ;"")
10090 124 dgisselq
+;
10091
+;
10092
+; Match:
10093
+;      CMP     R1,R0
10094
+;      BLEU    lbl
10095
+; Transform to:
10096
+;      CMP     1(R1),R0
10097 142 dgisselq
+;      BC      lbl
10098 124 dgisselq
+;
10099 117 dgisselq
+(define_peephole2
10100 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC
10101
+               (match_operand:SI 0 "register_operand" "")
10102 117 dgisselq
+               (match_operand:SI 1 "register_operand" "")))
10103 122 dgisselq
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
10104 117 dgisselq
+                       (label_ref (match_operand 2 "" ""))
10105
+                       (pc)))]
10106 127 dgisselq
+       "(ZIP_PEEPHOLE)"
10107 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
10108 146 dgisselq
+                       (plus:SI (match_dup 1) (const_int 1))))
10109 122 dgisselq
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
10110 117 dgisselq
+                       (label_ref (match_dup 2))
10111
+                       (pc)))]
10112
+       "")
10113
+;
10114 142 dgisselq
+;
10115
+;
10116
+; Match:
10117
+;      CMP     R1,R0
10118
+;      BLE     lbl
10119
+; Transform to:
10120
+;      CMP     1(R1),R0
10121
+;      BLT     lbl
10122
+;
10123 127 dgisselq
+(define_peephole2
10124
+       [(set (reg:CC CC_REG)
10125
+               (compare:CC (match_operand:SI 0 "register_operand" "")
10126
+                       (match_operand:SI 1 "const_int_operand" "")))
10127
+       (set (pc) (if_then_else (le (reg:CC CC_REG) (const_int 0))
10128
+                       (label_ref (match_operand 2 "" ""))
10129
+                       (pc)))]
10130
+       "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
10131
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
10132
+       (set (pc) (if_then_else (lt (reg:CC CC_REG) (const_int 0))
10133
+                       (label_ref (match_dup 2))
10134
+                       (pc)))]
10135
+       "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
10136 142 dgisselq
+;
10137
+; Match:
10138
+;      CMP     R1,R0
10139
+;      BLEU    lbl
10140
+; Transform to:
10141
+;      CMP     1(R1),R0
10142
+;      BC(LTU) lbl
10143
+;
10144 127 dgisselq
+(define_peephole2
10145
+       [(set (reg:CC CC_REG)
10146
+               (compare:CC (match_operand:SI 0 "register_operand" "")
10147
+                       (match_operand:SI 1 "const_int_operand" "")))
10148
+       (set (pc) (if_then_else (leu (reg:CC CC_REG) (const_int 0))
10149
+                       (label_ref (match_operand 2 "" ""))
10150
+                       (pc)))]
10151
+       "(ZIP_PEEPHOLE)&&(INTVAL(operands[1])<((1<<17)-2))"
10152
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0) (match_dup 1)))
10153 142 dgisselq
+       (set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0))
10154 127 dgisselq
+                       (label_ref (match_dup 2))
10155
+                       (pc)))]
10156
+       "operands[1] = GEN_INT(INTVAL(operands[1])+1);")
10157 102 dgisselq
+;
10158 117 dgisselq
+;
10159
+;
10160
+;
10161 127 dgisselq
+; Match:
10162
+;      (parallel [(set () ()) (clobber (CC))])
10163
+;      (compare () ())
10164
+; Transform to:
10165
+;      (parallel [(set () ()) (set (CC) (0))]
10166
+;      (compare () ())
10167 117 dgisselq
+;
10168 127 dgisselq
+(define_peephole2
10169
+       [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
10170
+               (clobber (reg:CC CC_REG))])
10171
+       (set (reg:CC CC_REG) (compare:CC (match_operand:SI 2 "")
10172
+                       (match_operand:SI 3 "")))]
10173
+       "(ZIP_PEEPHOLE)&&zip_insn_sets_cc(insn)"
10174
+       [(parallel [(set (match_dup 0) (match_dup 1))
10175
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10176
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (match_dup 3)))]
10177
+       "")
10178
+;
10179
+;
10180
+;
10181 122 dgisselq
+; Match:
10182 127 dgisselq
+;      (parallel [(set () ()) (clobber (CC))])
10183
+;      (set () ())
10184
+;      (compare () ())
10185
+; Transform to:
10186
+;      (parallel [(set () ()) (set (CC) (0))]
10187
+;      (set () ())
10188
+;      (compare () ())
10189
+;
10190
+(define_peephole2
10191
+       [(parallel [(set (match_operand:SI 0 "") (match_operand:SI 1 ""))
10192
+               (clobber (reg:CC CC_REG))])
10193
+       (set (match_operand 2 "") (match_operand 3 ""))
10194
+       (set (reg:CC CC_REG) (compare:CC (match_operand:SI 4 "")
10195
+                       (match_operand:SI 5 "")))]
10196
+       "(ZIP_PEEPHOLE)&&(zip_insn_sets_cc(insn))&&((!REG_P(operands[2]))||(REGNO(operands[2])!=CC_REG))"
10197
+       [(parallel [(set (match_dup 0) (match_dup 1))
10198
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10199
+       (set (match_dup 2) (match_dup 3))
10200
+       (set (reg:CC CC_REG) (compare:CC (match_dup 4) (match_dup 5)))]
10201
+       "")
10202
+;
10203
+;
10204
+;
10205
+; Match:
10206 122 dgisselq
+;      MOV A(R1),R3
10207
+;      CMP R3,R0
10208
+;      (R3 is dead)
10209
+; Transform to:
10210
+;      CMP A(R1),R0
10211
+;
10212
+(define_peephole2
10213
+       [(set (match_operand:SI 3 "register_operand")
10214
+               (plus:SI (match_operand:SI 1 "register_operand")
10215
+                       (match_operand:SI 2 "zip_mvimm_operand_p")))
10216
+       (set (reg:CC CC_REG)
10217
+               (compare:CC (match_operand:SI 0 "register_operand")
10218
+                       (match_dup 3)))]
10219 127 dgisselq
+       "(ZIP_PEEPHOLE)&&peep2_regno_dead_p(2, REGNO(operands[3]))"
10220 122 dgisselq
+       [(set (reg:CC CC_REG) (compare:CC (match_dup 0)
10221
+               (plus:SI (match_dup 1) (match_dup 2))))]
10222
+       "")
10223
+;
10224
+;
10225
+; Match:
10226
+;      ALU OpB,R0
10227
+;      CMP 0,R0
10228
+; Transform to:
10229
+;      ALU OpB,R0
10230
+;
10231
+(define_peephole2
10232 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10233
+                       (match_operand:SI 1 ""))
10234 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10235
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
10236 127 dgisselq
+       "(ZIP_PEEPHOLE)"
10237 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
10238
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10239
+       ])
10240
+;
10241
+;
10242
+; Match:
10243
+;      ALU OpB,R0
10244
+;      MOV R1,R2       // Can be LDI, LOD, STO, etc.
10245 127 dgisselq
+;      CMP 0,R0
10246 122 dgisselq
+; Transform to:
10247
+;      ALU OpB,R0
10248
+;      MOV R0,R1
10249
+;
10250
+(define_peephole2
10251 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10252
+                       (match_operand:SI 1 ""))
10253 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10254 124 dgisselq
+       (set (match_operand:SI 2 "nonimmediate_operand") (match_operand:SI 3 ""))
10255 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
10256 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))))"
10257 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
10258
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10259
+       (set (match_dup 2) (match_dup 3))
10260
+       ])
10261
+;
10262
+;
10263
+; Match:
10264
+;      ALU OpB,R0
10265
+;      MOV R0,R1
10266
+;      CMP 0,R1
10267
+; Transform to:
10268
+;      ALU OpB,R0
10269
+;      MOV R0,R1
10270
+;
10271
+(define_peephole2
10272 124 dgisselq
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10273
+                       (match_operand:SI 1 ""))
10274 122 dgisselq
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10275 124 dgisselq
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))
10276 122 dgisselq
+       (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))]
10277 127 dgisselq
+       "(ZIP_PEEPHOLE)"
10278 122 dgisselq
+       [(parallel [(set (match_dup 0) (match_dup 1))
10279
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10280
+       (set (match_dup 2) (match_dup 3))
10281
+       ])
10282
+;
10283 124 dgisselq
+;
10284
+; Match:
10285
+;      MOV R1,R0
10286
+;      ADD $x,R0
10287
+;      (CCREG is dead, and x is within range ...)
10288
+; Transform to:
10289 127 dgisselq
+;      MOV $x(R1),R0
10290 124 dgisselq
+(define_peephole2
10291
+       [(set (match_operand:SI 0 "register_operand")
10292
+               (match_operand:SI 1 "register_operand"))
10293
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
10294
+                               (match_operand 2 "zip_mvimm_operand_p")))
10295
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10296
+       ]
10297 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))"
10298 124 dgisselq
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])
10299
+;
10300 127 dgisselq
+; Match:
10301
+;      MOV A(R0),R0
10302
+;      ADD $x,R1
10303
+;      (CCREG is dead, and (A+x) is within range ...)
10304
+; Transform to:
10305
+;      MOV $x(R1),R0
10306 124 dgisselq
+;
10307 127 dgisselq
+(define_peephole2
10308
+       [(set (match_operand:SI 0 "register_operand")
10309
+               (plus:SI (match_operand:SI 1 "register_operand")
10310
+                       (match_operand 2 "zip_mvimm_operand_p")))
10311
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0)
10312
+                               (match_operand 3 "zip_mvimm_operand_p")))
10313
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10314
+       ]
10315
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
10316
+               &&(INTVAL(operands[2])+INTVAL(operands[3])<((1<<17)))
10317
+               &&(INTVAL(operands[2])+INTVAL(operands[3])>=-(1<<17))"
10318
+       [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))]
10319
+       "operands[2]=GEN_INT(INTVAL(operands[2])+INTVAL(operands[3]));")
10320 124 dgisselq
+;
10321 127 dgisselq
+;
10322
+;
10323 124 dgisselq
+; Match:
10324
+;      ADD $x,R0
10325
+;      MOV R0,R1
10326
+;      (CCREG is dead, and R0 is dead)
10327
+; Transform to:
10328
+;      MOV (A+$x)(R0),R1
10329
+; ... again, how do I build this plus?
10330
+;
10331
+(define_peephole2
10332
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10333
+                       (plus:SI (match_dup 0)
10334
+                               (match_operand 1 "zip_mvimm_operand_p")))
10335
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10336
+       (set (match_operand:SI 2 "register_operand") (match_dup 0))]
10337 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2, REGNO(operands[0])))&&(peep2_regno_dead_p(2,CC_REG))"
10338 124 dgisselq
+       [(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))])
10339
+;
10340
+;
10341 127 dgisselq
+;
10342 124 dgisselq
+; Match:
10343 127 dgisselq
+;      ADD $x,R0
10344
+;      MOV A(R0),R1
10345
+;      (CCREG is dead, and R0 is dead)
10346
+; Transform to:
10347
+;      MOV (A+$x)(R0),R1
10348
+;
10349
+(define_peephole2
10350
+       [(parallel [
10351
+               (set (match_operand:SI 0 "register_operand")
10352
+                       (plus:SI (match_dup 0)
10353
+                               (match_operand 1 "zip_mvimm_operand_p")))
10354
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10355
+       (set (match_operand:SI 2 "register_operand")
10356
+               (plus:SI (match_dup 0)
10357
+                       (match_operand 3 "zip_mvimm_operand_p")))
10358
+       ]
10359
+       "(ZIP_PEEPHOLE)&&(peep2_regno_dead_p(2,CC_REG))
10360
+               &&(peep2_regno_dead_p(1,REGNO(operands[0])))
10361
+               &&(INTVAL(operands[1])+INTVAL(operands[3])<((1<<17)))
10362
+               &&(INTVAL(operands[1])+INTVAL(operands[3])>=-(1<<17))"
10363
+       [(set (match_dup 0) (plus:SI (match_dup 2) (match_dup 3)))]
10364
+       "operands[3]=GEN_INT(INTVAL(operands[1])+INTVAL(operands[3]));")
10365
+;
10366
+;
10367
+;
10368
+; Match:
10369 124 dgisselq
+;      ADD     $x,R0
10370
+;      ADD     R0,Rn
10371
+;      (R0 is dead, if R0 is not Rn)
10372
+; Transform to:
10373
+;      ADD     $x(R0),Rn
10374
+;
10375
+(define_peephole2
10376
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10377
+                       (plus:SI (match_dup 0)
10378
+                               (match_operand 1 "zip_opb_immv_p")))
10379
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10380
+       (parallel [(set (match_operand:SI 2 "register_operand")
10381
+                       (plus:SI (match_dup 2) (match_dup 0)))
10382
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
10383
+       ]
10384 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[2]))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
10385 124 dgisselq
+       [(parallel [(set (match_dup 2)
10386
+                       (plus:SI (match_dup 2)
10387
+                               (plus:SI (match_dup 0)
10388
+                                       (match_dup 1))))
10389
+               (set (reg:CC CC_REG) (compare:CC (match_dup 2) (const_int 0)))])
10390
+       ])
10391
+;
10392
+; Match:
10393
+;      ADD     $x,R0
10394
+;      LOD     -x(R0),R1
10395
+; Transform to:
10396
+;      LOD     (R0),R1
10397
+;      ADD     $x,R0
10398
+;
10399
+(define_peephole2
10400
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10401
+                       (plus:SI (match_dup 0)
10402
+                               (match_operand 1 "zip_opb_immv_p")))
10403
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10404
+       (set (match_operand:SI 3 "register_operand")
10405
+               (mem:SI (plus:SI (match_dup 0)
10406
+                       (match_operand 2 "zip_opb_immv_p"))))
10407
+       ]
10408 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10409 124 dgisselq
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
10410
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10411
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10412
+       ])
10413 127 dgisselq
+(define_peephole2
10414
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10415
+                       (plus:SI (match_dup 0)
10416
+                               (match_operand 1 "zip_opb_immv_p")))
10417
+               (clobber (reg:CC CC_REG))])
10418
+       (set (match_operand:SI 3 "register_operand")
10419
+               (mem:SI (plus:SI (match_dup 0)
10420
+                       (match_operand 2 "zip_opb_immv_p"))))
10421
+       ]
10422
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10423
+       [(set (match_dup 3) (mem:SI (match_dup 0)))
10424
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10425
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10426
+       ])
10427 124 dgisselq
+;
10428
+;
10429
+;
10430
+; Match:
10431
+;      ADD     $x,R0
10432
+;      STO     R1,-x(R0)
10433
+; Transform to:
10434
+;      STO     R1,(R0)
10435
+;      ADD     $x,R0
10436
+;
10437
+(define_peephole2
10438
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10439
+                       (plus:SI (match_dup 0)
10440
+                               (match_operand 1 "zip_opb_immv_p")))
10441
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10442
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
10443
+               (match_operand:SI 3 "register_operand"))
10444
+       ]
10445 127 dgisselq
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10446 124 dgisselq
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
10447
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10448
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10449
+       ])
10450 127 dgisselq
+(define_peephole2
10451
+       [(parallel [(set (match_operand:SI 0 "register_operand")
10452
+                       (plus:SI (match_dup 0)
10453
+                               (match_operand 1 "zip_opb_immv_p")))
10454
+               (clobber (reg:CC CC_REG))])
10455
+       (set (mem:SI (plus:SI (match_dup 0) (match_operand 2 "zip_opb_immv_p")))
10456
+               (match_operand:SI 3 "register_operand"))
10457
+       ]
10458
+       "(ZIP_PEEPHOLE)&&(REGNO(operands[0])!=REGNO(operands[1]))&&(INTVAL(operands[1])==-INTVAL(operands[2]))"
10459
+       [(set (mem:SI (match_dup 0)) (match_dup 3))
10460
+       (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
10461
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10462
+       ])
10463 124 dgisselq
+;
10464
+;
10465
+; Match:
10466
+;      ADD     $x,R0
10467
+;      ANY     R1,R2 (destination is not R0, source does not reference R0)
10468
+;      ADD     R0,Rn (could be 1 or 2, not 0)
10469
+;      (R0 is dead)
10470
+; Transform to:
10471
+;      ANY     R1,R2
10472
+;      ADD     $x(R0),Rn
10473
+;
10474
+;
10475
+;
10476 127 dgisselq
+; Match:
10477
+;      MOV     R1,R0
10478
+;      AND     #/R2,R0
10479
+;      (Ry dead ...)
10480
+; Transform to:
10481
+;      TEST    #/Rz,Rx
10482 124 dgisselq
+;
10483 127 dgisselq
+(define_peephole2
10484
+       [(set (match_operand:SI 0 "register_operand")
10485
+               (match_operand:SI 1 "register_operand"))
10486
+       (parallel [(set (match_dup 0)
10487
+                       (and:SI (match_dup 0)
10488
+                               (match_operand:SI 2 "zip_opb_single_operand_p")))
10489
+               (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])
10490
+       ]
10491
+       "((1)||(ZIP_PEEPHOLE))&&(peep2_regno_dead_p(2, REGNO(operands[0])))"
10492
+       [(set (reg:CC CC_REG) (compare:CC (and:ZI (match_dup 1) (match_dup 2))
10493
+                       (const_int 0)))])
10494
+;
10495
+; Match:
10496
+;      (call ...
10497
+;      (set (pc) (label))
10498
+;  or (in asm)
10499
+;      MOV     .Lcallx(PC),R0
10500
+;      BRA     (somewhere)
10501
+; .Lcallx
10502
+;      BRA     (somewhere-else)
10503
+; Transform to:
10504
+;
10505
+;      (sequence [(call ...
10506
+;              (set (pc) (label))])
10507
+;   or (in asm)
10508
+;      "LDI    (somewhere-else),R0
10509
+;      BRA     subroutine"
10510
+;
10511
+; While the following looks good, it doesnt work.  My guess is that the reason
10512
+; why it doesnt work is that the jump at the end crosses basic block boundaries.
10513
+;
10514
+;(define_insn "void_call_mem_unspec"
10515
+;      [(call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p" ""))] UNSPEC_RAW_CALL)
10516
+;                      (match_operand 1 "const_int_operand" "n"))
10517
+;              (clobber (reg:SI RTN_REG))
10518
+;              (clobber (reg:CC CC_REG))]
10519
+;      ""
10520
+;      "BRA\t%0,PC"
10521
+;      [(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
10522
+;(define_peephole2
10523
+;      [(parallel [(call (mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))
10524
+;                      (match_operand 1 "const_int_operand"))
10525
+;              (clobber (reg:SI RTN_REG))
10526
+;              (clobber (reg:CC CC_REG))])
10527
+;      ; The match operand for the (set (pc) ...) cannot have anything but
10528
+;      ; VOIDmode, or it wont match.
10529
+;      (set (pc) (match_operand:VOID 2 "zip_const_address_operand_p"))]
10530
+;      ""
10531
+;      [(set (reg:SI RTN_REG) (match_dup 2))
10532
+;      (call (unspec:SI [(mem:SI (match_operand:VOID 0 "zip_const_address_operand_p"))] UNSPEC_RAW_CALL)
10533
+;                      (match_operand 1 "const_int_operand"))
10534
+;              (use (reg:SI RTN_REG))
10535
+;              (clobber (reg:SI RTN_REG))
10536
+;              (clobber (reg:CC CC_REG))]
10537
+;      "fprintf(stderr, \"CALL-JUMP Matched\");")
10538
+;
10539
+;
10540
+;
10541
+; So, the following *should* have worked as well.  However, this falls apart
10542
+; because the 'final' routine can't tell if we are calling a subroutine in this
10543
+; function or not.
10544
+;
10545
+;(define_peephole
10546
+       ;[(parallel [(call (mem:SI (match_operand:SI 0 "zip_const_address_operand_p"))
10547
+                       ;(match_operand 1 "const_int_operand"))
10548
+               ;(clobber (reg:SI RTN_REG))
10549
+               ;(clobber (reg:CC CC_REG))])
10550
+       ;(set (pc) (label_ref (match_operand 2 "")))]
10551
+       ;""
10552
+       ;"LDI\t%2,R0\;BRA\t%0"
10553
+       ;[(set_attr "predicable" "no") (set_attr "ccresult" "unknown")])
10554
+;
10555 124 dgisselq
+; and for
10556
+;      BRA target
10557
+;      BRA target ; two branches to the same identical target in a row ...
10558
+;
10559
+;
10560
+;
10561 102 dgisselq
+; STILL MISSING:
10562
+;      SYSCALL(ID)
10563
+;              MOV %ID,R0
10564
+;              CLR     CC
10565
+;      cmove   ... the conditional move, created from a
10566
+;      (set (match_op 0 "" "r") (if_then_else (condition) (a) (reg X))))
10567
+;      pattern
10568
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
10569
--- gcc-5.3.0-original/gcc/config/zip/zip-modes.def     1969-12-31 19:00:00.000000000 -0500
10570 111 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-modes.def  2016-03-08 12:10:21.982586940 -0500
10571
@@ -0,0 +1,23 @@
10572 102 dgisselq
+/*
10573
+ * Commends in C-long comment form
10574
+ * class
10575
+ *     Mode = "SI"
10576
+ *     PRECISION, BYTESIZE, COUNT ??
10577
+ *     FORMAT
10578
+ *     EXPR
10579 111 dgisselq
+ *
10580
+ * The manual says I need to define BITS_PER_UNIT here.
10581 102 dgisselq
+ */
10582
+// INT_MODE(QI, 1);
10583
+// INT_MODE(HI, 1);
10584
+// INT_MODE(SI, 1);
10585
+// INT_MODE(DI, 2);
10586
+
10587
+// FLOAT_MODE(SF, 1, ieee_single_format);
10588
+// FLOAT_MODE(DF, 2, ieee_single_format);
10589
+
10590
+// We cannot override machmodes.def from here.  Thus, even though our QI,
10591
+// HI, and SI modes are all 1-byte, we cant set them that way here.  The
10592
+// change needed to be made in machmodes.def.  Hence, here is a target
10593
+// configuration change--in machmodes.def--that properly belonged in the
10594
+// config directory.
10595
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
10596
--- gcc-5.3.0-original/gcc/config/zip/zip-protos.h      1969-12-31 19:00:00.000000000 -0500
10597 191 dgisselq
+++ gcc-5.3.0-zip/gcc/config/zip/zip-protos.h   2016-09-13 15:32:55.403521585 -0400
10598
@@ -0,0 +1,81 @@
10599 102 dgisselq
+////////////////////////////////////////////////////////////////////////////////
10600
+//
10601
+// Filename:   zip-protos.h
10602
+//
10603
+// Project:    Zip CPU backend for the GNU Compiler Collection
10604
+//
10605
+// Purpose:
10606
+//
10607
+// Creator:    Dan Gisselquist, Ph.D.
10608
+//             Gisselquist Technology, LLC
10609
+//
10610
+////////////////////////////////////////////////////////////////////////////////
10611
+//
10612
+// Copyright (C) 2016, Gisselquist Technology, LLC
10613
+//
10614
+// This program is free software (firmware): you can redistribute it and/or
10615
+// modify it under the terms of  the GNU General Public License as published
10616
+// by the Free Software Foundation, either version 3 of the License, or (at
10617
+// your option) any later version.
10618
+//
10619
+// This program is distributed in the hope that it will be useful, but WITHOUT
10620
+// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
10621
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
10622
+// for more details.
10623
+//
10624
+// You should have received a copy of the GNU General Public License along
10625
+// with this program.  (It's in the $(ROOT)/doc directory, run make with no
10626
+// target there if the PDF file isn't present.)  If not, see
10627
+// <http://www.gnu.org/licenses/> for a copy.
10628
+//
10629
+// License:    GPL, v3, as defined and found on www.gnu.org,
10630
+//             http://www.gnu.org/licenses/gpl.html
10631
+//
10632
+//
10633
+////////////////////////////////////////////////////////////////////////////////
10634
+#ifndef        ZIP_PROTOS_H
10635
+#define        ZIP_PROTOS_H
10636
+
10637 127 dgisselq
+extern bool    zip_supported_condition(int c);
10638 102 dgisselq
+extern void    zip_expand_prologue(void);
10639
+extern void    zip_expand_epilogue(void);
10640 191 dgisselq
+extern void    zip_sibcall_epilogue(void);
10641 142 dgisselq
+extern bool    zip_expand_movsicc(rtx,rtx,rtx,rtx);
10642 102 dgisselq
+extern int     zip_initial_elimination_offset(int, int);
10643
+extern void    zip_print_operand(FILE *, rtx, int);
10644
+extern void    zip_print_operand_address(FILE *, rtx);
10645
+extern enum    reg_class       zip_reg_class(int);
10646
+extern rtx     zip_return_addr_rtx(int, rtx);
10647
+extern int     zip_num_arg_regs(enum machine_mode, tree);
10648
+
10649
+extern void    zip_asm_output_def(FILE *s, const char *n, const char *v);
10650 122 dgisselq
+
10651
+extern void    zip_canonicalize_comparison(int *, rtx *, rtx *, bool);
10652 191 dgisselq
+extern bool    zip_function_ok_for_sibcall(tree, tree);
10653 102 dgisselq
+extern int     zip_address_operand(rtx op);
10654
+extern int     zip_const_address_operand(rtx op);
10655
+extern bool    zip_gen_move_rtl(rtx, rtx);
10656
+extern bool    zip_use_return_insn(void);
10657
+extern const char *zip_set_zero_or_one(rtx, rtx);
10658
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
10659
+
10660 127 dgisselq
+extern int     zip_insn_sets_cc(rtx_insn *insn);
10661
+extern int     zip_is_conditional(rtx_insn *insn);
10662 102 dgisselq
+extern int     zip_ct_address_operand(rtx op);
10663 111 dgisselq
+extern int     zip_pd_opb_operand(rtx op);
10664 102 dgisselq
+extern int     zip_pd_mov_operand(rtx op);
10665 111 dgisselq
+extern int     zip_pd_imm_operand(rtx op);
10666
+extern int     zip_pd_mvimm_operand(rtx op);
10667 102 dgisselq
+extern int     zip_ct_const_address_operand(rtx op);
10668
+extern int     zip_pd_const_address_operand(rtx op);
10669
+extern const char *zip_movsicc(rtx, rtx, rtx, rtx);
10670
+extern const char *zip_addsicc(rtx, rtx, rtx, rtx);
10671
+
10672 122 dgisselq
+extern void    zip_ifcvt_machdep_init(struct ce_if_block *ceinfo);
10673
+extern void    zip_ifcvt_modify_cancel(struct ce_if_block *ceinfo);
10674
+extern void    zip_ifcvt_modify_final(struct ce_if_block *ceinfo);
10675
+extern void    zip_ifcvt_modify_tests(struct ce_if_block *ceinfo, rtx *true_expr, rtx *false_expr);
10676 142 dgisselq
+extern void    zip_ifcvt_modify_insn(struct ce_if_block *ceinfo, rtx pattern, rtx_insn *insn);
10677 122 dgisselq
+
10678 102 dgisselq
+#endif
10679
+
10680
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config.gcc gcc-5.3.0-zip/gcc/config.gcc
10681
--- gcc-5.3.0-original/gcc/config.gcc   2015-09-10 10:17:53.000000000 -0400
10682
+++ gcc-5.3.0-zip/gcc/config.gcc        2016-02-14 00:53:37.389411987 -0500
10683
@@ -479,6 +479,10 @@
10684
 tilepro*-*-*)
10685
        cpu_type=tilepro
10686
        ;;
10687
+zip*)
10688
+       cpu_type=zip
10689
+       tmake_file=zip/t-zip
10690
+       ;;
10691
 esac
10692
 
10693
 tm_file=${cpu_type}/${cpu_type}.h
10694
@@ -2972,6 +2976,15 @@
10695
        c_target_objs="m32c-pragma.o"
10696
        cxx_target_objs="m32c-pragma.o"
10697
        ;;
10698
+zip-*-netbsd*)
10699
+       tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h zip/netbsd.h"
10700
+       tmake_file="${tmake_file} zip/t-zip"
10701
+       ;;
10702
+zip*)
10703
+       target_has_targetm_common=yes
10704
+       tm_file="elfos.h newlib-stdint.h ${tm_file}"
10705
+       tmake_file="${tmake_file} zip/t-zip"
10706
+       ;;
10707
 *)
10708
        echo "*** Configuration ${target} not supported" 1>&2
10709
        exit 1
10710
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
10711
--- gcc-5.3.0-original/gcc/cse.c        2015-02-03 15:41:38.000000000 -0500
10712 138 dgisselq
+++ gcc-5.3.0-zip/gcc/cse.c     2016-05-04 11:07:38.874831028 -0400
10713
@@ -70,6 +70,7 @@
10714
 #include "dbgcnt.h"
10715
 #include "rtl-iter.h"
10716
 
10717
+
10718
 /* The basic idea of common subexpression elimination is to go
10719
    through the code, keeping a record of expressions that would
10720
    have the same value at the current scan point, and replacing
10721
@@ -634,6 +635,16 @@
10722 102 dgisselq
 
10723
 /* Nonzero if X has the form (PLUS frame-pointer integer).  */
10724
 
10725 111 dgisselq
+// #define     DO_ZIP_DEBUGS
10726 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
10727
+#include <stdio.h>
10728 138 dgisselq
+extern void    zip_debug_rtx(const_rtx);
10729
+extern void    zip_debug_rtx_pfx(char *, const_rtx);
10730 102 dgisselq
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
10731
+#else
10732
+#define        ZIP_DEBUG_LINE(STR,RTX)
10733
+#endif
10734
+
10735
 static bool
10736
 fixed_base_plus_p (rtx x)
10737
 {
10738 138 dgisselq
@@ -2898,6 +2909,7 @@
10739 102 dgisselq
          validate_canon_reg (&XVECEXP (x, i, j), insn);
10740
     }
10741
 
10742
+       ZIP_DEBUG_LINE("CANON-REG-RTN", x);
10743
   return x;
10744
 }
10745
 
10746 138 dgisselq
@@ -3125,6 +3137,8 @@
10747
   rtx new_rtx = 0;
10748
   int changed = 0;
10749
 
10750
+ZIP_DEBUG_LINE("CSE:FOLD-RTX", insn);
10751
+
10752
   /* Operands of X.  */
10753
   /* Workaround -Wmaybe-uninitialized false positive during
10754
      profiledbootstrap by initializing them.  */
10755
@@ -3144,14 +3158,16 @@
10756 102 dgisselq
   if (x == 0)
10757
     return x;
10758
 
10759
+       ZIP_DEBUG_LINE("FOLD-RTX", x);
10760
   /* Try to perform some initial simplifications on X.  */
10761
   code = GET_CODE (x);
10762
   switch (code)
10763
     {
10764
     case MEM:
10765
     case SUBREG:
10766
-      if ((new_rtx = equiv_constant (x)) != NULL_RTX)
10767
-        return new_rtx;
10768
+      if ((new_rtx = equiv_constant (x)) != NULL_RTX) {
10769
+       ZIP_DEBUG_LINE("FOLD-RTX-NEW", new_rtx);
10770
+        return new_rtx; }
10771
       return x;
10772
 
10773
     case CONST:
10774 138 dgisselq
@@ -3208,6 +3224,8 @@
10775 102 dgisselq
        rtx folded_arg = XEXP (x, i), const_arg;
10776
        machine_mode mode_arg = GET_MODE (folded_arg);
10777
 
10778
+       ZIP_DEBUG_LINE("FOLD-RTX-ARG = ", folded_arg);
10779
+
10780
        switch (GET_CODE (folded_arg))
10781
          {
10782
          case MEM:
10783 138 dgisselq
@@ -3317,6 +3335,7 @@
10784 102 dgisselq
        }
10785
 
10786
       apply_change_group ();
10787
+       ZIP_DEBUG_LINE("FOLD-RTX-CANONICALIZED = ", insn);
10788
     }
10789
 
10790
   /* If X is an arithmetic operation, see if we can simplify it.  */
10791 138 dgisselq
@@ -4203,6 +4222,7 @@
10792 102 dgisselq
 {
10793
   rtx dest = SET_DEST (set);
10794
   rtx src = SET_SRC (set);
10795
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG", insn);
10796
 
10797
   if (REG_P (dest)
10798
       && REG_P (src) && ! HARD_REGISTER_P (src)
10799 138 dgisselq
@@ -4258,6 +4278,7 @@
10800 102 dgisselq
            }
10801
        }
10802
     }
10803
+       ZIP_DEBUG_LINE("TRY-BACK-SUBSTITUTE-REG, done", insn);
10804
 }
10805
 
10806
 /* Record all the SETs in this instruction into SETS_PTR,
10807 138 dgisselq
@@ -4351,6 +4372,7 @@
10808 102 dgisselq
   rtx tem;
10809
   rtx x = PATTERN (insn);
10810
   int i;
10811
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN", insn);
10812
 
10813
   if (CALL_P (insn))
10814
     {
10815 138 dgisselq
@@ -4364,6 +4386,7 @@
10816 102 dgisselq
       canon_reg (SET_SRC (x), insn);
10817
       apply_change_group ();
10818
       fold_rtx (SET_SRC (x), insn);
10819
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN, was set:", insn);
10820
     }
10821
   else if (GET_CODE (x) == CLOBBER)
10822
     {
10823 138 dgisselq
@@ -4400,6 +4423,7 @@
10824 102 dgisselq
     canon_reg (PATTERN (insn), insn);
10825
   else if (GET_CODE (x) == PARALLEL)
10826
     {
10827
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/parallel", insn);
10828
       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
10829
        {
10830
          rtx y = XVECEXP (x, 0, i);
10831 138 dgisselq
@@ -4491,6 +4515,7 @@
10832 102 dgisselq
 
10833
      The result of apply_change_group can be ignored; see canon_reg.  */
10834
 
10835
+       ZIP_DEBUG_LINE("CANONICALIZE-INSN/done", insn);
10836
   apply_change_group ();
10837
 }
10838
 
10839
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/defaults.h gcc-5.3.0-zip/gcc/defaults.h
10840
--- gcc-5.3.0-original/gcc/defaults.h   2015-03-03 10:04:02.000000000 -0500
10841
+++ gcc-5.3.0-zip/gcc/defaults.h        2016-02-06 16:57:53.939410173 -0500
10842
@@ -480,6 +480,8 @@
10843
 #define LOG2_BITS_PER_UNIT 3
10844
 #elif BITS_PER_UNIT == 16
10845
 #define LOG2_BITS_PER_UNIT 4
10846
+#elif BITS_PER_UNIT == 32
10847
+#define LOG2_BITS_PER_UNIT 5
10848
 #else
10849
 #error Unknown BITS_PER_UNIT
10850
 #endif
10851 127 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/df-scan.c gcc-5.3.0-zip/gcc/df-scan.c
10852
--- gcc-5.3.0-original/gcc/df-scan.c    2015-01-09 15:18:42.000000000 -0500
10853
+++ gcc-5.3.0-zip/gcc/df-scan.c 2016-04-14 16:12:03.614777002 -0400
10854
@@ -61,6 +61,14 @@
10855
 
10856
 typedef struct df_mw_hardreg *df_mw_hardreg_ptr;
10857
 
10858
+// #define     DO_ZIP_DEBUGS
10859
+#ifdef DO_ZIP_DEBUGS
10860
+extern void    zip_debug_rtx(const_rtx);
10861
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
10862
+#else
10863
+#define        ZIP_DEBUG_LINE(STR,RTX)
10864
+#endif
10865
+
10866
 
10867
 #ifndef HAVE_epilogue
10868
 #define HAVE_epilogue 0
10869 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/doc/gcc.log gcc-5.3.0-zip/gcc/doc/gcc.log
10870
--- gcc-5.3.0-original/gcc/doc/gcc.log  1969-12-31 19:00:00.000000000 -0500
10871
+++ gcc-5.3.0-zip/gcc/doc/gcc.log       2016-01-30 15:18:43.262724969 -0500
10872
@@ -0,0 +1,214 @@
10873
+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
10874
+entering extended mode
10875
+ restricted \write18 enabled.
10876
+ file:line:error style messages enabled.
10877
+ %&-line parsing enabled.
10878
+**\catcode126=12 \def\normaltilde{~}\catcode126=13 \let~\normaltilde  \input ./
10879
+gcc.texi
10880
+(./gcc.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
10881
+Loading texinfo [version 2013-09-11.11]:
10882
+\bindingoffset=\dimen16
10883
+\normaloffset=\dimen17
10884
+\pagewidth=\dimen18
10885
+\pageheight=\dimen19
10886
+\outerhsize=\dimen20
10887
+\outervsize=\dimen21
10888
+\cornerlong=\dimen22
10889
+\cornerthick=\dimen23
10890
+\topandbottommargin=\dimen24
10891
+\headlinebox=\box16
10892
+\footlinebox=\box17
10893
+\margin=\insert252
10894
+\EMsimple=\toks13
10895
+\groupbox=\box18
10896
+\groupinvalidhelp=\toks14
10897
+\mil=\dimen25
10898
+\exdentamount=\skip18
10899
+\inmarginspacing=\skip19
10900
+\centerpenalty=\count27
10901
+ pdf,
10902
+\tempnum=\count28
10903
+\lnkcount=\count29
10904
+\filename=\toks15
10905
+\filenamelength=\count30
10906
+\pgn=\count31
10907
+\toksA=\toks16
10908
+\toksB=\toks17
10909
+\toksC=\toks18
10910
+\toksD=\toks19
10911
+\boxA=\box19
10912
+\countA=\count32
10913
+\nopdfimagehelp=\toks20
10914
+ fonts,
10915
+\sffam=\fam8
10916
+\textleading=\dimen26
10917
+ markup,
10918
+\fontdepth=\count33
10919
+ glyphs,
10920
+\errorbox=\box20
10921
+
10922
+page headings,
10923
+\titlepagetopglue=\skip20
10924
+\titlepagebottomglue=\skip21
10925
+\evenheadline=\toks21
10926
+\oddheadline=\toks22
10927
+\evenfootline=\toks23
10928
+\oddfootline=\toks24
10929
+ tables,
10930
+\tableindent=\dimen27
10931
+\itemindent=\dimen28
10932
+\itemmargin=\dimen29
10933
+\itemmax=\dimen30
10934
+\itemno=\count34
10935
+\multitableparskip=\skip22
10936
+\multitableparindent=\skip23
10937
+\multitablecolspace=\dimen31
10938
+\multitablelinespace=\skip24
10939
+\colcount=\count35
10940
+\everytab=\toks25
10941
+ conditionals,
10942
+\doignorecount=\count36
10943
+ indexing,
10944
+\whatsitskip=\skip25
10945
+\whatsitpenalty=\count37
10946
+\secondaryindent=\skip26
10947
+\partialpage=\box21
10948
+\doublecolumnhsize=\dimen32
10949
+ sectioning,
10950
+\unnumberedno=\count38
10951
+\chapno=\count39
10952
+\secno=\count40
10953
+\subsecno=\count41
10954
+\subsubsecno=\count42
10955
+\appendixno=\count43
10956
+\absseclevel=\count44
10957
+\secbase=\count45
10958
+\chapheadingskip=\skip27
10959
+\secheadingskip=\skip28
10960
+\subsecheadingskip=\skip29
10961
+ toc,
10962
+\tocfile=\write0
10963
+\contentsrightmargin=\skip30
10964
+\savepageno=\count46
10965
+\lastnegativepageno=\count47
10966
+\tocindent=\dimen33
10967
+ environments,
10968
+\lispnarrowing=\skip31
10969
+\envskipamount=\skip32
10970
+\circthick=\dimen34
10971
+\cartouter=\dimen35
10972
+\cartinner=\dimen36
10973
+\normbskip=\skip33
10974
+\normpskip=\skip34
10975
+\normlskip=\skip35
10976
+\lskip=\skip36
10977
+\rskip=\skip37
10978
+\nonfillparindent=\dimen37
10979
+\tabw=\dimen38
10980
+\verbbox=\box22
10981
+
10982
+defuns,
10983
+\defbodyindent=\skip38
10984
+\defargsindent=\skip39
10985
+\deflastargmargin=\skip40
10986
+\defunpenalty=\count48
10987
+\parencount=\count49
10988
+\brackcount=\count50
10989
+ macros,
10990
+\paramno=\count51
10991
+\macname=\toks26
10992
+ cross references,
10993
+\auxfile=\write1
10994
+\savesfregister=\count52
10995
+\toprefbox=\box23
10996
+\printedrefnamebox=\box24
10997
+\infofilenamebox=\box25
10998
+\printedmanualbox=\box26
10999
+ insertions,
11000
+\footnoteno=\count53
11001
+\SAVEfootins=\box27
11002
+\SAVEmargin=\box28
11003
+
11004
+(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.tex
11005
+This is `epsf.tex' v2.7.4 <14 February 2011>
11006
+\epsffilein=\read1
11007
+\epsfframemargin=\dimen39
11008
+\epsfframethickness=\dimen40
11009
+\epsfrsize=\dimen41
11010
+\epsftmp=\dimen42
11011
+\epsftsize=\dimen43
11012
+\epsfxsize=\dimen44
11013
+\epsfysize=\dimen45
11014
+\pspoints=\dimen46
11015
+)
11016
+\noepsfhelp=\toks27
11017
+ localization,
11018
+\nolanghelp=\toks28
11019
+\countUTFx=\count54
11020
+\countUTFy=\count55
11021
+\countUTFz=\count56
11022
+ formatting,
11023
+\defaultparindent=\dimen47
11024
+ and turning on texinfo input format.)
11025
+\openout1 = `gcc.aux'.
11026
+
11027
+@cpindfile=@write2
11028
+@fnindfile=@write3
11029
+@vrindfile=@write4
11030
+@tpindfile=@write5
11031
+@kyindfile=@write6
11032
+@pgindfile=@write7
11033
+texinfo.tex: doing @include of gcc-common.texi
11034
+
11035
+
11036
+./gcc.texi:25: I can't find file `gcc-common.texi'.
11037
+@temp ->@input gcc-common.texi
11038
+
11039
+@includezzz ...and @input #1 }@expandafter }@temp
11040
+                                                  @popthisfilestack
11041
+l.25 @include gcc-common.texi
11042
+
11043
+(Press Enter to retry, or Control-D to exit)
11044
+Please type another input file name: include/gcc-common.texi
11045
+(./include/gcc-common.texi
11046
+texinfo.tex: doing @include of gcc-vers.texi
11047
+
11048
+
11049
+./include/gcc-common.texi:11: I can't find file `gcc-vers.texi'.
11050
+@temp ->@input gcc-vers.texi
11051
+
11052
+@includezzz ...and @input #1 }@expandafter }@temp
11053
+                                                  @popthisfilestack
11054
+l.11 @include gcc-vers.texi
11055
+
11056
+(Press Enter to retry, or Control-D to exit)
11057
+Please type another input file name: include/gcc-vers.texi
11058
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
11059
+@temp ->@input gcc-vers.texi
11060
+
11061
+@includezzz ...and @input #1 }@expandafter }@temp
11062
+                                                  @popthisfilestack
11063
+l.11 @include gcc-vers.texi
11064
+
11065
+(Press Enter to retry, or Control-D to exit)
11066
+Please type another input file name:
11067
+./include/gcc-common.texi:11: I can't find file `include/gcc-vers.texi'.
11068
+@temp ->@input gcc-vers.texi
11069
+
11070
+@includezzz ...and @input #1 }@expandafter }@temp
11071
+                                                  @popthisfilestack
11072
+l.11 @include gcc-vers.texi
11073
+
11074
+(Press Enter to retry, or Control-D to exit)
11075
+Please type another input file name:
11076
+./include/gcc-common.texi:11: Emergency stop.
11077
+@temp ->@input gcc-vers.texi
11078
+
11079
+@includezzz ...and @input #1 }@expandafter }@temp
11080
+                                                  @popthisfilestack
11081
+l.11 @include gcc-vers.texi
11082
+
11083
+End of file on the terminal!
11084
+
11085
+./include/gcc-common.texi:11:  ==> Fatal error occurred, no output PDF file pro
11086
+duced!
11087 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/emit-rtl.c gcc-5.3.0-zip/gcc/emit-rtl.c
11088
--- gcc-5.3.0-original/gcc/emit-rtl.c   2015-08-05 07:20:59.000000000 -0400
11089 138 dgisselq
+++ gcc-5.3.0-zip/gcc/emit-rtl.c        2016-05-02 07:48:47.925017436 -0400
11090 117 dgisselq
@@ -81,6 +81,15 @@
11091
 #include "builtins.h"
11092
 #include "rtl-iter.h"
11093
 
11094
+// #define     DO_ZIP_DEBUGS
11095
+#include <stdio.h>
11096
+#ifdef DO_ZIP_DEBUGS
11097
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11098
+extern void    zip_debug_rtx(const_rtx);
11099
+#else
11100
+#define        ZIP_DEBUG_LINE(STR,RTX)
11101
+#endif
11102
+
11103
 struct target_rtl default_target_rtl;
11104
 #if SWITCHABLE_TARGET
11105
 struct target_rtl *this_target_rtl = &default_target_rtl;
11106 127 dgisselq
@@ -2979,6 +2988,8 @@
11107 117 dgisselq
       break;
11108
     }
11109
 
11110
+ZIP_DEBUG_LINE("Before RTX_FLAG",x);
11111
+
11112
   /* This rtx may not be shared.  If it has already been seen,
11113
      replace it with a copy of itself.  */
11114
 
11115 127 dgisselq
@@ -2989,6 +3000,8 @@
11116 117 dgisselq
     }
11117
   RTX_FLAG (x, used) = 1;
11118
 
11119
+ZIP_DEBUG_LINE("Post RTX_FLAG",x);
11120
+
11121
   /* Now scan the subexpressions recursively.
11122
      We can store any replaced subexpressions directly into X
11123
      since we know X is not shared!  Any vectors in X
11124 127 dgisselq
@@ -3665,7 +3678,9 @@
11125
     split_branch_probability = XINT (note, 0);
11126
   probability = split_branch_probability;
11127
 
11128
+ZIP_DEBUG_LINE("Before split", trial);
11129
   seq = safe_as_a <rtx_insn *> (split_insns (pat, trial));
11130
+ZIP_DEBUG_LINE("After split", seq);
11131
 
11132
   split_branch_probability = -1;
11133
 
11134
@@ -3834,6 +3849,7 @@
11135
     if (! tem->deleted () && INSN_P (tem))
11136
       tem = try_split (PATTERN (tem), tem, 1);
11137
 
11138
+
11139
   /* Return either the first or the last insn, depending on which was
11140
      requested.  */
11141
   return last
11142 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/expr.c gcc-5.3.0-zip/gcc/expr.c
11143
--- gcc-5.3.0-original/gcc/expr.c       2015-04-07 10:34:06.000000000 -0400
11144 103 dgisselq
+++ gcc-5.3.0-zip/gcc/expr.c    2016-03-08 04:07:01.426335724 -0500
11145 102 dgisselq
@@ -7999,6 +7999,8 @@
11146
    the back of the caller.
11147
    The normal operating mode is to pass FALSE for this parameter.  */
11148
 
11149
+#include "print-tree.h"
11150
+
11151
 rtx
11152
 expand_expr_real (tree exp, rtx target, machine_mode tmode,
11153
                  enum expand_modifier modifier, rtx *alt_rtl,
11154 111 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/final.c gcc-5.3.0-zip/gcc/final.c
11155
--- gcc-5.3.0-original/gcc/final.c      2015-01-15 08:28:42.000000000 -0500
11156 127 dgisselq
+++ gcc-5.3.0-zip/gcc/final.c   2016-04-20 20:52:07.186056061 -0400
11157 111 dgisselq
@@ -109,6 +109,14 @@
11158
 #include "wide-int-print.h"
11159
 #include "rtl-iter.h"
11160
 
11161 122 dgisselq
+// #define     DO_ZIP_DEBUGS
11162 111 dgisselq
+#ifdef DO_ZIP_DEBUGS
11163
+extern void zip_debug_rtx(const_rtx);
11164
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11165
+#else
11166
+#define        ZIP_DEBUG_LINE(STR,RTX)
11167
+#endif
11168
+
11169
 #ifdef XCOFF_DEBUGGING_INFO
11170
 #include "xcoffout.h"          /* Needed for external data
11171
                                   declarations for e.g. AIX 4.x.  */
11172
@@ -2071,6 +2079,8 @@
11173
   /* Output the insns.  */
11174
   for (insn = first; insn;)
11175
     {
11176
+       ZIP_DEBUG_LINE("final()\n", insn);
11177
+
11178
       if (HAVE_ATTR_length)
11179
        {
11180
          if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
11181 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/genmodes.c gcc-5.3.0-zip/gcc/genmodes.c
11182
--- gcc-5.3.0-original/gcc/genmodes.c   2015-01-05 07:33:28.000000000 -0500
11183
+++ gcc-5.3.0-zip/gcc/genmodes.c        2016-03-04 21:27:49.669147699 -0500
11184
@@ -330,7 +330,8 @@
11185
         the size of a CC mode is four units.  */
11186
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
11187
 
11188
-      m->bytesize = 4;
11189
+       /* For the ZipCPU, however, it is only one unit */
11190
+      m->bytesize = 1;
11191
       m->ncomponents = 1;
11192
       m->component = 0;
11193
       break;
11194
@@ -766,11 +767,12 @@
11195
 
11196
   /* So put the default value unless the target needs a non standard
11197
      value. */
11198
-#ifdef BITS_PER_UNIT
11199
-  bits_per_unit = BITS_PER_UNIT;
11200
-#else
11201
-  bits_per_unit = 8;
11202
-#endif
11203
+// #ifdef BITS_PER_UNIT
11204
+  // bits_per_unit = BITS_PER_UNIT;
11205
+// #else
11206
+  bits_per_unit = 32;
11207
+#warning "Is there a more automated way to set bits per unit?"
11208
+// #endif
11209
 
11210
 #ifdef MAX_BITSIZE_MODE_ANY_INT
11211
   max_bitsize_mode_any_int = MAX_BITSIZE_MODE_ANY_INT;
11212
@@ -1083,7 +1085,7 @@
11213
       first = modes[c];
11214
       last = 0;
11215
       for (m = first; m; last = m, m = m->next)
11216
-       ;
11217
+       if ((m->next)&&(m->next->bytesize == m->bytesize)) first = m;
11218
 
11219
       /* Don't use BImode for MIN_MODE_INT, since otherwise the middle
11220
         end will try to use it for bitfields in structures and the
11221
@@ -1268,7 +1270,7 @@
11222
            continue;
11223
          if (m->precision != (unsigned int) -1)
11224
            {
11225
-             if (m2->precision != 2 * m->precision)
11226
+             if (m2->precision < 2 * m->precision)
11227
                continue;
11228
            }
11229
          else
11230
@@ -1323,7 +1325,6 @@
11231
       tagged_printf ("MODE_MASK (%u)", m->precision, m->name);
11232
     else
11233
       tagged_printf ("MODE_MASK (%u*BITS_PER_UNIT)", m->bytesize, m->name);
11234
-
11235
   puts ("#undef MODE_MASK");
11236
   print_closer ();
11237
 }
11238
@@ -1351,12 +1352,23 @@
11239
   int c;
11240
   struct mode_data *m;
11241
 
11242
+  puts(
11243
+"\n\n/* This is a rather strange conundrum.  Alignment is used by the host in\n"
11244
+" * the assembly file, whereas the size is used by the target.  Thus, for\n"
11245
+" * now, to align to a single target word means to align to 4 8-bit bytes in\n"
11246
+" * assembly.  If you get it wrong, the assembler will try to help.  Thus,\n"
11247
+" * aligning to anything less than 4 (1 target word) will cause an alignment\n"
11248
+" * of the target word in size.  However, this tries to do a little something\n"
11249
+" * teach our compiler what we are doing.\n"
11250
+" */\n");
11251
   print_maybe_const_decl ("%sunsigned char",
11252
                          "mode_base_align", "NUM_MACHINE_MODES",
11253
                          alignment);
11254
 
11255
   for_all_modes (c, m)
11256
-    tagged_printf ("%u", m->alignment, m->name);
11257
+    tagged_printf ("%u", 4*m->bytesize,
11258
+               // m->alignment,
11259
+               m->name);
11260
 
11261
   print_closer ();
11262
 }
11263 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/jump.c gcc-5.3.0-zip/gcc/jump.c
11264
--- gcc-5.3.0-original/gcc/jump.c       2015-01-27 04:19:30.000000000 -0500
11265 122 dgisselq
+++ gcc-5.3.0-zip/gcc/jump.c    2016-04-06 14:06:50.207563805 -0400
11266 117 dgisselq
@@ -80,6 +80,14 @@
11267
 #include "target.h"
11268
 #include "rtl-iter.h"
11269
 
11270
+// #define     DO_ZIP_DEBUGS
11271
+#ifdef DO_ZIP_DEBUGS
11272
+#include <stdio.h>
11273
+#define        ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
11274
+extern void zip_debug_rtx(const_rtx);
11275
+#else
11276
+#define        ZIP_DEBUG_LINE(STR,RTX)
11277
+#endif
11278
 /* Optimize jump y; x: ... y: jumpif... x?
11279
    Don't know if it is worth bothering with.  */
11280
 /* Optimize two cases of conditional jump to conditional jump?
11281
@@ -1136,6 +1144,7 @@
11282
   int i;
11283
   const char *fmt;
11284
 
11285
+ZIP_DEBUG_LINE("Mark jump label",insn);
11286
   switch (code)
11287
     {
11288
     case PC:
11289
@@ -1248,6 +1257,8 @@
11290
       break;
11291
     }
11292
 
11293
+ZIP_DEBUG_LINE("Post case",insn);
11294
+
11295
   fmt = GET_RTX_FORMAT (code);
11296
 
11297
   /* The primary target of a tablejump is the label of the ADDR_VEC,
11298 191 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/loop-doloop.c gcc-5.3.0-zip/gcc/loop-doloop.c
11299
--- gcc-5.3.0-original/gcc/loop-doloop.c        2015-01-15 08:28:42.000000000 -0500
11300
+++ gcc-5.3.0-zip/gcc/loop-doloop.c     2016-09-13 12:12:36.248901944 -0400
11301
@@ -62,6 +62,13 @@
11302
 #include "dumpfile.h"
11303
 #include "loop-unroll.h"
11304
 
11305
+// #define     DO_ZIP_DEBUGS
11306
+#ifdef DO_ZIP_DEBUGS
11307
+extern void    zip_debug_rtx(const_rtx);
11308
+#define        ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
11309
+#else
11310
+#define        ZIP_DEBUG_LINE(STR,RTX)
11311
+#endif
11312
 /* This module is used to modify loops with a determinable number of
11313
    iterations to use special low-overhead looping instructions.
11314
 
11315
@@ -138,7 +145,7 @@
11316
 
11317
   pattern = PATTERN (doloop_pat);
11318
 
11319
-  if (GET_CODE (pattern) != PARALLEL)
11320
+  if (GET_CODE (doloop_pat) != PARALLEL)
11321
     {
11322
       rtx cond;
11323
       rtx prev_insn = prev_nondebug_insn (doloop_pat);
11324
@@ -186,10 +193,11 @@
11325
     }
11326
   else
11327
     {
11328
-      cmp = XVECEXP (pattern, 0, 0);
11329
-      inc = XVECEXP (pattern, 0, 1);
11330
+      cmp = XVECEXP (doloop_pat, 0, 0);
11331
+      inc = XVECEXP (doloop_pat, 0, 1);
11332
     }
11333
 
11334
+
11335
   /* Check for (set (reg) (something)).  */
11336
   if (GET_CODE (inc) != SET)
11337
     return 0;
11338
@@ -227,6 +235,7 @@
11339
           && XEXP (condition, 1) != const1_rtx))
11340
     return 0;
11341
 
11342
+
11343
   if ((XEXP (condition, 0) == reg)
11344
       /* For the third case:  */
11345
       || ((cc_reg != NULL_RTX)
11346
@@ -235,7 +244,7 @@
11347
       || (GET_CODE (XEXP (condition, 0)) == PLUS
11348
          && XEXP (XEXP (condition, 0), 0) == reg))
11349
    {
11350
-     if (GET_CODE (pattern) != PARALLEL)
11351
+     if (GET_CODE (doloop_pat) != PARALLEL)
11352
      /*  For the second form we expect:
11353
 
11354
          (set (reg) (plus (reg) (const_int -1))
11355
@@ -275,6 +284,7 @@
11356
     return condition;
11357
    }
11358
 
11359
+
11360
   /* ??? If a machine uses a funny comparison, we could return a
11361
      canonicalized form here.  */
11362
 
11363
@@ -500,7 +510,6 @@
11364
     default:
11365
       gcc_unreachable ();
11366
     }
11367
-
11368
   if (increment_count)
11369
     count = simplify_gen_binary (PLUS, mode, count, const1_rtx);
11370
 
11371 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.def gcc-5.3.0-zip/gcc/machmode.def
11372
--- gcc-5.3.0-original/gcc/machmode.def 2015-01-05 07:33:28.000000000 -0500
11373 111 dgisselq
+++ gcc-5.3.0-zip/gcc/machmode.def      2016-03-08 11:56:45.375491523 -0500
11374 102 dgisselq
@@ -184,11 +184,11 @@
11375
    larger types, then corresponding modes must be added here.  The
11376
    name OI is reserved for a 256-bit type (needed by some back ends).
11377
     */
11378
-INT_MODE (QI, 1);
11379
-INT_MODE (HI, 2);
11380
-INT_MODE (SI, 4);
11381
-INT_MODE (DI, 8);
11382
-INT_MODE (TI, 16);
11383
+// INT_MODE (QI, 1);
11384
+// INT_MODE (HI, 1);
11385
+INT_MODE (SI, 1);
11386
+INT_MODE (DI, 2);
11387
+INT_MODE (TI, 4);
11388
 
11389
 /* No partial integer modes are defined by default.  */
11390
 
11391 111 dgisselq
@@ -206,35 +206,35 @@
11392 102 dgisselq
    These are the IEEE mappings.  They can be overridden with
11393
    RESET_FLOAT_FORMAT or at runtime (in TARGET_OPTION_OVERRIDE).  */
11394
 
11395
-FLOAT_MODE (SF, 4, ieee_single_format);
11396
-FLOAT_MODE (DF, 8, ieee_double_format);
11397
+FLOAT_MODE (SF, 1, ieee_single_format);
11398
+FLOAT_MODE (DF, 2, ieee_double_format);
11399
 
11400
 /* Basic CC modes.
11401
    FIXME define this only for targets that need it.  */
11402 111 dgisselq
 CC_MODE (CC);
11403 102 dgisselq
 
11404
 /* Fixed-point modes.  */
11405 111 dgisselq
-FRACT_MODE (QQ, 1, 7); /* s.7 */
11406 102 dgisselq
-FRACT_MODE (HQ, 2, 15); /* s.15 */
11407
-FRACT_MODE (SQ, 4, 31); /* s.31 */
11408
-FRACT_MODE (DQ, 8, 63); /* s.63 */
11409
-FRACT_MODE (TQ, 16, 127); /* s.127 */
11410 111 dgisselq
-
11411
-UFRACT_MODE (UQQ, 1, 8); /* .8 */
11412 102 dgisselq
-UFRACT_MODE (UHQ, 2, 16); /* .16 */
11413
-UFRACT_MODE (USQ, 4, 32); /* .32 */
11414
-UFRACT_MODE (UDQ, 8, 64); /* .64 */
11415
-UFRACT_MODE (UTQ, 16, 128); /* .128 */
11416 111 dgisselq
-
11417
-ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
11418
-ACCUM_MODE (SA, 4, 16, 15); /* s16.15 */
11419
-ACCUM_MODE (DA, 8, 32, 31); /* s32.31 */
11420
-ACCUM_MODE (TA, 16, 64, 63); /* s64.63 */
11421
-
11422
-UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
11423
-UACCUM_MODE (USA, 4, 16, 16); /* 16.16 */
11424
-UACCUM_MODE (UDA, 8, 32, 32); /* 32.32 */
11425
-UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
11426
+/* FRACT_MODE (QQ, 1, 7); /* s.7 */
11427
+/* FRACT_MODE (HQ, 1, 15); /* s.15 */
11428
+FRACT_MODE (SQ, 1, 31); /* s.31 */
11429
+FRACT_MODE (DQ, 2, 63); /* s.63 */
11430
+FRACT_MODE (TQ, 4, 127); /* s.127 */
11431
+
11432
+/* UFRACT_MODE (UQQ, 1, 8); /* .8 */
11433
+/* UFRACT_MODE (UHQ, 1, 16); /* .16 */
11434 102 dgisselq
+UFRACT_MODE (USQ, 1, 32); /* .32 */
11435
+UFRACT_MODE (UDQ, 2, 64); /* .64 */
11436
+UFRACT_MODE (UTQ, 4, 128); /* .128 */
11437 111 dgisselq
+
11438
+/* ACCUM_MODE (HA, 2, 8, 7); /* s8.7 */
11439
+ACCUM_MODE (SA, 1, 16, 15); /* s16.15 */
11440
+ACCUM_MODE (DA, 2, 32, 31); /* s32.31 */
11441
+ACCUM_MODE (TA, 4, 64, 63); /* s64.63 */
11442
+
11443
+/* UACCUM_MODE (UHA, 2, 8, 8); /* 8.8 */
11444
+UACCUM_MODE (USA, 1, 16, 16); /* 16.16 */
11445
+UACCUM_MODE (UDA, 2, 32, 32); /* 32.32 */
11446
+UACCUM_MODE (UTA, 4, 64, 64); /* 64.64 */
11447 102 dgisselq
 
11448 111 dgisselq
 /* Allow the target to specify additional modes of various kinds.  */
11449
 #if HAVE_EXTRA_MODES
11450 102 dgisselq
@@ -246,9 +246,9 @@
11451
 COMPLEX_MODES (FLOAT);
11452
 
11453
 /* Decimal floating point modes.  */
11454
-DECIMAL_FLOAT_MODE (SD, 4, decimal_single_format);
11455
-DECIMAL_FLOAT_MODE (DD, 8, decimal_double_format);
11456
-DECIMAL_FLOAT_MODE (TD, 16, decimal_quad_format);
11457
+DECIMAL_FLOAT_MODE (SD, 1, decimal_single_format);
11458
+DECIMAL_FLOAT_MODE (DD, 2, decimal_double_format);
11459
+DECIMAL_FLOAT_MODE (TD, 4, decimal_quad_format);
11460
 
11461
 /* The symbol Pmode stands for one of the above machine modes (usually SImode).
11462
    The tm.h file specifies which one.  It is not a distinct mode.  */
11463
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/machmode.h gcc-5.3.0-zip/gcc/machmode.h
11464
--- gcc-5.3.0-original/gcc/machmode.h   2015-01-05 07:33:28.000000000 -0500
11465
+++ gcc-5.3.0-zip/gcc/machmode.h        2016-02-06 17:21:49.592924065 -0500
11466
@@ -180,13 +180,7 @@
11467
 /* Get the size in bytes and bits of an object of mode MODE.  */
11468
 
11469
 extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
11470
-#if GCC_VERSION >= 4001
11471
-#define GET_MODE_SIZE(MODE) \
11472
-  ((unsigned short) (__builtin_constant_p (MODE) \
11473
-                    ? mode_size_inline (MODE) : mode_size[MODE]))
11474
-#else
11475
 #define GET_MODE_SIZE(MODE)    ((unsigned short) mode_size[MODE])
11476
-#endif
11477
 #define GET_MODE_BITSIZE(MODE) \
11478
   ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
11479
 
11480
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/objc/objc-encoding.c gcc-5.3.0-zip/gcc/objc/objc-encoding.c
11481
--- gcc-5.3.0-original/gcc/objc/objc-encoding.c 2015-01-09 15:18:42.000000000 -0500
11482
+++ gcc-5.3.0-zip/gcc/objc/objc-encoding.c      2016-03-04 22:53:40.431902505 -0500
11483
@@ -765,10 +765,14 @@
11484
        {
11485
          switch (TYPE_MODE (type))
11486
            {
11487
+#ifdef HAVE_QImode
11488
            case QImode:
11489
              charType = 'C'; break;
11490
+#endif
11491
+#ifdef HAVE_HImode
11492
            case HImode:
11493
              charType = 'S'; break;
11494
+#endif
11495
            case SImode:
11496
              {
11497
                if (type == long_unsigned_type_node)
11498
@@ -788,10 +792,14 @@
11499
        {
11500
          switch (TYPE_MODE (type))
11501
            {
11502
+#ifdef HAVE_QImode
11503
            case QImode:
11504
              charType = 'c'; break;
11505
+#endif
11506
+#ifdef HAVE_HImode
11507
            case HImode:
11508
              charType = 's'; break;
11509
+#endif
11510
            case SImode:
11511
              {
11512
                if (type == long_integer_type_node)
11513
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/postreload.c gcc-5.3.0-zip/gcc/postreload.c
11514
--- gcc-5.3.0-original/gcc/postreload.c 2015-07-17 09:50:38.000000000 -0400
11515 111 dgisselq
+++ gcc-5.3.0-zip/gcc/postreload.c      2016-03-24 21:30:23.402590035 -0400
11516
@@ -71,6 +71,14 @@
11517 102 dgisselq
 #include "df.h"
11518
 #include "dbgcnt.h"
11519
 
11520 111 dgisselq
+// #define     DO_ZIP_DEBUGS
11521 102 dgisselq
+#ifdef DO_ZIP_DEBUGS
11522
+extern void zip_debug_rtx(const_rtx);
11523
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11524
+#else
11525
+#define        ZIP_DEBUG_LINE(STR,RTX)
11526
+#endif
11527
+
11528
 static int reload_cse_noop_set_p (rtx);
11529
 static bool reload_cse_simplify (rtx_insn *, rtx);
11530
 static void reload_cse_regs_1 (void);
11531 111 dgisselq
@@ -120,6 +128,8 @@
11532 102 dgisselq
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
11533
   unsigned insn_bb_succs = EDGE_COUNT (insn_bb->succs);
11534
 
11535
+       ZIP_DEBUG_LINE("RELOAD-CSE-SIMPLIFY:",insn);
11536
+
11537
   if (GET_CODE (body) == SET)
11538
     {
11539
       int count = 0;
11540 111 dgisselq
@@ -147,6 +157,7 @@
11541 102 dgisselq
        apply_change_group ();
11542
       else
11543
        reload_cse_simplify_operands (insn, testreg);
11544
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
11545
     }
11546
   else if (GET_CODE (body) == PARALLEL)
11547
     {
11548 111 dgisselq
@@ -205,6 +216,7 @@
11549 102 dgisselq
        apply_change_group ();
11550
       else
11551
        reload_cse_simplify_operands (insn, testreg);
11552
+       ZIP_DEBUG_LINE("End of reload_cse_simplify_operands", insn);
11553
     }
11554
 
11555
 done:
11556 111 dgisselq
@@ -246,6 +258,7 @@
11557 102 dgisselq
          cfg_changed |= reload_cse_simplify (insn, testreg);
11558
 
11559
        cselib_process_insn (insn);
11560
+       ZIP_DEBUG_LINE("End-CSE-REGS-1:",insn);
11561
       }
11562
 
11563
   /* Clean up.  */
11564 111 dgisselq
@@ -276,6 +289,8 @@
11565 102 dgisselq
 #endif
11566
   bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
11567
 
11568
+
11569
+       ZIP_DEBUG_LINE("RELOAD:Attempting to simplify set",set);
11570
   dreg = true_regnum (SET_DEST (set));
11571
   if (dreg < 0)
11572
     return 0;
11573 111 dgisselq
@@ -427,6 +442,7 @@
11574 102 dgisselq
   /* Array of alternatives, sorted in order of decreasing desirability.  */
11575
   int *alternative_order;
11576
 
11577
+       ZIP_DEBUG_LINE("Simplify-Operands", insn);
11578
   extract_constrain_insn (insn);
11579
 
11580
   if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
11581 111 dgisselq
@@ -519,6 +535,7 @@
11582 102 dgisselq
          SET_HARD_REG_BIT (equiv_regs[i], REGNO (l->loc));
11583
     }
11584
 
11585
+       ZIP_DEBUG_LINE("Simplify-Operands - A", insn);
11586
   alternative_mask preferred = get_preferred_alternatives (insn);
11587
   for (i = 0; i < recog_data.n_operands; i++)
11588
     {
11589 111 dgisselq
@@ -617,6 +634,7 @@
11590 102 dgisselq
            }
11591
        }
11592
     }
11593
+       ZIP_DEBUG_LINE("Simplify-Operands - B", insn);
11594
 
11595
   /* Record all alternatives which are better or equal to the currently
11596
      matching one in the alternative_order array.  */
11597 111 dgisselq
@@ -666,6 +684,7 @@
11598 102 dgisselq
       validate_change (insn, recog_data.operand_loc[i],
11599
                       gen_rtx_REG (mode, op_alt_regno[i][j]), 1);
11600
     }
11601
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
11602
 
11603
   for (i = recog_data.n_dups - 1; i >= 0; i--)
11604
     {
11605 111 dgisselq
@@ -679,6 +698,7 @@
11606 102 dgisselq
                       gen_rtx_REG (mode, op_alt_regno[op][j]), 1);
11607
     }
11608
 
11609
+       ZIP_DEBUG_LINE("Simplify-Operands - C", insn);
11610
   return apply_change_group ();
11611
 }
11612
 
11613 117 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/recog.c gcc-5.3.0-zip/gcc/recog.c
11614
--- gcc-5.3.0-original/gcc/recog.c      2015-03-20 02:07:30.000000000 -0400
11615 127 dgisselq
+++ gcc-5.3.0-zip/gcc/recog.c   2016-04-14 23:19:07.630839483 -0400
11616 117 dgisselq
@@ -68,6 +68,15 @@
11617
 #include "df.h"
11618
 #include "insn-codes.h"
11619
 
11620
+// #define     DO_ZIP_DEBUGS
11621
+#ifdef DO_ZIP_DEBUGS
11622
+extern void    zip_debug_rtx(const_rtx);
11623
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11624
+#else
11625
+#define        ZIP_DEBUG_LINE(STR,RTX)
11626
+#endif
11627
+
11628
+
11629
 #ifndef STACK_PUSH_CODE
11630
 #ifdef STACK_GROWS_DOWNWARD
11631
 #define STACK_PUSH_CODE PRE_DEC
11632 122 dgisselq
@@ -2283,6 +2292,7 @@
11633
   recog_data.n_dups = 0;
11634
   recog_data.is_asm = false;
11635
 
11636
+ZIP_DEBUG_LINE("Extract-insn", insn);
11637
   switch (GET_CODE (body))
11638
     {
11639
     case USE:
11640
@@ -3671,7 +3681,6 @@
11641 117 dgisselq
            break;
11642
 
11643
          /* The buffer filled to the current maximum, so try to match.  */
11644
-
11645
          pos = peep2_buf_position (peep2_current + peep2_current_count);
11646
          peep2_insn_data[pos].insn = PEEP2_EOB;
11647
          COPY_REG_SET (peep2_insn_data[pos].live_before, live);
11648 122 dgisselq
@@ -3704,6 +3713,7 @@
11649 117 dgisselq
     rebuild_jump_labels (get_insns ());
11650
   if (peep2_do_cleanup_cfg)
11651
     cleanup_cfg (CLEANUP_CFG_CHANGED);
11652
+
11653
 }
11654
 #endif /* HAVE_peephole2 */
11655
 
11656
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload1.c gcc-5.3.0-zip/gcc/reload1.c
11657
--- gcc-5.3.0-original/gcc/reload1.c    2015-01-15 08:28:42.000000000 -0500
11658 127 dgisselq
+++ gcc-5.3.0-zip/gcc/reload1.c 2016-04-20 20:51:38.590252867 -0400
11659 117 dgisselq
@@ -72,6 +72,14 @@
11660
 #include "dumpfile.h"
11661
 #include "rtl-iter.h"
11662
 
11663
+// #define     DO_ZIP_DEBUGS
11664
+#ifdef DO_ZIP_DEBUGS
11665
+extern void    zip_debug_rtx(const_rtx);
11666
+#define        ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s:%d/%s\n", __FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11667
+#else
11668
+#define        ZIP_DEBUG_LINE(STR,RTX)
11669
+#endif
11670
+
11671
 /* This file contains the reload pass of the compiler, which is
11672
    run after register allocation has been done.  It checks that
11673
    each insn is valid (operands required to be in registers really
11674 127 dgisselq
@@ -794,6 +802,20 @@
11675 117 dgisselq
   basic_block bb;
11676
   bool inserted;
11677
 
11678
+#ifdef DO_ZIP_DEBUGS
11679
+  {
11680 127 dgisselq
+       fprintf(stderr, "BEFORE-RELOAD\n");
11681 117 dgisselq
+       int     total_count = 0, current_count = 0;
11682
+       for (insn = first; insn; insn = NEXT_INSN (insn))
11683
+               total_count++;
11684
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
11685
+               fprintf(stderr, "B %3d/%3d", current_count++, total_count);
11686
+               zip_debug_rtx(insn);
11687
+       }
11688 127 dgisselq
+       fprintf(stderr, "BEFORE-RELOAD -- END OF INSTRUCTION LIST\n");
11689 117 dgisselq
+  }
11690
+#endif
11691
+
11692
   /* Make sure even insns with volatile mem refs are recognizable.  */
11693
   init_recog ();
11694
 
11695 127 dgisselq
@@ -1366,6 +1388,20 @@
11696 117 dgisselq
 
11697
   reload_completed = !failure;
11698
 
11699
+#ifdef DO_ZIP_DEBUGS
11700
+  {
11701 127 dgisselq
+       fprintf(stderr, "AFTER-RELOAD\n");
11702 117 dgisselq
+       int     total_count = 0, current_count = 0;
11703
+       for (insn = first; insn; insn = NEXT_INSN (insn))
11704
+               total_count++;
11705
+       for (insn = first; insn; insn = NEXT_INSN (insn)) {
11706
+               fprintf(stderr, "A %3d/%3d", current_count++, total_count);
11707
+               zip_debug_rtx(insn);
11708
+       }
11709 127 dgisselq
+       fprintf(stderr, "AFTER-RELOAD -- END OF INSTRUCTION LIST\n");
11710 117 dgisselq
+  }
11711
+#endif
11712
+
11713
   return need_dce;
11714
 }
11715
 
11716 102 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/reload.c gcc-5.3.0-zip/gcc/reload.c
11717
--- gcc-5.3.0-original/gcc/reload.c     2015-01-15 08:28:42.000000000 -0500
11718 122 dgisselq
+++ gcc-5.3.0-zip/gcc/reload.c  2016-04-06 17:49:33.418613170 -0400
11719
@@ -136,6 +136,15 @@
11720
 #include "target.h"
11721
 #include "ira.h"
11722
 
11723
+// #define     DO_ZIP_DEBUGS
11724
+#ifdef DO_ZIP_DEBUGS
11725
+extern void zip_debug_rtx(const_rtx);
11726
+#define ZIP_DEBUG_LINE(STR,RTX) do{fprintf(stderr, "%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); }while(0)
11727
+#else
11728
+#define        ZIP_DEBUG_LINE(STR,RTX)
11729
+#endif
11730
+
11731
+
11732
 /* True if X is a constant that can be forced into the constant pool.
11733
    MODE is the mode of the operand, or VOIDmode if not known.  */
11734
 #define CONST_POOL_OK_P(MODE, X)               \
11735
@@ -2700,6 +2709,8 @@
11736
   hard_regs_live_known = live_known;
11737
   static_reload_reg_p = reload_reg_p;
11738
 
11739
+ZIP_DEBUG_LINE("Find reloads\n", insn);
11740
+
11741
   /* JUMP_INSNs and CALL_INSNs are not allowed to have any output reloads;
11742
      neither are insns that SET cc0.  Insns that use CC0 are not allowed
11743
      to have any input reloads.  */
11744
@@ -2707,8 +2718,17 @@
11745 102 dgisselq
     no_output_reloads = 1;
11746
 
11747
 #ifdef HAVE_cc0
11748
+  // If the instruction depends upon cc0, such as a branch, if_then_else, or
11749
+  // cond_exec instruction, we cannot change the input so that the instruction
11750
+  // relies on another register--cc0 is specific.  This requries that the
11751
+  // references be only cc0 and (const_int 0), rather than allowing other
11752
+  // registers here as well.
11753
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
11754
     no_input_reloads = 1;
11755
+  // If the result of an instruction is the cc0 register, that cannot
11756
+  // be changed, therefore no output reloading is allowed.  This only
11757
+  // works if instructions *only* set the cc0 register, and not multiple
11758
+  // registers.
11759
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
11760
     no_output_reloads = 1;
11761
 #endif
11762 146 dgisselq
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/target-def.h gcc-5.3.0-zip/gcc/target-def.h
11763
--- gcc-5.3.0-original/gcc/target-def.h 2015-01-05 07:33:28.000000000 -0500
11764
+++ gcc-5.3.0-zip/gcc/target-def.h      2016-05-12 15:20:06.896745740 -0400
11765
@@ -29,24 +29,44 @@
11766
    rather than the .c file, then we need to wrap the default
11767
    definition in a #ifndef, since files include tm.h before this one.  */
11768
 
11769
+#ifndef TARGET_ASM_ALIGNED_HI_OP
11770
 #define TARGET_ASM_ALIGNED_HI_OP "\t.short\t"
11771
+#endif
11772
+#ifndef TARGET_ASM_ALIGNED_SI_OP
11773
 #define TARGET_ASM_ALIGNED_SI_OP "\t.long\t"
11774
+#endif
11775
 #define TARGET_ASM_ALIGNED_DI_OP NULL
11776
 #define TARGET_ASM_ALIGNED_TI_OP NULL
11777
 
11778
 /* GAS and SYSV4 assemblers accept these.  */
11779
 #if defined (OBJECT_FORMAT_ELF)
11780
-#define TARGET_ASM_UNALIGNED_HI_OP "\t.2byte\t"
11781
-#define TARGET_ASM_UNALIGNED_SI_OP "\t.4byte\t"
11782
-#define TARGET_ASM_UNALIGNED_DI_OP "\t.8byte\t"
11783
-#define TARGET_ASM_UNALIGNED_TI_OP NULL
11784
+# ifndef TARGET_ASM_UNALIGNED_HI_OP
11785
+#  define TARGET_ASM_UNALIGNED_HI_OP "\t.2byte\t"
11786
+# endif
11787
+# ifndef TARGET_ASM_UNALIGNED_SI_OP
11788
+#  define TARGET_ASM_UNALIGNED_SI_OP "\t.4b0te\t"
11789
+# endif
11790
+# ifndef TARGET_ASM_UNALIGNED_DI_OP
11791
+#  define TARGET_ASM_UNALIGNED_DI_OP "\t.8byte\t"
11792
+# endif
11793
+# define TARGET_ASM_UNALIGNED_TI_OP NULL
11794
 #else
11795
-#define TARGET_ASM_UNALIGNED_HI_OP NULL
11796
-#define TARGET_ASM_UNALIGNED_SI_OP NULL
11797
-#define TARGET_ASM_UNALIGNED_DI_OP NULL
11798
-#define TARGET_ASM_UNALIGNED_TI_OP NULL
11799
+# ifndef TARGET_ASM_UNALIGNED_HI_OP
11800
+#  define TARGET_ASM_UNALIGNED_HI_OP NULL
11801
+# endif
11802
+# ifndef TARGET_ASM_UNALIGNED_SI_OP
11803
+#  define TARGET_ASM_UNALIGNED_SI_OP NULL
11804
+# endif
11805
+# ifndef TARGET_ASM_UNALIGNED_DI_OP
11806
+#  define TARGET_ASM_UNALIGNED_DI_OP NULL
11807
+# endif
11808
+# define TARGET_ASM_UNALIGNED_TI_OP NULL
11809
 #endif /* OBJECT_FORMAT_ELF */
11810
 
11811
+#ifndef        TARGET_ASM_UNALIGNED_TI_OP
11812
+#define TARGET_ASM_UNALIGNED_TI_OP NULL
11813
+#endif
11814
+
11815
 #if !defined(TARGET_ASM_CONSTRUCTOR) && !defined(USE_COLLECT2)
11816
 # ifdef CTORS_SECTION_ASM_OP
11817
 #  define TARGET_ASM_CONSTRUCTOR default_ctor_section_asm_out_constructor
11818 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
11819
--- gcc-5.3.0-original/gcc/testsuite/lib/target-supports.exp    2015-11-26 05:10:58.000000000 -0500
11820
+++ gcc-5.3.0-zip/gcc/testsuite/lib/target-supports.exp 2016-01-30 15:14:21.620586694 -0500
11821
@@ -503,6 +503,11 @@
11822
        return 0
11823
     }
11824
 
11825
+    # Zip CPU doesn't support profiling (yet)
11826
+    if { [istarget zip*] }
11827
+        return 0
11828
+    }
11829
+
11830
     # MinGW does not support -p.
11831
     if { [istarget *-*-mingw*] && $test_what == "-p" } {
11832
        return 0
11833
@@ -986,6 +991,12 @@
11834
        }]
11835
     }
11836
 
11837
+    # No real hardware FPU support for ZipCPU yet--even though the instruction
11838
+    # set supports it, the CPU just isn't ready yet.
11839
+    if { [istarget zip*-*-*] } {
11840
+        return 0
11841
+    }
11842
+
11843
     # This proc is actually checking the availabilty of FPU
11844
     # support for doubles, so on the RX we must fail if the
11845
     # 64-bit double multilib has been selected.
11846
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
11847
--- gcc-5.3.0-original/gcc/tree-ssa-math-opts.c 2015-08-11 03:58:07.000000000 -0400
11848
+++ gcc-5.3.0-zip/gcc/tree-ssa-math-opts.c      2016-02-12 11:21:11.309149239 -0500
11849
@@ -972,7 +972,7 @@
11850
     {
11851
       if (val & 1)
11852
        {
11853
-         digit = val & ((1 << POWI_WINDOW_SIZE) - 1);
11854
+         digit = val & ((1l << POWI_WINDOW_SIZE) - 1);
11855
          result += powi_lookup_cost (digit, cache)
11856
                    + POWI_WINDOW_SIZE + 1;
11857
          val >>= POWI_WINDOW_SIZE;
11858
@@ -1012,7 +1012,7 @@
11859
     }
11860
   else if (n & 1)
11861
     {
11862
-      digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
11863
+      digit = n & ((1l << POWI_WINDOW_SIZE) - 1);
11864
       op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache);
11865
       op1 = powi_as_mults_1 (gsi, loc, type, digit, cache);
11866
     }
11867
@@ -1651,7 +1651,7 @@
11868
 };
11869
 
11870
 #define BITS_PER_MARKER 8
11871
-#define MARKER_MASK ((1 << BITS_PER_MARKER) - 1)
11872
+#define MARKER_MASK ((1l << BITS_PER_MARKER) - 1)
11873
 #define MARKER_BYTE_UNKNOWN MARKER_MASK
11874
 #define HEAD_MARKER(n, size) \
11875
   ((n) & ((uint64_t) MARKER_MASK << (((size) - 1) * BITS_PER_MARKER)))
11876
@@ -1687,7 +1687,7 @@
11877
   /* Zero out the extra bits of N in order to avoid them being shifted
11878
      into the significant bits.  */
11879
   if (size < 64 / BITS_PER_MARKER)
11880
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11881
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11882
 
11883
   switch (code)
11884
     {
11885
@@ -1714,7 +1714,7 @@
11886
     }
11887
   /* Zero unused bits for size.  */
11888
   if (size < 64 / BITS_PER_MARKER)
11889
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11890
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11891
   return true;
11892
 }
11893
 
11894
@@ -1761,7 +1761,7 @@
11895
   n->n = CMPNOP;
11896
 
11897
   if (size < 64 / BITS_PER_MARKER)
11898
-    n->n &= ((uint64_t) 1 << (size * BITS_PER_MARKER)) - 1;
11899
+    n->n &= ((uint64_t) 1l << (size * BITS_PER_MARKER)) - 1;
11900
 
11901
   return true;
11902
 }
11903
@@ -2020,7 +2020,7 @@
11904
          {
11905
            int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
11906
            uint64_t val = int_cst_value (rhs2), mask = 0;
11907
-           uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
11908
+           uint64_t tmp = (1l << BITS_PER_UNIT) - 1;
11909
 
11910
            /* Only constants masking full bytes are allowed.  */
11911
            for (i = 0; i < size; i++, tmp <<= BITS_PER_UNIT)
11912
@@ -2064,7 +2064,7 @@
11913
              {
11914
                /* If STMT casts to a smaller type mask out the bits not
11915
                   belonging to the target type.  */
11916
-               n->n &= ((uint64_t) 1 << (type_size * BITS_PER_MARKER)) - 1;
11917
+               n->n &= ((uint64_t) 1l << (type_size * BITS_PER_MARKER)) - 1;
11918
              }
11919
            n->type = type;
11920
            if (!n->base_addr)
11921
@@ -2177,7 +2177,7 @@
11922
     {
11923
       uint64_t mask;
11924
 
11925
-      mask = ((uint64_t) 1 << (n->range * BITS_PER_MARKER)) - 1;
11926
+      mask = ((uint64_t) 1l << (n->range * BITS_PER_MARKER)) - 1;
11927
       cmpxchg >>= (64 / BITS_PER_MARKER - n->range) * BITS_PER_MARKER;
11928
       cmpnop &= mask;
11929
     }
11930
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/var-tracking.c gcc-5.3.0-zip/gcc/var-tracking.c
11931
--- gcc-5.3.0-original/gcc/var-tracking.c       2015-03-26 09:19:00.000000000 -0400
11932 117 dgisselq
+++ gcc-5.3.0-zip/gcc/var-tracking.c    2016-03-31 18:55:03.584197958 -0400
11933 102 dgisselq
@@ -143,6 +143,13 @@
11934
 #include "rtl-iter.h"
11935
 #include "fibonacci_heap.h"
11936
 
11937 117 dgisselq
+#ifdef DO_ZIP_DEBUGS
11938 102 dgisselq
+#include <stdio.h>
11939
+extern void zip_debug_rtx(const_rtx);
11940
+#define ZIP_DEBUG_LINE(STR,RTX) do {fprintf(stderr,"%s:%d/%s\n",__FILE__,__LINE__,STR); zip_debug_rtx(RTX); } while(0)
11941
+#else
11942
+#define ZIP_DEBUG_LINE(STR,RTX)
11943
+#endif
11944
 typedef fibonacci_heap <long, basic_block_def> bb_heap_t;
11945
 typedef fibonacci_node <long, basic_block_def> bb_heap_node_t;
11946
 
11947
@@ -6356,6 +6363,7 @@
11948
                machine_mode indmode
11949
                  = TYPE_MODE (TREE_TYPE (argtype));
11950
                rtx mem = gen_rtx_MEM (indmode, x);
11951
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref", mem);
11952
                cselib_val *val = cselib_lookup (mem, indmode, 0, VOIDmode);
11953
                if (val && cselib_preserved_value_p (val))
11954
                  {
11955
@@ -6462,12 +6470,14 @@
11956
       machine_mode mode
11957
        = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref)));
11958
       rtx clobbered = gen_rtx_MEM (mode, this_arg);
11959
+                       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered", clobbered);
11960
       HOST_WIDE_INT token
11961
        = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref));
11962
       if (token)
11963
        clobbered = plus_constant (mode, clobbered,
11964
                                   token * GET_MODE_SIZE (mode));
11965
       clobbered = gen_rtx_MEM (mode, clobbered);
11966
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/clobbered-2", clobbered);
11967
       x = gen_rtx_CONCAT (mode, gen_rtx_CLOBBER (VOIDmode, pc_rtx), clobbered);
11968
       call_arguments
11969
        = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
11970
@@ -9790,6 +9800,7 @@
11971
              machine_mode indmode
11972
                = TYPE_MODE (TREE_TYPE (TREE_TYPE (parm)));
11973
              rtx mem = gen_rtx_MEM (indmode, incoming);
11974
+       ZIP_DEBUG_LINE("Var-tracking mem-ref/incoming", incoming);
11975
              cselib_val *val = cselib_lookup_from_insn (mem, indmode, true,
11976
                                                         VOIDmode,
11977
                                                         get_insns ());
11978
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgcc/config.host gcc-5.3.0-zip/libgcc/config.host
11979
--- gcc-5.3.0-original/libgcc/config.host       2015-10-01 08:01:18.000000000 -0400
11980
+++ gcc-5.3.0-zip/libgcc/config.host    2016-01-30 15:16:00.459883558 -0500
11981
@@ -195,6 +195,9 @@
11982
 tic6x-*-*)
11983
        cpu_type=c6x
11984
        ;;
11985
+zip*)
11986
+       cpu_type=zip
11987
+       ;;
11988
 esac
11989
 
11990
 # Common parts for widely ported systems.
11991
@@ -1300,6 +1303,9 @@
11992
        echo "*** Configuration ${host} not supported" 1>&2
11993
        exit 1
11994
        ;;
11995
+zip*)
11996
+       tmake_file="${tmake_file} t-softfp-sfdf t-softfp"
11997
+       ;;
11998
 esac
11999
 
12000
 case ${host} in
12001
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/libgomp/configure.tgt gcc-5.3.0-zip/libgomp/configure.tgt
12002
--- gcc-5.3.0-original/libgomp/configure.tgt    2015-03-13 06:57:07.000000000 -0400
12003
+++ gcc-5.3.0-zip/libgomp/configure.tgt 2016-01-30 15:16:51.323521641 -0500
12004
@@ -150,6 +150,9 @@
12005
        # Need to link with -lpthread so libgomp.so is self-contained.
12006
        XLDFLAGS="${XLDFLAGS} -lpthread"
12007
        ;;
12008
+  zip*)
12009
+        config_path="bsd posix"
12010
+        ;;
12011
 
12012
   *)
12013
        ;;

powered by: WebSVN 2.1.0

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