Commit graph

84 commits

Author SHA1 Message Date
George Koehler
36f16b0cb8 Cut down some clang warnings
Edit C code to reduce warnings from clang.  Most warnings are for
implicit declarations of functions, but some warnings want me to add
parentheses or curly braces, or to cast arguments for printf().

Make a few other changes, like declaring float_cst() in h/con_float to
be static, and using C99 bool in ego/ra/makeitems.c and
ego/share/makecldef.c.  Such changes don't silence warnings; I make
such changes while I silence warnings in the same file.  In
float_cst(), rename parameter `str` to `float_str`, so it doesn't
share a name with the global variable `str`.

Remove `const` from `newmodule(const char *)` in mach/proto/as to
silence a warning.  I wrongly added the `const` in d347207.

For warnings about implicit declarations of functions, the fix is to
declare the function before calling it.  For example, my OpenBSD
system needs <sys/wait.h> to declare wait().

In util/int, add "whatever.h" to declare more functions.  Remove old
declarations from "mem.h", to prefer the newer declarations of the
same functions in "data.h" and "stack.h".
2019-10-30 18:36:38 -04:00
George Koehler
0b0c3d5b60 Add csa 8, csb 8 for i386, m68020.
This allows `long long x; switch (x) {...}` in C.  Add test in C.

This adapts the code for csa 8 and csb 8 from the existing code for
csa 4 and csb 4, for both i386 and m68020.
2019-09-27 12:15:10 -04:00
George Koehler
e867861f6d Add 8-byte long long for linux68k.
Add rules for 8-byte integers to m68020 ncg.  Add 8-byte long long to
ACK C on linux68k.  Enable long-long tests for linux68k.  The tests
pass in our emulator using musahi; I don't have a real 68k processor
and haven't tried other emulators.

Still missing are conversions between 8-byte integers and any size of
floats.  The long-long tests don't cover these conversions, and our
emulator can't do floating-point.

Our build always enables TBL68020 and uses word size 4.  Without
TBL68020, 8-byte multiply and divide are missing.  With word size 2,
some conversions between 2-byte and 8-byte integers are missing.

Fix .cii in libem, which didn't work when converting from 1-byte or
2-byte integers.  Now .cii and .cuu work, but also add some rules to
skip .cii and .cuu when converting 8-byte integers.  The new rule for
loc 4 loc 8 cii `with test_set4` exposes a bug: the table may believe
that the condition codes test a 4-byte register when they only test a
word or byte, and this incorrect test may describe an unsigned word or
byte as negative.  Another rule `with exact test_set1+test_set2` works
around the bug by ignoring the negative flag, because a zero-extended
word or byte is never negative.

The old rules for comparison and logic do work with 8-byte integers
and bitsets, but add some specific 8-byte rules to skip libem calls or
loops.  There were no rules for 8-byte arithmetic, shift, or rotate;
so add some.  There is a register shortage, because the table requires
preserving d3 to d7, leaving only 3 data registers (d0, d1, d2) for
8-byte operations.  Because of the shortage, the code may move data to
an address register, or read a memory location more than once.

The multiplication and division code are translations of the i386
code.  They pass the tests, but might not give the best performance on
a real 68k processor.
2019-09-24 13:32:17 -04:00
David Given
38fa6941d5 linux68k builds now. 2016-08-14 11:34:18 +02:00
David Given
c93cb69959 Check in incomplete Linux PowerPC and M68K work.
--HG--
branch : dtrg-experimental-powerpc
2013-05-08 00:48:48 +01:00
ceriel
384c4bc698 Fixed bug with 4-byte sets on 2-byte machines 1998-09-03 12:51:38 +00:00
ceriel
1db6a3029b Header --> Id 1994-06-24 14:02:31 +00:00
ceriel
17efc329f8 Separated the m68020 syntax from the table, so that we can also create
a m68000 code generator producing m68020 syntax
1992-11-16 17:24:25 +00:00
ceriel
d18493b0ac Some minor modifications reflecting some changes in the peephole optimizer 1992-09-01 10:19:21 +00:00
ceriel
53c4951b29 Do not use '#endif/#else xxx'; it is not allowed for ANSI C 1991-12-17 15:05:43 +00:00
ceriel
564cbc6eba Only call NOP routine when debugging table 1991-09-04 10:55:52 +00:00
ceriel
bbb4d40669 Include whichone.h with <> so that the -I options decide which one is included 1991-08-28 14:13:14 +00:00
ceriel
e4136ac8e5 There was no RCK 2 due to a preprocessor-directive error 1991-04-24 14:09:20 +00:00
ceriel
2fef7f7389 Added LOS 4 and STS 4 1991-04-19 12:02:52 +00:00
ceriel
8b67c1f800 Fix to fix 1991-03-25 13:16:02 +00:00
ceriel
043ad764b8 Yet another fix: this time for AND/IOR/XOR/COM ? 1991-03-25 11:39:27 +00:00
ceriel
6f4da1d70a bug fix for SET instruction on m68k2 1991-03-22 18:23:55 +00:00
eck
530e1a3b6d fixed error for m68k2 1990-12-13 08:31:44 +00:00
eck
cb6ca0cf40 fixed nasty bug with sets that were used in kill-parts 1990-12-12 17:17:04 +00:00
ceriel
d9be4de96a Fixed RMU 4 1990-12-07 11:25:45 +00:00
ceriel
fb143bcdb5 Some corrections and simplifications 1990-11-16 16:31:40 +00:00
eck
cc04440b5c added patterns 1990-11-13 10:03:55 +00:00
eck
05ddeafbfd fixed labeldefs so that registers are killed
replaced 'cms <w>' bij 'cmi <w>'
1990-10-29 17:05:35 +00:00
eck
54cc752a9e fixed bugs with ext_[wl] arguments, changed reusage of registers 1990-10-26 16:52:43 +00:00
eck
bd4bc1cad0 replaced some move's by move_i's 1990-09-14 14:30:07 +00:00
eck
ee652e6908 changed stacheight to topeltsize 1990-09-04 17:13:37 +00:00
eck
bee5d97eac fixed some bugs in new pattern 1990-08-28 15:01:17 +00:00
eck
dc500c3463 fixed some strange constructions 1990-08-24 16:20:57 +00:00
eck
0bf7d60080 several improvements + fixes 1990-08-22 16:26:21 +00:00
eck
b4a2b975a0 added m68k2 stuff, added patterns 1990-08-20 13:55:38 +00:00
ceriel
56858bb480 bug fix: wrong procedure was called 1990-06-27 09:29:55 +00:00
ceriel
74147d2b4a ignore NOP 1990-05-17 19:40:15 +00:00
ceriel
f95fae24fc moved a coercion 1990-04-23 13:38:19 +00:00
ceriel
3553a28b78 fix: still sometimes assumed that a move to address register sets condition codes 1990-03-26 14:47:26 +00:00
ceriel
9d4e978a1e fixed problems with overflow bit in condition codes 1990-02-27 16:21:47 +00:00
ceriel
9c03f2c8bd kill tokens using address registers better 1989-11-01 10:14:27 +00:00
ceriel
68a2852f57 fixed bug and changed con_float 1989-10-25 13:24:29 +00:00
ceriel
eb2a76270f corrected XOR problem, and ILOCAL does not exist for m68k4 1989-10-06 11:13:16 +00:00
ceriel
77259cd2f9 removed yet another eor.l error 1989-09-29 11:45:19 +00:00
ceriel
92bccdd4fa inline FEF code for M68881 was wrong; replaced bu subroutine call 1989-08-10 14:17:50 +00:00
ceriel
6f9afbf0d5 use IEEE format in floating point package 1989-07-25 15:50:29 +00:00
ceriel
811612634a replaced some db.. instructions; they are wrong if the count register
contains a count > 65535
1989-07-07 16:01:03 +00:00
ceriel
56e985729d some added patterns for M688881, and a fix 1989-06-15 10:35:42 +00:00
ceriel
e8aadf4409 some optimizations for M68881; it is still horrible, though 1989-06-12 14:05:25 +00:00
ceriel
43fb961091 Added simple support for M68881 1989-06-12 09:30:39 +00:00
ceriel
b7c7d50513 fixed typo 1989-05-11 10:43:37 +00:00
ceriel
50114318e2 fixed typo 1989-04-06 14:18:17 +00:00
ceriel
c847bfb6c8 improved ASP patterns 1989-04-03 16:16:10 +00:00
ceriel
c1fc03b7e2 fixed typo's 1989-03-16 11:20:47 +00:00
ceriel
fb0051c85a fixed: pattern for ADI STL and the like was wrong 1989-03-14 14:05:10 +00:00