Commit graph

19 commits

Author SHA1 Message Date
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
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 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 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 8afda7422e Fix NOP 1991-06-26 17:33:16 +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 d25472bbfb many fixes; now passes the tests 1989-10-10 10:44:26 +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