Commit graph

54 commits

Author SHA1 Message Date
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 bbaed6bdba Edit i386 rules for 8-byte shift, conversion.
Shifts that drop an EM word don't need to coerce the word to REG.
Some arithmetic right shifts can use _cdq_.

Drop rules for illegal integer conversions.  Sizes below a word are
illegal in EM, except as the source size of _cii_.
2019-09-25 12:29:41 -04:00
George Koehler f0a2c84d93 Tweak i386 rules for adi 8, sli 8, sru 8.
Add EXACT to the rule for adi 8, in the same way that the old rules
for and 8, ior 8, xor 8 have EXACT.

Add rules for sli 8 and sru 8 when shifting 32 bits, and add
assertions in llshift_e.c to test these rules.
2019-09-18 14:09:51 -04:00
George Koehler f6a1e08218 Test long long division and remainder; fix i386.
My i386 code from 893df4b gave the wrong sign to some 8-byte
remainders.  Fix by splitting .dvi8 and .rmi8 so each has its own code
to pick the sign.  They and .dvu8 and .rmu8 share a private sub
.divrem8 for unsigned division.

Improve the i386 code by using instructions like _bsr_ and _shrd_.
Change the helpers to yield a quotient in ebx:eax or a remainder in
ecx:edx; this seems more convenient, because _div_ puts its quotient
in eax and remainder in edx.
2019-09-16 20:19:36 -04:00
George Koehler 04427e65dc Add and test rol 8, ror 8 for linux386.
These tests are in core/rotate_e.e with the other rotation tests, and
only run on platforms where _EM_LLSIZE == 8.
2019-09-12 19:47:51 -04:00
George Koehler fb9f5387b5 Add long long comparisons, shifts for linux386.
Add tests for comparisons and shifts.  Also add enough integer
conversions to compile the shift test (llshift_e.c), and disable
some wrong rules for ldc and conversions.
2019-09-07 16:20:33 -04:00
George Koehler 893df4b79b Experiment with 8-byte integers in ncg i386.
This provides adi, sbi, mli, dvi, rmi, ngi, dvu, rmu 8, but is missing
shifts and rotates.  It is also missing conversions between 8-byte
integers and other sizes of integers or floats.  The code might not be
all correct, but works at least some of the time.

I adapted this from how ncg i86 does 4-byte integers, but I use a
different algorithm when dividing by a large value: i86 avoids the div
instruction and uses a shift-and-subtract loop; but I use the div
instruction to estimate a quotient, which is more like how big integer
libraries do division.  My .dvi8 and .dvu8 also set ecx:ebx to the
remainder; this might be a bad idea, because it requires .dvi8 and
.dvu8 to always calculate the remainder, even when the caller only
wants the quotient.

To play with 8-byte integers, I wrote EM procedures like

     mes 2, 4, 4
     exp $ngi
     pro $ngi,0
     ldl 4
     ngi 8
     lol 0
     sti 8
     lol 0
     ret 4
     end
     exp $adi
     pro $adi,0
     ldl 4
     ldl 12
     adi 8
     lol 0
     sti 8
     lol 0
     ret 4
     end

and called them from C like

    typedef struct { int l; int h; } q;
    q ngi(q);
    q adi(q, q);
2019-08-20 13:38:18 -04:00
George Koehler 1faff418ec Teach some ncg machines to use .data8
This turns EM `con 5000000000I8` into assembly `.data8 5000000000` for
machines i386, i80, i86, m68020, powerpc, vc4.  These are the only ncg
machines in our build.

i80 and i86 get con_mult(sz) for sz == 4 and sz == 8.  The other
machines only get sz == 8, because they have 4-byte words, and ncg
only calls con_mult(sz) when sz is greater than the word size.  The
tab "\t" after .data4 or .data8 is like the tabs in the con_*() macros
of mach/*/ncg/mach.h.

i86 now uses .data4, like i80.  Also, i86 and i386 now use the numeric
string without converting it to an integer and back to a string.
2019-08-13 15:37:05 -04:00
George Koehler 760da1f421 Fix build with gcc.
gcc gave an error because the `char *` parameter doesn't match the
`const char *` in the prototype of regsave().  clang didn't give an
error.  I added the prototype in commit 5301cce.
2017-11-17 17:52:37 -05:00
George Koehler 5301cceee3 Declare machine-dependent functions in mach/proto/ncg
This breaks all machines because the declared return type void
disagrees with the implicit return type int (when I compile mach.c
with clang).  Unbreak i386, i80, i86, m68020, powerpc, vc4 by adding
the return types to mach.c.  We don't build any other machines; they
are broken since commit a46ee91 (May 19, 2013) declared void prolog()
and commit fd91851 (Nov 10, 2016) declared void mes(), with both
declarations in mach/proto/ncg/fillem.c.

Also fix mach/vc4/ncg/mach.c where type full is long, so fprintf()
must use "%ld" not "%d" to print full nlocals.
2017-11-13 14:23:44 -05:00
David Given 73922f1d16 Ensure that procedure labels are word-aligned. 2017-01-06 22:29:52 +01:00
David Given fd91851005 Add enough return types to the K&R C that the ACK builds (on Linux) using clang
now.
2016-11-10 22:04:18 +01:00
David Given f67c98e239 Distributions are a pain --- let's not bother any more. Instead, we just tag
the repository and download a complete snapshot, old and ancient stuff and all.
2016-09-02 23:00:38 +02:00
George Koehler 0131ca4d46 Delete 689 undead files.
These files "magically reappeared" after the conversion from CVS to
Mercurial.  The old CVS repository deleted these files but did not
record *when* it deleted these files.  The conversion resurrected these
files because they have no history of deletion.  These files were
probably deleted before year 1995.  The CVS repository begins to record
deletions around 1995.

These files may still appear in older revisions of this Mercurial
repository, when they should already be deleted.  There is no way to fix
this, because the CVS repository provides no dates of deletion.

See http://sourceforge.net/mailarchive/message.php?msg_id=29823032
2012-09-20 22:26:32 -04:00
ceriel 71da2cdda9 Fixed some bugs with the setxx instructions 1995-09-12 12:09:08 +00:00
ceriel 34b3d1fb52 Fix: produced jgt instead of jg 1995-07-25 13:21:53 +00:00
ceriel 5e03b1bebb Fixes: some conditionals were evaluated wrong due to the overflow bit 1995-07-21 12:05:26 +00:00
ceriel 404d86d544 Added -F option to indicate name of floating point hook 1995-03-17 12:37:06 +00:00
ceriel 65353b1417 Fix: description of setxx should write arg 1995-02-24 11:53:43 +00:00
ceriel 1db6a3029b Header --> Id 1994-06-24 14:02:31 +00:00
ceriel 5fbaff533c Use test instruction for testing 1992-12-17 12:58:05 +00:00
ceriel bc2744ca5c Several fixes: SDF was wrong, and shifts do NOT set contition codes properly 1992-12-14 16:37:35 +00:00
ceriel 248ca45fc0 Use 80386 SET instruction 1992-09-17 14:15:20 +00:00
ceriel d18493b0ac Some minor modifications reflecting some changes in the peephole optimizer 1992-09-01 10:19:21 +00:00
ceriel 46f084d660 Fix: sometimes did not reserve space for local on a mes ms_gto 1992-06-12 09:46:43 +00:00
ceriel b2cca56e16 Accept -gdb option 1992-03-27 17:36:49 +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 be802650ca Added labeldef stuff 1991-11-18 09:51:35 +00:00
ceriel 7c167d29d2 Added some patterns 1991-10-14 13:04:29 +00:00
ceriel 564cbc6eba Only call NOP routine when debugging table 1991-09-04 10:55:52 +00:00
ceriel c7edcc34d6 New installation mechanism 1991-08-27 10:47:25 +00:00
ceriel 8afda7422e Fix NOP 1991-06-26 17:33:16 +00:00
ceriel c9ece34fc5 Changed method of allocating locals 1991-02-20 09:54:55 +00:00
ceriel 0d65b92220 removed -i flag 1991-02-19 16:57:39 +00:00
ceriel 2873c58731 Added debugger support 1990-11-01 09:42:03 +00:00
eck 4ef2c70ed3 added stackheight message handling 1990-07-18 14:53:19 +00:00
ceriel 736108572f produce commons, fix bug with mov-extend instructions 1990-06-25 15:48:49 +00:00
ceriel 2465ad8ed8 fixed bug: sometimes destroyed contents of register variable 1989-11-28 14:42:56 +00:00
ceriel 8740dcc72e adapted to use 80387 floating point format 1989-10-24 15:00:09 +00:00
eck 78d3e500fb added CPP variable to Makefile 1989-10-20 11:05:00 +00:00
ceriel d25472bbfb many fixes; now passes the tests 1989-10-10 10:44:26 +00:00
ceriel c820d77690 new floating point constant mechanism 1989-07-10 16:52:02 +00:00
ceriel 3c8a8f0349 fixes: you cannot do stack-references in EM replacements! 1989-05-11 11:25:16 +00:00
ceriel 4da1930ff4 Initial revision 1989-02-15 16:39:58 +00:00
ceriel 01626b2c32 Initial revision 1989-02-14 15:52:25 +00:00
ceriel 2f7e414d42 corrected lint entry 1988-06-28 14:36:21 +00:00
ceriel 69843cf9ce Added -DNDEBUG to Makefile, table now kills regvars 1987-07-06 15:28:59 +00:00
ceriel d41028a664 pass EMHOME to nested make 1987-06-30 18:30:45 +00:00
ceriel 96d15a6c05 minor mod 1987-04-03 11:18:49 +00:00
ceriel 88db8b43da Added distr entry 1987-03-19 10:12:51 +00:00