diff options
-rw-r--r-- | src/arm.md | 6 | ||||
-rwxr-xr-x | tst/test-android.py | 8 | ||||
-rw-r--r-- | tst/testmod.c | 28 | ||||
-rw-r--r-- | tst/testmod.expected | 33 |
4 files changed, 54 insertions, 21 deletions
@@ -323,12 +323,12 @@ reg: MULF4(reg,reg) "\tfmls\t%c, %0, %1\n" 1 reg: MULF8(reg,reg) "\tmufd\t%c, %0, %1\n" 1 reg: DIVI4(reg,reg) "\tbl\t__aeabi_idiv\n" 2 -reg: DIVU4(reg,reg) "\tbl\t|x$udivide|\n" 2 +reg: DIVU4(reg,reg) "\tbl\t__aeabi_uidiv\n" 2 reg: DIVF4(reg,reg) "\tfdvs\t%c, %0, %1\n" 1 reg: DIVF8(reg,reg) "\tdvfd\t%c, %0, %1\n" 1 -reg: MODI4(reg,reg) "\tbl \t__aeabi_idivmod\n" 1 -reg: MODU4(reg,reg) "\tbl\t|x$uremainder|\n" 1 +reg: MODI4(reg,reg) "\tbl \t__aeabi_idivmod\n" 1 +reg: MODU4(reg,reg) "\tbl\t__aeabi_uidivmod\n" 1 stmt: LABELV "%a:\n" diff --git a/tst/test-android.py b/tst/test-android.py index 5444951..86ccc9b 100755 --- a/tst/test-android.py +++ b/tst/test-android.py @@ -90,11 +90,15 @@ def test(testFile): transferToAndroid(testFile) os.remove(testFile) output = run(testFile) - compareResult(testFile, output) + return compareResult(testFile, output) def doTests(): + failCount = 0 for testFile in testFiles: - test(testFile) + if not test(testFile): + failCount += 1 + print "Total tests: ", len(testFiles) + print "Total failures: ", failCount def checkForDevice(): if adbGetState() != "device": diff --git a/tst/testmod.c b/tst/testmod.c index 63480ed..865f25c 100644 --- a/tst/testmod.c +++ b/tst/testmod.c @@ -1,8 +1,28 @@ extern void printf(const char* s,...); +void testUnsigned(unsigned int a, unsigned int b) { + printf("%u / %% %u = %u, %u\n", a, b, a / b, a % b); +} + +void testSigned(int a, int b) { + printf("%d / %% %d = %d, %d\n", a, b, a / b, a % b); +} + void main(int argc, char** argv) { - int i; - for (i = 0; i < 12; i++) { - printf("%d / %d = %d, %d %% %d = %d\n", i, 3, i / 3, i, 3, i % 3); - } + { + int i; + printf("signed:\n"); + for (i = -6; i < 6; i++) { + testSigned(i, 3); + } + } + { + unsigned int u; + unsigned int big = ((unsigned int) 1) << ((unsigned int) 31); + printf("unsigned:\n"); + for (u = 0; u < 6; u++) { + testUnsigned(u, 3); + } + testUnsigned(big, 2); + } } diff --git a/tst/testmod.expected b/tst/testmod.expected index c56a30f..d77bccf 100644 --- a/tst/testmod.expected +++ b/tst/testmod.expected @@ -1,12 +1,21 @@ -0 / 3 = 0, 0 % 3 = 0 -1 / 3 = 0, 1 % 3 = 1 -2 / 3 = 0, 2 % 3 = 2 -3 / 3 = 1, 3 % 3 = 0 -4 / 3 = 1, 4 % 3 = 1 -5 / 3 = 1, 5 % 3 = 2 -6 / 3 = 2, 6 % 3 = 0 -7 / 3 = 2, 7 % 3 = 1 -8 / 3 = 2, 8 % 3 = 2 -9 / 3 = 3, 9 % 3 = 0 -10 / 3 = 3, 10 % 3 = 1 -11 / 3 = 3, 11 % 3 = 2 +signed: +-6 / % 3 = -2, 0 +-5 / % 3 = -1, -2 +-4 / % 3 = -1, -1 +-3 / % 3 = -1, 0 +-2 / % 3 = 0, -2 +-1 / % 3 = 0, -1 +0 / % 3 = 0, 0 +1 / % 3 = 0, 1 +2 / % 3 = 0, 2 +3 / % 3 = 1, 0 +4 / % 3 = 1, 1 +5 / % 3 = 1, 2 +unsigned: +0 / % 3 = 0, 0 +1 / % 3 = 0, 1 +2 / % 3 = 0, 2 +3 / % 3 = 1, 0 +4 / % 3 = 1, 1 +5 / % 3 = 1, 2 +2147483648 / % 2 = 1073741824, 0 |