Commit graph

67 commits

Author SHA1 Message Date
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 6f84bc1dcf Add more cases to lladdsub_e.c
Add cases with long long a, b in hexadecimal, where it is more obvious
whether or not a + b or a - b carries to or borrows from bit 32.  Add
failure codes to identify each case.
2019-09-18 12:46:11 -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 12457f6385 Add long long tests for bitset, convert, multiply. 2019-09-16 11:44:25 -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 eb0d5e1d6c Switch rotate_e.e from EM_WSIZE to _EM_WSIZE.
Also change EM_PSIZE to _EM_PSIZE.  I will add _EM_LLSIZE to this
test, then all 3 macros will have the leading underscore.
2019-09-12 12:26:14 -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 20a4d401d0 Add first long-long test for linux386.
Skip the long-long test set on other platforms, because they don't
have long long.  Each platform would need to implement 8-byte
operations like `adi 8` in its code generator, and set long long to
8 bytes in its descr file.

The first test is for negation, addition, and subtraction.  It also
requires comparison for equality.
2019-09-05 13:13:02 -04:00
David Given ec9b5f5fcd Disable rck test on i80, which doesn't support it. 2019-06-17 19:53:12 +02:00
David Given 2c8498cf87 I managed to break the test system... somehow. Fix. 2019-06-17 00:52:09 +02:00
David Given 402468f6fd Bugfix the CP/M FCB parser, and add a test for it. 2019-06-17 00:41:49 +02:00
David Given 88fd7b3cdc Add a 'kill' pseudoinstruction to the 8080 assembler, which marks when the code
generator is finished with a register; use this to create some more effective
peephole optimiser rules.
2019-03-08 23:06:34 +01:00
David Given 52aa22dc80 Fix typo. 2019-02-18 11:04:23 +01:00
David Given 6a8b298861 Fix typo where I was confusing sbi and sui, with hilarious results. 2019-02-16 01:18:21 +01:00
David Given cf6041c57f Add failing test case. 2019-02-14 23:19:11 +01:00
David Given 8200f041c2 Fix issue with logical operations and small signed constants which turned out
to affect multiple platforms.
2019-02-13 20:56:10 +01:00
David Given eb57db75a4 Update test case to provoke bug. 2019-02-13 20:10:38 +01:00
David Given f4b45f1ed7 Fix bad code generation due to not correctly flushing the stack before
comparisons.
2019-02-12 22:19:07 +01:00
David Given a2b5202081 Added a test case for #157. 2019-02-12 22:08:08 +01:00
David Given 1564e65c2d Add tests for simple comparisons (which i80 fails). 2019-02-10 23:39:15 +01:00
David Given 0de5001f82 Make sign extension much less horrible. 2019-02-08 23:16:57 +01:00
David Given 0ac145a0d1 Add tests for simple and, or, and xor; drastically improve the i80 code
generation for these.
2019-02-08 22:38:07 +01:00
David Given ec0891469f Array descriptor ranges are inclusive; adjust aar and the tests to check for
this. All the tests except rotate build now!
2018-09-17 19:34:38 +01:00
David Given f61500c51b Fix lar and sar, which were horribly, horribly broken. Add tests. 2018-09-17 18:44:17 +01:00
David Given abb7e3e105 Fix aar; add test. 2018-09-17 16:59:45 +01:00
David Given 1e073e944a Added cms, and a test for it. 2018-09-17 12:42:10 +01:00
David Given 15ae171aef Added a test for set. Fix mips set implementation. 2018-09-17 11:56:15 +01:00
David Given 7efb749003 Set fixes; also add discrete tests for and, ior, xor. 2018-09-14 14:13:35 +01:00
David Given ecb3395aba Converting floats and doubles to integers now works, as much as these ever do
on MIPS; turns out that it can't (or at least can't in qemu) reliably turn
INT_MIN from a double to an int.
2018-09-12 23:58:48 +02:00
David Given ce249649b2 Warning fix. 2018-06-17 15:34:29 +02:00
David Given 3892b7e0e6 Remove bogus conversion from test which was causing failure; you're not allowed
to do cui or ciu with sizes smaller than a word.
2018-06-12 21:04:27 +09:00
David Given 19cd42124f Rearrange the tests into sets; allow plats to skip sets; pc86 and linux68k now
skip the tests which use floating point instructions (as their emulators don't
support them).
2018-06-08 15:59:04 +09:00
David Given d70eb76dbb Modify the pc86 test harness to use 8086tiny instead of qemu. Sadly, some tests fail. 2018-06-03 15:13:43 +02:00
George Koehler b38fcdded3 Add tests for clearing BSS, copying C structs.
The new tests are bss_e.c, structcopy_e.c.  We do clear the BSS before
calling _m_a_i_n, so fix the comments in the other tests.
2018-01-27 20:09:16 -05:00
George Koehler d6938108a6 Add tests for C <setjmp.h> and Modula-2 Semaphores.
Fix PowerPC ncg so setjmp() returns the correct value.  I got unlucky
when ncg picked r3 for "uses REG"; this destroyed the return value in
r3 and caused the new test to fail.
2018-01-03 14:51:14 -05:00
George Koehler 26de4c1ab1 Add test for EM _rck_. Fix traps in PowerPC ncg.
The new test rck_e.e segfaults on PowerPC unless I make some changes.
The inline code for _rck_ was wrong because it didn't allow the trap
handler to return.  _sig_ forgot to push the old trap handler.

Move plat/linuxppc/libsys/trap.s to mach/powerpc/libem/trp.s and
rewrite it with simplified/extended mnemonics.  Remove .trap alias for
.trp procedure.  Add a missing `mtspr lr, r0` so we can return from
the trap handler.  Call write() and _exit() so trp.s works with both
linuxppc and osxppc.  Before, Mac OS X was wrongly using the trap.s
for Linux.

In powerpc/libem, simplify .aar4; teach .csa and .csb to raise the
trap if the default target is zero.

C programs don't need these changes.  You may relink your C programs
with the changed .csa and .csb, but C code doesn't raise the trap.
Modula-2 code can raise traps, so you may want to relink your Modula-2
programs with the changed libem, but you might keep your old .o files
from Modula-2.  You may need to recompile your Pascal programs (delete
old .o files from Pascal) because the Pascal compiler might use _rck_.
2017-12-24 22:37:52 -05:00
George Koehler 4bb31c296d Revise the comments in the EM tests.
You can cheat these tests if _cms_ and _cmu_ always push zero.
2017-12-21 18:24:28 -05:00
George Koehler 787fdeaaa9 Add some tests for Modula-2. 2017-12-21 18:24:17 -05:00
George Koehler aa9418c029 Pass 4 bytes to fail(uint32_t)
This would become necessary if something failed on a platform with
16-bit int (EM_WSIZE == 2).

Remove unreachable `ret 0`.  If reached, it wouldn't work to return
from _m_a_i_n.
2017-12-18 21:58:57 -05:00
George Koehler a5e8dc8a06 Simplify code by using cms EM_WSIZE to compare bytes.
This should work because the C compiler does it.
2017-12-18 21:52:13 -05:00
George Koehler a4e6595032 Remove '\0' from output. Fix a compiler warning.
Don't output '\0' in "@@FINISHED\0".

Cast code to unsigned int.  This helps platforms with 16-bit int, by
doing only the low 16 bits of the bitwise-and.  It also removes the
"(warning) conversion of long to pointer loses accuracy".
2017-12-18 21:17:42 -05:00
George Koehler 504d2aa34e Revise stack shuffles and integer conversions in PowerPC ncg.
Allow asp 4, exg 4 to shuffle tokens without coercing them into
registers; but comment why dup 4, dup 8 coerce tokens into registers.

Allow dup, dus, exg with larger sizes; and add tests dup_e.e and
exg_e.e to check that dup 20, dus, exg 20 work as well in powerpc as
in i80 and i86.

Then powerpc failed to compile loc 2 loc 4 cuu in dup_e.e.  Revise the
integer conversions, so powerpc can compile and pass the test.
2017-12-09 18:57:10 -05:00
George Koehler a1d1f38691 Add test for EM rol, ror. Fix i80, i86, powerpc.
EM instructions _rol_ and _ror_ do rotate an integer left or right.
Our compilers and optimizers never emit _rol_ nor _ror_, but I might
want to use them in the future.

Add _rol_ and _ror_ to powerpc.  Fix `rol 4` and `ror 4` in both i80
and i86, where the rules for `rol 4` and `ror 4` seem to have never
been tested until now.
2017-12-07 17:16:21 -05:00
George Koehler 50a160c07f Increase time-out from 5 to 15 seconds.
My computer is too slow, so qemuppc tests randomly timed out.  With
this commit, my machine passes the qemuppc tests (if I also edit the
top build.lua to enable qemuppc).
2017-11-08 15:02:56 -05:00
George Koehler 96e23b3a0f Show tests that @@TIMEDOUT.
A `set -e` in testdriver.sh caused it to exit early and hide the
output of a @@TIMEDOUT test, so I never saw the @@TIMEDOUT marker.
Then build.lua added a @@FAIL marker.
2017-11-08 14:08:43 -05:00
George Koehler 3d6ee435cf Fix pattern that was rewriting func(! var, var) as func(1).
Bug reported by Rune, see
 - https://sourceforge.net/p/tack/mailman/message/35809953/
 - https://github.com/davidgiven/ack/issues/62

In EM code, beq and bne pop 2 values and compare them, but teq and tne
pop only 1 value and compare it with zero.  We need cms to compare 2
values; other patterns may convert cmi or cmu to cms.
2017-10-29 14:53:33 -04:00
David Given 81c677d218 Add a bunch more set operations to the PowerPC backends, and the Pascal test
for the same.
2017-01-17 22:31:38 +01:00
David Given 5fd1634830 Rename the test to something more sensible. 2017-01-15 22:33:41 +01:00
David Given e7e29d34ff Add a test (currently failing) to check that Pascal char sets can store all 256
possible values. Add the PowerPC ncg and mcg backend support to let the test
actually run, including modifying a bunch of PowrePC libem functions so that
they can be called from both ncg and mcg.
2017-01-15 22:28:14 +01:00
David Given 837b9622fb Make sure that constant folding doesn't render our tests trivial. 2017-01-07 19:53:57 +01:00