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

Subversion Repositories zipcpu

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /zipcpu/trunk
    from Rev 137 to Rev 138
    Reverse comparison

Rev 137 → Rev 138

/rtl/core/idecode.v
81,7 → 81,7
output wire o_early_branch;
output wire [(AW-1):0] o_branch_pc;
output wire o_ljmp;
output reg o_pipe;
output wire o_pipe;
 
wire dcdA_stall, dcdB_stall, dcdF_stall;
wire o_dcd_early_branch;
88,12 → 88,12
wire [(AW-1):0] o_dcd_branch_pc;
reg o_dcdI, o_dcdIz;
`ifdef OPT_PIPELINED
reg r_lock;
reg r_lock, r_pipe;
`endif
 
 
wire [4:0] w_op;
wire w_ldi, w_mov, w_cmptst, w_ldilo, w_ALU, w_brev;
wire w_ldi, w_mov, w_cmptst, w_ldilo, w_ALU, w_brev, w_noop;
wire [4:0] w_dcdR, w_dcdB, w_dcdA;
wire w_dcdR_pc, w_dcdR_cc;
wire w_dcdA_pc, w_dcdA_cc;
133,8 → 133,20
assign w_ALU = (~w_op[4]);
 
// 4 LUTs
//
// Two parts to the result register: the register set, given for
// moves in i_word[18] but only for the supervisor, and the other
// four bits encoded in the instruction.
//
assign w_dcdR = { ((~iword[31])&&(w_mov)&&(~i_gie))?iword[18]:i_gie,
iword[30:27] };
// 2 LUTs
//
// If the result register is either CC or PC, and this would otherwise
// be a floating point instruction with floating point opcode of 0,
// then this is a NOOP.
assign w_noop = (w_op[4:0] == 5'h18)&&(w_dcdR[3:1] == 3'h7);
 
// 4 LUTs
assign w_dcdB = { ((~iword[31])&&(w_mov)&&(~i_gie))?iword[13]:i_gie,
iword[17:14] };
321,7 → 333,7
// o_FP plus these four bits uniquely defines the FP
// instruction, o_DV plus the bottom of these defines
// the divide, etc.
o_op <= (w_ldi)? 4'hf:w_op[3:0];
o_op <= (w_ldi)||(w_noop)? 4'hf:w_op[3:0];
 
// Default values
o_dcdR <= { w_dcdR_cc, w_dcdR_pc, w_dcdR};
333,7 → 345,12
r_I <= w_I;
o_zI <= w_Iz;
 
o_ALU <= (w_ALU)||(w_ldi)||(w_cmptst); // 1 LUT
// Turn a NOOP into an ALU operation--subtract in
// particular, although it doesn't really matter as long
// as it doesn't take longer than one clock. Note
// also that this depends upon not setting any registers
// or flags, which should already be true.
o_ALU <= (w_ALU)||(w_ldi)||(w_cmptst)||(w_noop); // 2 LUT
o_M <= w_dcdM;
o_DV <= w_dcdDV;
o_FP <= w_dcdFP;
426,9 → 443,12
// taking place, and it's only valid if the new word is not compressed.
//
reg r_valid;
`ifdef OPT_PIPELINED
reg r_pipe;
initial r_pipe = 1'b0;
always @(posedge i_clk)
if (i_ce)
o_pipe <= (r_valid)&&(i_pf_valid)&&(~i_instruction[31])
r_pipe <= (r_valid)&&(i_pf_valid)&&(~i_instruction[31])
&&(w_dcdM)&&(o_M)&&(o_op[0] ==i_instruction[22])
&&(i_instruction[17:14] == o_dcdB[3:0])
&&(i_instruction[17:14] != o_dcdA[3:0])
437,6 → 457,11
||(o_cond[2:0] == 3'h0))
&&((i_instruction[13:0]==r_I[13:0])
||({1'b0, i_instruction[13:0]}==(r_I[13:0]+14'h1)));
assign o_pipe = r_pipe;
`else
assign o_pipe = 1'b0;
`endif
 
always @(posedge i_clk)
if (i_rst)
r_valid <= 1'b0;
/rtl/core/cpuops.v
32,7 → 32,7
//
///////////////////////////////////////////////////////////////////////////
//
// `define LONG_MPY
`define LONG_MPY
module cpuops(i_clk,i_rst, i_ce, i_valid, i_op, i_a, i_b, o_c, o_f, o_valid,
o_illegal, o_busy);
parameter IMPLEMENT_MPY = 1;
240,13 → 240,14
// +(al*bl)
// - 2^31 (2^16 bh+bl + 2^16 ah+al + 2^31)
//
reg [31:0] pp_f, pp_o, pp_i, pp_l;
reg [31:0] pp_f, pp_l; // F and L from FOIL
reg [32:0] pp_oi; // The O and I from FOIL
reg [32:0] pp_s;
always @(posedge i_clk)
begin
pp_f<=r_mpy_a_input[31:16]*r_mpy_b_input[31:16];
pp_o<=r_mpy_a_input[31:16]*r_mpy_b_input[15: 0];
pp_i<=r_mpy_a_input[15: 0]*r_mpy_b_input[31:16];
pp_oi<=r_mpy_a_input[31:16]*r_mpy_b_input[15: 0]
+ r_mpy_a_input[15: 0]*r_mpy_b_input[31:16];
pp_l<=r_mpy_a_input[15: 0]*r_mpy_b_input[15: 0];
// And a special one for the sign
if (r_mpy_signed)
263,8 → 264,7
r_mpy_result[15:0] <= pp_l[15:0];
r_mpy_result[63:16] <=
{ 32'h00, pp_l[31:16] }
+ { 16'h00, pp_o }
+ { 16'h00, pp_i }
+ { 15'h00, pp_oi }
+ { pp_s, 15'h00 }
+ { pp_f, 16'h00 };
end
/rtl/cpudefs.v
77,7 → 77,7
// instruction that will then trip the illegal instruction trap.
//
//
`define OPT_MULTIPLY
`define OPT_MULTIPLY 1
//
//
//
/sw/gcc-zippatch.patch
138,7 → 138,7
+
+struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
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
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/aarch64/aarch64-linux.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/aarch64/aarch64-linux.h 2015-07-24 12:00:26.000000000 -0400
@@ -21,7 +21,7 @@
#ifndef GCC_AARCH64_LINUX_H
150,7 → 150,7
#undef ASAN_CC1_SPEC
#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
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
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/alpha/linux-elf.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/alpha/linux-elf.h 2015-01-05 07:33:28.000000000 -0500
@@ -23,8 +23,8 @@
#define EXTRA_SPECS \
164,7 → 164,7
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
#elif DEFAULT_LIBC == LIBC_GLIBC
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
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/arm/linux-eabi.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/arm/linux-eabi.h 2015-01-05 07:33:28.000000000 -0500
@@ -68,8 +68,8 @@
GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
178,7 → 178,7
#define GLIBC_DYNAMIC_LINKER \
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
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/arm/linux-elf.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/arm/linux-elf.h 2015-06-23 05:26:54.000000000 -0400
@@ -62,7 +62,7 @@
190,7 → 190,7
#define LINUX_TARGET_LINK_SPEC "%{h*} \
%{static:-Bstatic} \
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/bfin/linux.h gcc-5.3.0-zip/gcc/config/bfin/linux.h
--- gcc-5.3.0-original/gcc/config/bfin/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/bfin/linux.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/bfin/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -45,7 +45,7 @@
%{shared:-G -Bdynamic} \
202,7 → 202,7
#undef TARGET_SUPPORTS_SYNC_CALLS
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/cris/linux.h gcc-5.3.0-zip/gcc/config/cris/linux.h
--- gcc-5.3.0-original/gcc/config/cris/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/cris/linux.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/cris/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -102,7 +102,7 @@
#undef CRIS_DEFAULT_CPU_VERSION
214,7 → 214,7
#undef CRIS_LINK_SUBTARGET_SPEC
#define CRIS_LINK_SUBTARGET_SPEC \
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/freebsd-spec.h gcc-5.3.0-zip/gcc/config/freebsd-spec.h
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/freebsd-spec.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/freebsd-spec.h 2015-06-25 13:53:14.000000000 -0400
@@ -129,9 +129,9 @@
#endif
229,7 → 229,7
/* NOTE: The freebsd-spec.h header is included also for various
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/frv/linux.h gcc-5.3.0-zip/gcc/config/frv/linux.h
--- gcc-5.3.0-original/gcc/config/frv/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/frv/linux.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/frv/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -34,7 +34,7 @@
#define ENDFILE_SPEC \
241,7 → 241,7
#undef LINK_SPEC
#define LINK_SPEC "\
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/gnu.h gcc-5.3.0-zip/gcc/config/i386/gnu.h
--- gcc-5.3.0-original/gcc/config/i386/gnu.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/i386/gnu.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/i386/gnu.h 2015-01-05 07:33:28.000000000 -0500
@@ -22,7 +22,7 @@
#define GNU_USER_LINK_EMULATION "elf_i386"
253,7 → 253,7
#undef STARTFILE_SPEC
#if defined HAVE_LD_PIE
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
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu64.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu64.h 2015-01-05 07:33:28.000000000 -0500
@@ -22,6 +22,6 @@
#define GNU_USER_LINK_EMULATION64 "elf_x86_64_fbsd"
266,7 → 266,7
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-kfreebsd-x86-64.so.1"
+#define GLIBC_DYNAMIC_LINKERX32 "/lib/ld-kfreebsd-x32.so.1"
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
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/i386/kfreebsd-gnu.h 2016-05-06 10:50:31.943799053 -0400
+++ gcc-5.3.0-zip/gcc/config/i386/kfreebsd-gnu.h 2015-01-05 07:33:28.000000000 -0500
@@ -19,4 +19,4 @@
<http://www.gnu.org/licenses/>. */
275,7 → 275,7
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux64.h gcc-5.3.0-zip/gcc/config/i386/linux64.h
--- gcc-5.3.0-original/gcc/config/i386/linux64.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/i386/linux64.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/i386/linux64.h 2015-01-05 07:33:28.000000000 -0500
@@ -27,6 +27,6 @@
#define GNU_USER_LINK_EMULATION64 "elf_x86_64"
288,7 → 288,7
+#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/i386/linux.h gcc-5.3.0-zip/gcc/config/i386/linux.h
--- gcc-5.3.0-original/gcc/config/i386/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/i386/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/i386/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -20,4 +20,4 @@
<http://www.gnu.org/licenses/>. */
297,7 → 297,7
-#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/ia64/linux.h gcc-5.3.0-zip/gcc/config/ia64/linux.h
--- gcc-5.3.0-original/gcc/config/ia64/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/ia64/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/ia64/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -55,7 +55,7 @@
/* Define this for shared library support because it isn't in the main
309,7 → 309,7
#undef LINK_SPEC
#define LINK_SPEC "\
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/knetbsd-gnu.h gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/knetbsd-gnu.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/knetbsd-gnu.h 2015-01-05 07:33:28.000000000 -0500
@@ -32,4 +32,4 @@
318,7 → 318,7
-#define GNU_USER_DYNAMIC_LINKER "/tools/lib/ld.so.1"
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/kopensolaris-gnu.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/kopensolaris-gnu.h 2015-01-05 07:33:28.000000000 -0500
@@ -31,5 +31,4 @@
while (0)
328,7 → 328,7
-
+#define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1"
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/linux.h gcc-5.3.0-zip/gcc/config/linux.h
--- gcc-5.3.0-original/gcc/config/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -73,10 +73,10 @@
GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
346,7 → 346,7
#define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
#define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
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
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/lm32/uclinux-elf.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/lm32/uclinux-elf.h 2015-01-05 07:33:28.000000000 -0500
@@ -67,7 +67,7 @@
%{shared:-shared} \
358,7 → 358,7
#define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS()
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/m68k/linux.h gcc-5.3.0-zip/gcc/config/m68k/linux.h
--- gcc-5.3.0-original/gcc/config/m68k/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/m68k/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/m68k/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -71,7 +71,7 @@
When the -shared link option is used a final link is not being
370,7 → 370,7
#undef LINK_SPEC
#define LINK_SPEC "-m m68kelf %{shared} \
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/microblaze/linux.h gcc-5.3.0-zip/gcc/config/microblaze/linux.h
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/microblaze/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/microblaze/linux.h 2015-05-28 10:08:19.000000000 -0400
@@ -28,7 +28,7 @@
#undef TLS_NEEDS_GOT
382,7 → 382,7
#define SUBTARGET_EXTRA_SPECS \
{ "dynamic_linker", DYNAMIC_LINKER }
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mips/linux.h gcc-5.3.0-zip/gcc/config/mips/linux.h
--- gcc-5.3.0-original/gcc/config/mips/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/mips/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/mips/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -22,20 +22,20 @@
#define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
412,7 → 412,7
#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
#define GNU_USER_DYNAMIC_LINKERN32 \
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/mn10300/linux.h gcc-5.3.0-zip/gcc/config/mn10300/linux.h
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h 2016-04-22 17:02:06.640199519 -0400
--- gcc-5.3.0-original/gcc/config/mn10300/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/mn10300/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -32,7 +32,7 @@
#undef ASM_SPEC
424,7 → 424,7
#undef LINK_SPEC
#define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \
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
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/pa/pa-linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/pa/pa-linux.h 2015-09-24 20:04:26.000000000 -0400
@@ -37,7 +37,7 @@
/* Define this for shared library support because it isn't in the main
436,7 → 436,7
#undef LINK_SPEC
#define LINK_SPEC "\
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/linux64.h gcc-5.3.0-zip/gcc/config/rs6000/linux64.h
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/rs6000/linux64.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/rs6000/linux64.h 2015-03-09 19:18:57.000000000 -0400
@@ -357,14 +357,14 @@
#undef LINK_OS_DEFAULT_SPEC
459,7 → 459,7
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
#elif DEFAULT_LIBC == LIBC_GLIBC
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/rs6000/sysv4.h gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/rs6000/sysv4.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h 2015-09-24 09:46:45.000000000 -0400
@@ -757,8 +757,8 @@
473,7 → 473,7
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
#elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/s390/linux.h gcc-5.3.0-zip/gcc/config/s390/linux.h
--- gcc-5.3.0-original/gcc/config/s390/linux.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/s390/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/s390/linux.h 2015-05-11 03:14:10.000000000 -0400
@@ -60,8 +60,8 @@
#define MULTILIB_DEFAULTS { "m31" }
487,7 → 487,7
#undef LINK_SPEC
#define LINK_SPEC \
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sh/linux.h gcc-5.3.0-zip/gcc/config/sh/linux.h
--- gcc-5.3.0-original/gcc/config/sh/linux.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/sh/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/sh/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -43,7 +43,7 @@
499,7 → 499,7
#undef SUBTARGET_LINK_EMUL_SUFFIX
#define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux64.h gcc-5.3.0-zip/gcc/config/sparc/linux64.h
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/sparc/linux64.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/sparc/linux64.h 2015-01-05 07:33:28.000000000 -0500
@@ -84,8 +84,8 @@
When the -shared link option is used a final link is not being
522,7 → 522,7
%{!static: \
%{rdynamic:-export-dynamic} \
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/sparc/linux.h gcc-5.3.0-zip/gcc/config/sparc/linux.h
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/sparc/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/sparc/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -83,7 +83,7 @@
When the -shared link option is used a final link is not being
534,7 → 534,7
#undef LINK_SPEC
#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/vax/linux.h gcc-5.3.0-zip/gcc/config/vax/linux.h
--- gcc-5.3.0-original/gcc/config/vax/linux.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/vax/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/vax/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -41,7 +41,7 @@
%{!shared: \
546,7 → 546,7
#undef WCHAR_TYPE
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/xtensa/linux.h gcc-5.3.0-zip/gcc/config/xtensa/linux.h
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h 2016-04-22 17:02:06.644199498 -0400
--- gcc-5.3.0-original/gcc/config/xtensa/linux.h 2016-05-06 10:50:31.947799027 -0400
+++ gcc-5.3.0-zip/gcc/config/xtensa/linux.h 2015-01-05 07:33:28.000000000 -0500
@@ -44,7 +44,7 @@
%{mlongcalls:--longcalls} \
696,8 → 696,8
+
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.c gcc-5.3.0-zip/gcc/config/zip/zip.c
--- gcc-5.3.0-original/gcc/config/zip/zip.c 1969-12-31 19:00:00.000000000 -0500
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c 2016-04-22 17:01:44.712315371 -0400
@@ -0,0 +1,2174 @@
+++ gcc-5.3.0-zip/gcc/config/zip/zip.c 2016-05-02 21:56:27.075389925 -0400
@@ -0,0 +1,2185 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: zip.c
1203,7 → 1203,7
+ if (dbg) fprintf(stderr, "PROLOGUE: SP-FP offset is %d\n",
+ cfun->machine->sp_fp_offset);
+ if (cfun->machine->size_for_adjusting_sp != 0) {
+ insn = emit_insn(gen_subsi3(stack_pointer_rtx,
+ insn = emit_insn(gen_subsi3_reg_clobber(stack_pointer_rtx,
+ stack_pointer_rtx,
+ gen_int_mode(cfun->machine->size_for_adjusting_sp,
+ SImode)));
1297,6 → 1297,7
+zip_expand_epilogue(void) {
+ int regno, offset;
+ const bool dbg = ((ALL_DEBUG_ON)||(false))&&(!ALL_DEBUG_OFF);
+ rtx insn;
+
+ zip_compute_frame();
+
1308,7 → 1309,8
+ // by moving the frame pointer to the stack pointer to recover
+ // the stack pointer back to a usable value.
+ if (dbg) fprintf(stderr, "EPILOG::Moving frame pointer to stack register\n");
+ emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
+ insn = emit_insn(gen_movsi_reg(stack_pointer_rtx, frame_pointer_rtx));
+ RTX_FRAME_RELATED_P(insn) = 1;
+ }
+
+ if (cfun->machine->saved_reg_size != 0) {
1320,10 → 1322,13
+ for(regno=0; regno < FIRST_PSEUDO_REGISTER; regno++) {
+ if (zip_save_reg(regno)) {
+ if (dbg) fprintf(stderr, "EPILOG::RESTORING R%d\n", regno);
+ emit_insn(gen_movsi_lod_off(
+ gen_rtx_REG(SImode, regno),
+ rtx reg = gen_rtx_REG(SImode, regno);
+ insn = emit_insn(gen_movsi_lod_off(
+ reg,
+ stack_pointer_rtx,
+ GEN_INT(offset++)));
+ add_reg_note(insn, REG_CFA_RESTORE, reg);
+ RTX_FRAME_RELATED_P(insn) = 1;
+ }
+ }
+ }
1332,20 → 1337,26
+ // Restore the stack pointer back to the original, the
+ // difference being the difference from the frame pointer
+ // to the original stack
+ emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
+ insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
+ stack_pointer_rtx,
+ GEN_INT(cfun->machine->size_for_adjusting_sp
+ -cfun->machine->sp_fp_offset)));
+ RTX_FRAME_RELATED_P(insn) = 1;
+ } else {
+ // else now the difference is between the stack pointer and
+ // the original stack pointer.
+ if (dbg) fprintf(stderr, "EPILOG::ADDSI3(StackPtr, %d)\n",
+ cfun->machine->size_for_adjusting_sp);
+ emit_insn(gen_addsi3(stack_pointer_rtx, stack_pointer_rtx,
+ insn = emit_insn(gen_addsi3_reg_clobber(stack_pointer_rtx,
+ stack_pointer_rtx,
+ GEN_INT(cfun->machine->size_for_adjusting_sp)));
+ RTX_FRAME_RELATED_P(insn) = 1;
+ }
+ if (dbg) fprintf(stderr, "EPILOG::EMITTING-RETURN\n");
+
+ emit_jump_insn(ret_rtx);
+ // The return RTX is not allowed to be frame related
+ insn = emit_jump_insn(ret_rtx);
+ // RTX_FRAME_RELATED_P(insn) = 1;
+}
+
+/* Implement RETURN_ADDR_RTX(COUNT, FRAMEADDR).
1676,7 → 1687,7
+ *op1 = GEN_INT(INTVAL(*op1)+offset);
+ swap = true;
+ } else if (REG_P(*op1)) {
+ *op1 = plus_constant(SImode, *op1, offset, true);
+ *op1 = plus_constant(GET_MODE(*op1), *op1, offset, true);
+ swap = true;
+ } else if ((GET_CODE(*op1)==PLUS)&&(CONST_INT_P(XEXP(*op1,1)))){
+ *op1 = plus_constant(GET_MODE(*op1),XEXP(*op1,0),
1709,8 → 1720,8
+ // Whereas at one time I thought I wouldn't need it, now I know I
+ // need this trampoline function, although it is for a completely
+ // different purpose than the one I was familiar with.
+ fprintf(f, "\tldihi 0,r1\n");
+ fprintf(f, "\tldilo 0,r1\n");
+ fprintf(f, "\tbrev\t0,r1\n");
+ fprintf(f, "\tldilo\t0,r1\n");
+ fprintf(f, "\tjmp r1\n");
+}
+
2874,8 → 2885,8
+}
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.h gcc-5.3.0-zip/gcc/config/zip/zip.h
--- gcc-5.3.0-original/gcc/config/zip/zip.h 1969-12-31 19:00:00.000000000 -0500
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h 2016-04-21 16:49:43.785679680 -0400
@@ -0,0 +1,4058 @@
+++ gcc-5.3.0-zip/gcc/config/zip/zip.h 2016-04-30 19:30:48.670201745 -0400
@@ -0,0 +1,4060 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: gcc/config/zip/zip.h
2931,6 → 2942,8
+#define ZIP_HAS_DI 1
+// Should we use the peephole optimizations?
+#define ZIP_PEEPHOLE 1 // 0 means no peephole optimizations.
+// How about the new long multiply instruction set?
+#define ZIP_LONGMPY 1 // 0 means use the old instruction set
+
+// Zip has 16 registers in each user mode.
+// Register 15 is the program counter (PC)
6936,8 → 6949,8
+
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/config/zip/zip.md gcc-5.3.0-zip/gcc/config/zip/zip.md
--- gcc-5.3.0-original/gcc/config/zip/zip.md 1969-12-31 19:00:00.000000000 -0500
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-04-21 20:01:08.790659796 -0400
@@ -0,0 +1,2961 @@
+++ gcc-5.3.0-zip/gcc/config/zip/zip.md 2016-05-04 11:07:24.042917943 -0400
@@ -0,0 +1,3219 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Filename: zip.md
7458,10 → 7471,9
+;
+;
+(define_expand "sub<mode>3"
+ [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (minus:ZI (match_operand:ZI 1 "register_operand" "0")
+ (match_operand:ZI 2 "zip_opb_operand_p" "")))
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))])])
+ (match_operand:ZI 2 "zip_opb_operand_p" "")))])
+(define_insn_and_split "sub<mode>3_split_reg"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7472,7 → 7484,7
+ [(parallel [(set (match_dup 0) (minus:ZI (match_dup 1) (match_dup 2)))
+ (clobber (reg:CC CC_REG))])]
+ ""
+ [(set_attr "ccresult" "set")])
+ [(set_attr "ccresult" "set") (set_attr "predicable" "yes")])
+(define_insn "sub<mode>3_reg_raw"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (minus:ZI (match_operand:ZI 1 "register_operand" "0")
7520,7 → 7532,7
+ ""
+ "SUB %3+%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "mul<mode>3"
+(define_insn "mul<mode>3_oldstyle"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (mult:ZI (match_operand:ZI 1 "register_operand" "%r")
+ (match_operand:ZI 2 "register_operand" "r")))
7527,7 → 7539,7
+ (clobber (match_scratch:ZI 3 "=r"))
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
+ ; "(R0 != R1)&&(R0 != R2)&&(R0!=R3)&&(R1!=R2)&&(R1=R3)&&(R2!=R3)"
+ ""
+ "(!ZIP_LONGMPY)"
+ "MOV %1,%0
+ MPYS %2,%0
+ MOV %1,%3
7543,7 → 7555,266
+ AND 0x0ffff,%3
+ ADD %3,%0"
+ [(set_attr "ccresult" "unknown")])
+
+;
+;
+(define_expand "mul<mode>3"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (mult:ZI (match_operand:ZI 1 "register_operand" "0")
+ (match_operand:ZI 2 "zip_opb_operand_p" "")))]
+ "(ZIP_LONGMPY)")
+(define_insn_and_split "mul<mode>3_split_reg"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (mult:ZI (match_operand:ZI 1 "register_operand" "0")
+ (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))]
+ "(ZIP_LONGMPY)"
+ "#"
+ "(reload_completed)"
+ [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1) (match_dup 2)))
+ (clobber (reg:CC CC_REG))])]
+ ""
+ [(set_attr "ccresult" "set")])
+(define_insn_and_split "mul<mode>3_split_off"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (mult:ZI (match_operand:ZI 1 "register_operand" "0")
+ (plus:ZI (match_operand:ZI 2 "register_operand" "r")
+ (match_operand:ZI 3 "zip_opb_immv_p" "N"))))]
+ "(ZIP_LONGMPY)"
+ "#"
+ "(reload_completed)"
+ [(parallel [(set (match_dup 0) (mult:ZI (match_dup 1)
+ (plus:ZI (match_dup 2) (match_dup 3))))
+ (clobber (reg:CC CC_REG))])]
+ ""
+ [(set_attr "ccresult" "set")])
+(define_insn "mul<mode>3_reg_clobber"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (mult:ZI (match_operand:ZI 1 "register_operand" "0")
+ (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
+ (clobber (reg:CC CC_REG))]
+ "(ZIP_LONGMPY)"
+ "MPY\t%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "mul<mode>3_reg_raw"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (mult:ZI (match_operand:ZI 1 "register_operand" "0")
+ (match_operand:ZI 2 "zip_opb_single_operand_p" "rO")))
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
+ "(ZIP_LONGMPY)"
+ "MPY\t%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "mul<mode>3_off_raw"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (mult:ZI (match_operand:ZI 1 "register_operand" "0")
+ (plus:ZI (match_operand:ZI 2 "register_operand" "r")
+ (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
+ "(ZIP_LONGMPY)"
+ "MPY\t%3+%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "mul<mode>3_off_clobber"
+ [(set (match_operand:ZI 0 "register_operand" "=r")
+ (mult:ZI (match_operand:ZI 1 "register_operand" "0")
+ (plus:ZI (match_operand:ZI 2 "register_operand" "r")
+ (match_operand:ZI 3 "zip_opb_immv_p" "N"))))
+ (clobber (reg:CC CC_REG))]
+ "(ZIP_LONGMPY)"
+ "MPY\t%3+%2,%0"
+ [(set_attr "ccresult" "set")])
+;
+;
+(define_expand "smulsi3_highpart"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI (mult:DI
+ (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (sign_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
+ (const_int 32))))]
+ "(ZIP_LONGMPY)")
+(define_insn_and_split "smulsi3_highpart_split_reg"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI (mult:DI
+ (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
+ (const_int 32))))]
+ "(ZIP_LONGMPY)"
+ "#"
+ "(reload_completed)"
+ [(parallel [(set (match_dup 0)
+ (truncate:SI (ashiftrt:DI
+ (mult:DI
+ (sign_extend:DI (match_dup 1))
+ (sign_extend:DI (match_dup 2)))
+ (const_int 32))))
+ (clobber (reg:CC CC_REG))])]
+ ""
+ [(set_attr "ccresult" "set")])
+(define_insn_and_split "smulsi3_highpart_split_off"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashift:DI (mult:DI
+ (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (sign_extend:DI
+ (plus:SI (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "zip_opb_immv_p" "N"))))
+ (const_int 32))))]
+ "(ZIP_LONGMPY)"
+ "#"
+ "(reload_completed)"
+ [(parallel [(set (match_dup 0)
+ (truncate:SI (ashiftrt:DI
+ (mult:SI
+ (sign_extend:DI (match_dup 1))
+ (sign_extend:DI
+ (plus:SI (match_dup 2) (match_dup 3))))
+ (const_int 32))))
+ (clobber (reg:CC CC_REG))])]
+ ""
+ [(set_attr "ccresult" "set")])
+(define_insn "smulsi3_highpart_reg_clobber"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:SI
+ (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
+ (const_int 32))))
+ (clobber (reg:CC CC_REG))]
+ "(ZIP_LONGMPY)"
+ "MPYSHI\t%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "smulsi3_highpart_reg_raw"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:SI
+ (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (sign_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
+ (const_int 32))))
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
+ "(ZIP_LONGMPY)"
+ "MPYSHI\t%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "smulsi3_highpart_off_raw"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:SI
+ (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (sign_extend:DI (plus:SI
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "zip_opb_immv_p" "N"))))
+ (const_int 32))))
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
+ "(ZIP_LONGMPY)"
+ "MPYSHI\t%3+%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "smulsi3_highpart_off_clobber"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:SI
+ (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (sign_extend:DI (plus:SI
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "zip_opb_immv_p" "N"))))
+ (const_int 32))))
+ (clobber (reg:CC CC_REG))]
+ "(ZIP_LONGMPY)"
+ "MPYSHI\t%3+%2,%0"
+ [(set_attr "ccresult" "set")])
+;
+;
+(define_expand "umulsi3_highpart"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI (mult:DI
+ (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (zero_extend:DI (match_operand:SI 2 "zip_opb_operand_p" "")))
+ (const_int 32))))]
+ "(ZIP_LONGMPY)")
+(define_insn_and_split "umulsi3_highpart_split_reg"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI (mult:DI
+ (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
+ (const_int 32))))]
+ "(ZIP_LONGMPY)"
+ "#"
+ "(reload_completed)"
+ [(parallel [(set (match_dup 0)
+ (truncate:SI (ashiftrt:DI
+ (mult:SI
+ (zero_extend:DI (match_dup 1))
+ (zero_extend:DI (match_dup 2)))
+ (const_int 32))))
+ (clobber (reg:CC CC_REG))])]
+ ""
+ [(set_attr "ccresult" "set")])
+(define_insn_and_split "umulsi3_highpart_split_off"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:DI
+ (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (zero_extend:DI
+ (plus:SI (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "zip_opb_immv_p" "N"))))
+ (const_int 32))))]
+ "(ZIP_LONGMPY)"
+ "#"
+ "(reload_completed)"
+ [(parallel [(set (match_dup 0)
+ (truncate:SI (ashiftrt:DI
+ (mult:DI
+ (zero_extend:DI (match_dup 1))
+ (zero_extend:DI
+ (plus:SI (match_dup 2) (match_dup 3))))
+ (const_int 32))))
+ (clobber (reg:CC CC_REG))])]
+ ""
+ [(set_attr "ccresult" "set")])
+(define_insn "umulsi3_highpart_reg_clobber"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:DI
+ (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
+ (const_int 32))))
+ (clobber (reg:CC CC_REG))]
+ "(ZIP_LONGMPY)"
+ "MPYSHI\t%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "umulsi3_highpart_reg_raw"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:DI
+ (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (zero_extend:DI (match_operand:SI 2 "zip_opb_single_operand_p" "rO")))
+ (const_int 32))))
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
+ "(ZIP_LONGMPY)"
+ "MPYSHI\t%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "umulsi3_highpart_off_raw"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:DI
+ (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (zero_extend:DI (plus:SI
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:DI 3 "zip_opb_immv_p" "N"))))
+ (const_int 32))))
+ (set (reg:CC CC_REG) (compare:CC (match_dup 0) (const_int 0)))]
+ "(ZIP_LONGMPY)"
+ "MPYSHI\t%3+%2,%0"
+ [(set_attr "ccresult" "set")])
+(define_insn "umulsi3_highpart_off_clobber"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (truncate:SI (ashiftrt:DI
+ (mult:DI
+ (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
+ (zero_extend:DI (plus:SI
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:DI 3 "zip_opb_immv_p" "N"))))
+ (const_int 32))))
+ (clobber (reg:CC CC_REG))]
+ "(ZIP_LONGMPY)"
+ "MPYSHI\t%3+%2,%0"
+ [(set_attr "ccresult" "set")])
+;
+;
+(define_expand "div<mode>3"
+ [(parallel [(set (match_operand:ZI 0 "register_operand" "=r")
+ (div:ZI (match_operand:ZI 1 "register_operand" "0")
8056,8 → 8327,8
+ static char buf[64];
+ sprintf(buf,
+ "LOD\t%ld(%%1),%%H0\n\tLOD\t%ld(%%1),%%L0",
+ INTVAL(XEXP(operands[1],1)),
+ INTVAL(XEXP(operands[1],1)+1));
+ (long)INTVAL(XEXP(operands[1],1)),
+ (long)INTVAL(XEXP(operands[1],1)+1));
+ return buf;
+ }
+ } return "BREAK";
8076,8 → 8347,8
+ static char buf[64];
+ sprintf(buf,
+ "STO\t%%H0,%ld(%%1)\n\tSTO\t%%L0,%ld(%%1)",
+ INTVAL(XEXP(operands[0],1)),
+ INTVAL(XEXP(operands[0],1)+1));
+ (long)INTVAL(XEXP(operands[0],1)),
+ (long)INTVAL(XEXP(operands[0],1)+1));
+ return buf;
+ }
+ } return "BREAK";
8324,7 → 8595,7
+(define_insn "cmp<mode>_off"
+ [(set (reg:CC CC_REG) (compare:CC
+ (match_operand:ZI 0 "register_operand" "r")
+ (plus (match_operand:ZI 1 "register_operand" "r")
+ (plus:SI (match_operand:ZI 1 "register_operand" "r")
+ (match_operand 2 "zip_opb_immv_p" "N"))))]
+ ""
+ "CMP\t%2+%1,%0"
10044,8 → 10315,16
exit 1
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/cse.c gcc-5.3.0-zip/gcc/cse.c
--- gcc-5.3.0-original/gcc/cse.c 2015-02-03 15:41:38.000000000 -0500
+++ gcc-5.3.0-zip/gcc/cse.c 2016-04-05 22:26:30.816200542 -0400
@@ -634,6 +634,15 @@
+++ gcc-5.3.0-zip/gcc/cse.c 2016-05-04 11:07:38.874831028 -0400
@@ -70,6 +70,7 @@
#include "dbgcnt.h"
#include "rtl-iter.h"
+
/* The basic idea of common subexpression elimination is to go
through the code, keeping a record of expressions that would
have the same value at the current scan point, and replacing
@@ -634,6 +635,16 @@
/* Nonzero if X has the form (PLUS frame-pointer integer). */
10052,7 → 10331,8
+// #define DO_ZIP_DEBUGS
+#ifdef DO_ZIP_DEBUGS
+#include <stdio.h>
+extern void zip_debug_rtx(const_rtx);
+extern void zip_debug_rtx(const_rtx);
+extern void zip_debug_rtx_pfx(char *, const_rtx);
+#define ZIP_DEBUG_LINE(STR,RTX) do { fprintf(stderr, "%s\n", STR); zip_debug_rtx(RTX); } while(0)
+#else
+#define ZIP_DEBUG_LINE(STR,RTX)
10061,7 → 10341,7
static bool
fixed_base_plus_p (rtx x)
{
@@ -2898,6 +2907,7 @@
@@ -2898,6 +2909,7 @@
validate_canon_reg (&XVECEXP (x, i, j), insn);
}
10069,7 → 10349,16
return x;
}
@@ -3144,14 +3154,16 @@
@@ -3125,6 +3137,8 @@
rtx new_rtx = 0;
int changed = 0;
+ZIP_DEBUG_LINE("CSE:FOLD-RTX", insn);
+
/* Operands of X. */
/* Workaround -Wmaybe-uninitialized false positive during
profiledbootstrap by initializing them. */
@@ -3144,14 +3158,16 @@
if (x == 0)
return x;
10088,7 → 10377,7
return x;
case CONST:
@@ -3208,6 +3220,8 @@
@@ -3208,6 +3224,8 @@
rtx folded_arg = XEXP (x, i), const_arg;
machine_mode mode_arg = GET_MODE (folded_arg);
10097,7 → 10386,7
switch (GET_CODE (folded_arg))
{
case MEM:
@@ -3317,6 +3331,7 @@
@@ -3317,6 +3335,7 @@
}
apply_change_group ();
10105,7 → 10394,7
}
/* If X is an arithmetic operation, see if we can simplify it. */
@@ -4203,6 +4218,7 @@
@@ -4203,6 +4222,7 @@
{
rtx dest = SET_DEST (set);
rtx src = SET_SRC (set);
10113,7 → 10402,7
if (REG_P (dest)
&& REG_P (src) && ! HARD_REGISTER_P (src)
@@ -4258,6 +4274,7 @@
@@ -4258,6 +4278,7 @@
}
}
}
10121,7 → 10410,7
}
/* Record all the SETs in this instruction into SETS_PTR,
@@ -4351,6 +4368,7 @@
@@ -4351,6 +4372,7 @@
rtx tem;
rtx x = PATTERN (insn);
int i;
10129,7 → 10418,7
if (CALL_P (insn))
{
@@ -4364,6 +4382,7 @@
@@ -4364,6 +4386,7 @@
canon_reg (SET_SRC (x), insn);
apply_change_group ();
fold_rtx (SET_SRC (x), insn);
10137,7 → 10426,7
}
else if (GET_CODE (x) == CLOBBER)
{
@@ -4400,6 +4419,7 @@
@@ -4400,6 +4423,7 @@
canon_reg (PATTERN (insn), insn);
else if (GET_CODE (x) == PARALLEL)
{
10145,7 → 10434,7
for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
{
rtx y = XVECEXP (x, 0, i);
@@ -4491,6 +4511,7 @@
@@ -4491,6 +4515,7 @@
The result of apply_change_group can be ignored; see canon_reg. */
10403,7 → 10692,7
+duced!
diff -Naur '--exclude=*.swp' gcc-5.3.0-original/gcc/emit-rtl.c gcc-5.3.0-zip/gcc/emit-rtl.c
--- gcc-5.3.0-original/gcc/emit-rtl.c 2015-08-05 07:20:59.000000000 -0400
+++ gcc-5.3.0-zip/gcc/emit-rtl.c 2016-04-20 20:54:45.148982373 -0400
+++ gcc-5.3.0-zip/gcc/emit-rtl.c 2016-05-02 07:48:47.925017436 -0400
@@ -81,6 +81,15 @@
#include "builtins.h"
#include "rtl-iter.h"
/sw/binutils-2.25.patch
2502,8 → 2502,8
optimize the copying in the simple case without using the
diff -Naur '--exclude=*.swp' binutils-2.25-original/gas/config/tc-zip.c binutils-2.25/gas/config/tc-zip.c
--- binutils-2.25-original/gas/config/tc-zip.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.25/gas/config/tc-zip.c 2016-04-20 18:52:24.189215496 -0400
@@ -0,0 +1,2317 @@
+++ binutils-2.25/gas/config/tc-zip.c 2016-05-02 08:02:13.459987702 -0400
@@ -0,0 +1,2392 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: tc-zip.c
2510,8 → 2510,16
+//
+// Project: Zip CPU backend for GNU Binutils
+//
+// Purpose:
+// Purpose: This is the main file associated with the Zip Assembler. By
+// that I mean that it handles all of the ZipCPU specifics. The
+// rest of the files you find in this directory, mostly tc-cpuname.c and
+// such, handle other CPUs. This one handles the ZipCPU. The goal in
+// doing this is so that nothing else changes when changes need to be made
+// to a CPU, and that changes to the assembler in general shouldn't impact
+// the CPU specific processing.
+//
+// I'll let you be the judge as to how well this file meets that goal.
+//
+// Creator: Dan Gisselquist, Ph.D.
+// Gisselquist Technology, LLC
+//
2552,6 → 2560,7
+#include "elf/zip.h"
+
+// #define ZIP_DEBUG
+#define LONG_MPY
+
+const char comment_chars[] = ";#";
+const char line_comment_chars[] = ";#";
2806,12 → 2815,15
+ case ZIPO_LSL: printf("%7s", "LSL"); break;
+ case ZIPO_ASR: printf("%7s", "ASR"); break;
+ case ZIPO_LDI: printf("%7s", "LDI"); break;
+#ifndef LONG_MPY
+#ifdef LONG_MPY
+ case ZIPO_MPYUHI: printf("%7s", "MPYUHI"); break;
+ case ZIPO_MPYSHI: printf("%7s", "MPYSHI"); break;
+#else // LONG_MPY
+ case ZIPO_LDIHI: printf("%7s", "LDIHI"); break;
+ case ZIPO_MPYU: printf("%7s", "MPYU"); break;
+ case ZIPO_MPYS: printf("%7s", "MPYS"); break;
+#endif
+ case ZIPO_LDILO: printf("%7s", "LDILO"); break;
+ case ZIPO_MPYU: printf("%7s", "MPYU"); break;
+ case ZIPO_MPYS: printf("%7s", "MPYS"); break;
+ case ZIPO_BREV: printf("%7s", "BREV"); break;
+ case ZIPO_POPC: printf("%7s", "POPC"); break;
+ case ZIPO_ROL: printf("%7s", "ROL"); break;
2953,7 → 2965,7
+ // Good form is to replace this number with the possibility
+ // of a constant expression ... The number may be any of
+ // [+-](0[xX][0-9a-fA-F]+|(0[0-7]+)|(0-9)+)
+ // The next three may require a relocation
+ // The next four may require a relocation
+ // 4. Label + Register
+ // 5. Label(Register)
+ // 6. Label (Register is implied: PC, if moving or jumping
2961,6 → 2973,7
+ // the offset ends up being unknown)
+ // Good form allows an expression instead of a label,
+ // that can be evaluated at ... sometime.
+ // 7. Number(Label)
+ //
+ // We will support:
+ // (Number|Label)?( "("Register")" | "+"Register )
2967,7 → 2980,6
+ //
+ char lbl[strlen(bop)+5], *lblp = lbl;
+ const char *ptr;
+ int sgn = 0;
+ insn->i_imm = 0;
+ *lblp = '\0';
+
2975,6 → 2987,8
+
+ // Do we start with a number?
+ {
+ int sgn = 0;
+
+ ptr = zip_skip_white_spaces(bop);
+ if ('$' == *ptr)
+ ptr = zip_skip_white_spaces(ptr+1);
3010,7 → 3024,7
+ // printf("OP-B ( \'%s\' ) starts with an identifier (%c)\n",
+ // bop, *ptr);
+
+ // Skip the compiler inserted prefix
+ // Skip any compiler inserted prefix (if present)
+ if ('*' == *ptr)
+ ptr++;
+ while((*ptr)&&(
3028,14 → 3042,6
+ return "ERR: Not expecting a signed label!";
+
+ ptr = zip_skip_white_spaces(ptr);
+ if ((*ptr)&&((*ptr == '+')||(*ptr == '-'))&&(isdigit(ptr[1]))) {
+ ptr++;
+ char *end = (char *)ptr;
+ unsigned long v = strtoul(ptr, &end, 0);
+ // We start with a number
+ insn->i_imm += (int)(v);
+ ptr = (const char *)end;
+ }
+ }
+ }
+
3051,13 → 3057,46
+ *end = '\0';
+ // printf("Looking for a register in %s\n", ptr+1);
+ err = zip_parse_reg(ptr+1, &insn->i_breg);
+ if (err)
+ return err;
+ if (err) {
+ // Must've been a symbol
+ if (lbl[0] != '\0') // Already have a symbol in this
+ return err; // expression!
+ ptr++;
+ while((*ptr)&&(
+ (isalpha(*ptr))
+ ||(isdigit(*ptr))
+ ||('_' == *ptr)
+ ||('$' == *ptr)
+ ||('.' == *ptr)))
+ *lblp++ = *ptr++;
+ *lblp = '\0';
+ insn->i_breg = ZIP_RNONE;
+ ptr = zip_skip_white_spaces(ptr);
+ if (*ptr != '\0')
+ return "ERR: Expression within parenthesis not supported";
+ err = NULL;
+ }
+ // printf("Found a register, %s -> %d\n", ptr+1, insn->i_breg);
+ } else if ((*ptr)&&(*ptr == '+')) {
+ err = zip_parse_reg(ptr+1, &insn->i_breg);
+ if (err)
+ return err;
+ if ((*lbl)&&(zip_parse_reg(lbl, &insn->i_breg) == NULL)) {
+ // Register+Number
+ // Skip to the end to process what follows
+ *lbl = '\0'; // Label wasn't a symbol, so let's clear it
+ } else {
+ // Number/label+Register
+ err = zip_parse_reg(ptr+1, &insn->i_breg);
+ if (!err) {
+ // Let's skip to the end of the register
+ ptr++;
+ while(isalpha(*ptr))
+ ptr++;
+ while(isdigit(*ptr))
+ ptr++;
+ } else {
+ // OOps!! Must've been a label + number
+ err = NULL;
+ }
+ }
+ } else if ((*lbl)&&(NULL == zip_parse_reg(lbl, &insn->i_breg))) {
+ // Form: Register (only)
+ insn->i_imm = 0;
3069,6 → 3108,44
+ insn->i_breg = ZIP_RNONE;
+ }
+
+ // Look for a +number at the end
+ if ((*ptr)&&((*ptr == '+')||(*ptr == '-'))) {
+ // printf("Looking at a plus: %s\n", ptr);
+ int sgn = (*ptr == '-')?1:0;
+
+ ptr = zip_skip_white_spaces(ptr);
+ if ('$' == *ptr)
+ ptr = zip_skip_white_spaces(ptr+1);
+
+ if ('+' == *ptr)
+ ptr++;
+ if ((sgn==0)&&('-' == *ptr)) {
+ sgn = 1;
+ ptr++;
+ }
+
+ ptr = zip_skip_white_spaces(ptr);
+ if ('$' == *ptr)
+ ptr = zip_skip_white_spaces(ptr+1);
+ if ((sgn==0)&&('-' == *ptr)) {
+ sgn = 1;
+ ptr++;
+ }
+
+ if ((*ptr)&&(isdigit(*ptr))) {
+ char *end = (char *)ptr;
+
+ // printf("Parsing #: %s\n", ptr);
+ // While the following might make the most sense,
+ // the string is read-only, so we can't change it.
+ // if (sgn) *--ptr = '-';
+ unsigned long v = (sgn)?
+ -strtoul(ptr, &end, 0) : strtoul(ptr, &end, 0);
+ insn->i_imm += v;
+ ptr = (const char *)end;
+ }
+ }
+
+ if (*lbl) {
+ // printf("i_rp = %s\n", (insn->i_rp)?"(Null)":"not NULL");
+ symbolS *sym = symbol_find_or_make(lbl);
3085,7 → 3162,7
+ // symbol_set_value_expression(symbolP, expressionP);
+ // resolve_symbol_value(symbolP);
+ insn->i_rp =(ZIPRELOC *)xmalloc(sizeof(ZIPRELOC));
+ insn->i_rp->r_sym = symbol_find_or_make(lbl);
+ insn->i_rp->r_sym = sym;
+ insn->i_rp->r_pcrel = TRUE;
+ insn->i_rp->r_fr_offset = 0;
+ insn->i_rp->r_fix = NULL;
3126,13 → 3203,13
+ } else if((zip_param_got)&&(insn->i_breg == ZIP_GBL)) {
+ // New GOT-relative relocation
+ insn->i_rp =(ZIPRELOC *)xmalloc(sizeof(ZIPRELOC));
+ insn->i_rp->r_sym = symbol_find_or_make(lbl);
+ insn->i_rp->r_sym = sym;
+ insn->i_rp->r_pcrel = FALSE;
+ insn->i_rp->r_fr_offset = 0;
+ insn->i_rp->r_fix = NULL;
+ } else {
+ insn->i_rp =(ZIPRELOC *)xmalloc(sizeof(ZIPRELOC));
+ insn->i_rp->r_sym = symbol_find_or_make(lbl);
+ insn->i_rp->r_sym = sym;
+ insn->i_rp->r_pcrel = FALSE;
+ insn->i_rp->r_fr_offset = 0;
+ insn->i_rp->r_fix = NULL;
3656,8 → 3733,11
+ insn->i_breg = insn->i_areg;
+ break;
+ case ZIPO_JMP:
+ insn->i_op = ZIPO_MOV; // fall through
+ break;
+ if (insn->i_breg != ZIP_RNONE)
+ insn->i_op = ZIPO_MOV; // JMP A+Rx
+ else
+ insn->i_op = ZIPO_BRA; // JMP lbl = BRA lbl
+ // Fall through
+ case ZIPO_BRA: // Leave as ZIPO_BRA until we assemble it
+ insn->i_areg = ZIP_PC;
+ break;
4013,11 → 4093,12
+ );
+ */
+ sym_known = (sym_defined)&&(insn->i_rp->r_pcrel)&&(this_segment);
+ if ((sym_defined)&&(S_GET_SEGMENT(sym)==absolute_section)
+ &&(!S_FORCE_RELOC(sym, 0)))
+ sym_known = 1;
+ if ((sym_defined)&&(this_segment)&&(!S_FORCE_RELOC(sym, 0)))
+ sym_known = 1;
+ if ((!sym_known)&&(sym_defined)&&(!S_FORCE_RELOC(sym, 0))) {
+ if (this_segment)
+ sym_known = 1;
+ else if (S_GET_SEGMENT(sym)==absolute_section)
+ sym_known = 1;
+ }
+#ifdef ZIP_DEBUG
+ if (sym_known)
+ printf("%08lx@%08lx/%08lx - SYM(%s)-KNOWN %s%s%s%s%s\n",
4025,7 → 4106,7
+ (unsigned long)symv, S_GET_NAME(sym),
+ (S_GET_SEGMENT(sym) == absolute_section)?" abs":"",
+ (S_GET_SEGMENT(sym) == expr_section)?" expr":"",
+ (this_frag)?" this-frag ":"",
+ (symbol_get_frag(sym)==fragP)?" this-frag ":"",
+ ((this_segment)&&(fragP->fr_address != 0))?" this-seg ":"",
+ insn->i_rp->r_pcrel?" (PC-REL)":" (ABS)");
+ else if (insn->i_rp)
4035,14 → 4116,15
+ (!sym_defined)?"-- not defined":"",
+ (S_GET_SEGMENT(sym) == absolute_section)?" abs":"",
+ (S_GET_SEGMENT(sym) == expr_section)?" expr":"",
+ (this_frag)?" this-frag ":"",
+ (symbol_get_frag(sym)==fragP)?" this-frag ":"",
+ (this_segment)?" this-seg ":"",
+ ((this_segment)&&(fragP->fr_address != 0))?" this-off ":""
+ );
+
+ printf("SYM-DEF %d,%d,%d,%d, IMM = %08x\n",
+ sym_defined, sym_known, this_frag, this_segment,
+ insn->i_imm);
+ sym_defined, sym_known,
+ (insn->i_rp)&&(symbol_get_frag(insn->i_rp->r_sym)==fragP)?1:0,
+ this_segment, insn->i_imm);
+#endif
+ unsigned immv = insn->i_imm;
+ switch(insn->i_op) {
4057,15 → 4139,8
+ stretch);
+ // Tested--this works
+ return;
+ } else // Otherwise while we might know the symbol, we don't
+ // know where the segment containing it is set. That
+ // is, sym_known means we know the offset of the
+ // symbol within its segment, not that we know its
+ // absolute address (yet). Since we don't know the
+ // absolute address, set it to be an unknown symbol.
+ sym_known = 0;
+ }
+
+
+ insn->i_aux[0] = 0x7e000000; // NOOP -- if never used.
+ if (insn->i_rp)
+ immv += symv;
5166,7 → 5241,7
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/xtensa-relax.Tpo $(DEPDIR)/xtensa-relax.Po
diff -Naur '--exclude=*.swp' binutils-2.25-original/gas/read.c binutils-2.25/gas/read.c
--- binutils-2.25-original/gas/read.c 2014-10-14 03:32:03.000000000 -0400
+++ binutils-2.25/gas/read.c 2016-03-27 22:09:08.890860654 -0400
+++ binutils-2.25/gas/read.c 2016-05-06 10:32:11.758653388 -0400
@@ -684,7 +684,8 @@
/* We do this every time rather than just in s_bundle_align_mode
so that we catch any affected section without needing hooks all
6438,8 → 6513,8
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
diff -Naur '--exclude=*.swp' binutils-2.25-original/opcodes/zip-dis.c binutils-2.25/opcodes/zip-dis.c
--- binutils-2.25-original/opcodes/zip-dis.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.25/opcodes/zip-dis.c 2016-04-20 19:51:51.082018704 -0400
@@ -0,0 +1,291 @@
+++ binutils-2.25/opcodes/zip-dis.c 2016-04-28 13:23:40.816085799 -0400
@@ -0,0 +1,331 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: zip-dis.c
6489,6 → 6564,7
+
+static inline int
+TWOWORD_LOAD(uint32_t one, uint32_t two) {
+ // BREV followed by LODILO
+ if (((one&0x87c40000)==0x03000000)&&((two&0x87c40000)==0x02400000)
+ &&(((one^two)&0xf8380000)==0))
+ return 1;
6495,11 → 6571,41
+#ifdef LONG_MPY
+ return 0;
+#else
+ // LODIHI followed by LODILO
+ return (((one&0x87c40000)==0x02000000)&&((two&0x87c40000)==0x02400000)
+ &&(((one^two)&0xf8380000)==0))?1:0;
+#endif
+}
+
+static inline int
+TWOWORD_LJMP(uint32_t iword) {
+ // LJMP a long jump instruction, for which the address of the target
+ // is found in the next word
+ if (iword==0x7c87c000)
+ return 1;
+ // Unconditional LJMP in the second half word
+ if ((iword&0x80203fff)==0x80003e5f)
+ return 1;
+ return 0;
+}
+
+static inline int
+POSSIBLE_TWOWORD_BEGINNING(uint32_t iword) {
+ // Unconditional LJMP
+ if (TWOWORD_LJMP(iword))
+ return 1;
+ // The conditional LJMP is three words, which we don't handle ...
+ // Any BREV command could be the beginning of a twoword instruction
+ //
+ // Of course, the point here is to determine whether we should (or need
+ // to) read a second word from our read-memory function. Reading a
+ // second word, given that the first is a BREV, isn't a problem since a
+ // program can't end on/with a BREV instruction.
+ if ((iword&0x87c40000)==0x03000000)
+ return 1;
+ return 0;
+}
+
+static uint32_t
+zip_bitreverse(uint32_t v) {
+ uint32_t r=0, b;
6599,12 → 6705,12
+ if (listp[i].s_i != ZIP_OPUNUSED) {
+ int imv = 0;
+ imv = zip_getbits(ins, listp[i].s_i);
+ if ((imv != 0)&&(listp[i].s_rb != ZIP_OPUNUSED))
+ if (listp[i].s_rb == ZIP_OPUNUSED)
+ sprintf(&line[strlen(line)],
+ "$%d", imv);
+ "($%d)", imv);
+ else if (imv != 0)
+ sprintf(&line[strlen(line)],
+ "($%d)", imv);
+ "$%d", imv);
+ } if (listp[i].s_rb != ZIP_OPUNUSED) {
+ int rb = zip_getbits(ins, listp[i].s_rb);
+ sprintf(&line[strlen(line)],
6691,9 → 6797,18
+ unsigned char ibytes[8];
+ uint32_t refaddr;
+
+ (*info->read_memory_func)(vma, ibytes, 8, info);
+ // Always read the first word
+ (*info->read_memory_func)(vma, ibytes, 4, info);
+ iword = (ibytes[0]<<24)|(ibytes[1]<<16)|(ibytes[2]<<8)|(ibytes[3]);
+ nxtword= (ibytes[4]<<24)|(ibytes[5]<<16)|(ibytes[6]<<8)|(ibytes[7]);
+ // Only if we know we have a second do we read the second
+ if ((POSSIBLE_TWOWORD_BEGINNING(iword))
+ // We also test for reading past the end of the buffer
+ &&((*info->read_memory_func)(vma, ibytes, 8, info) ==0)) {
+ nxtword= (ibytes[4]<<24)|(ibytes[5]<<16)|(ibytes[6]<<8)|(ibytes[7]);
+ } else {
+ const int NOOP_CODE = 0x76000000;
+ nxtword = NOOP_CODE;
+ }
+ zipi_to_double_string(vma, iword, nxtword, astr, bstr, &refaddr);
+
+ if (bstr[0])
6782,8 → 6897,8
+#endif
diff -Naur '--exclude=*.swp' binutils-2.25-original/opcodes/zip-opc.c binutils-2.25/opcodes/zip-opc.c
--- binutils-2.25-original/opcodes/zip-opc.c 1969-12-31 19:00:00.000000000 -0500
+++ binutils-2.25/opcodes/zip-opc.c 2016-04-19 09:12:35.702319550 -0400
@@ -0,0 +1,550 @@
+++ binutils-2.25/opcodes/zip-opc.c 2016-05-02 14:15:12.743655341 -0400
@@ -0,0 +1,552 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Filename: zip-opc.c
6821,6 → 6936,8
+////////////////////////////////////////////////////////////////////////////////
+#include "zip-opc.h"
+
+#define LONG_MPY
+
+const char *zip_regstr[49] = {
+ "R0", "R1", "R2", "R3",
+ "R4", "R5", "R6", "R7",

powered by: WebSVN 2.1.0

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