Merge pull request #25 from davidgiven/dtrg-inn

Fix endianess issue with inn.
This commit is contained in:
David Given 2016-12-06 22:24:31 +01:00 committed by GitHub
commit 97acc7bcad
7 changed files with 47 additions and 27 deletions

View file

@ -18,7 +18,7 @@ vars.plats = {
vars.plats_with_tests = {
"linux386",
"linuxppc",
"qemuppc",
-- "qemuppc", FIXME: disable until we figure out why qemu won't run binaries bigger than 4kB
"pc86",
}

View file

@ -13,10 +13,10 @@
lwz r4, 4(sp) /* r4 = bit number */
addi r5, sp, 8 /* r5 = base address of bit set */
srawi r6, r4, 3 /* r6 = byte address into set */
andi. r7, r4, 7 /* r7 = bit within byte */
rlwinm r6, r4, 29, 3, 29 /* r6 = byte index of word in set */
andi. r7, r4, 31 /* r7 = bit within word */
lbzx r8, r5, r6 /* r8 = individual byte from set */
lwzx r8, r5, r6 /* r8 = individual byte from set */
sraw r8, r8, r7
rlwinm r8, r8, 0, 31, 31

View file

@ -0,0 +1,26 @@
MODULE test;
FROM InOut IMPORT WriteLn, WriteString;
TYPE charset = SET OF CHAR;
PROCEDURE Space(c: CHAR): BOOLEAN;
BEGIN
RETURN c IN charset{' ', 11C, 12C, 15C}
END Space;
BEGIN
IF Space('a') THEN
WriteString("@@FAIL 1");
WriteLn;
END;
IF NOT Space(' ') THEN
WriteString("@@FAIL 2");
WriteLn;
END;
IF NOT Space(12C) THEN
WriteString("@@FAIL 3");
WriteLn;
END;
WriteString("@@FINISHED");
WriteLn;
END test.

View file

@ -11,7 +11,8 @@ definerule("plat_testsuite",
local testfiles = filenamesof(
"tests/plat/*.c",
"tests/plat/*.e",
"tests/plat/*.p"
"tests/plat/*.p",
"tests/plat/bugs/*.mod"
)
acklibrary {
@ -23,8 +24,8 @@ definerule("plat_testsuite",
local tests = {}
for _, f in ipairs(testfiles) do
local fs = replace(basename(f), "%..$", "")
local _, _, lang = fs:find("_(.)$")
local fs = replace(basename(f), "%.[^.]+$", "")
local _, _, lang = fs:find("_([^_]+)$")
if not lang then
lang = "e"
end
@ -49,7 +50,7 @@ definerule("plat_testsuite",
"util/build+testrunner"
},
commands = {
"(%{ins[2]} "..e.method.." %{ins[1]} 5 %{ins[3]} || echo FAILED) 2>&1 > %{outs}",
"(%{ins[2]} "..e.method.." %{ins[1]} 5 %{ins[3]} || echo FAILED) > %{outs}",
}
}
end

View file

@ -7,10 +7,10 @@
/* Test non-existent bit */
.1
rom 0I1, 0I1, 0I1, 0I1
rom 0I4
loe .1
loc 1 /* bit number */
inn EM_WSIZE
inn 4
zeq *1
loc __LINE__
@ -21,9 +21,12 @@
/* Test existent bit */
.2
rom 2I1, 0I1, 0I1, 0I1
rom 16384
.21
rom 14 /* to defeat constant folding */
loe .2
loc 1 /* bit number */
loe .21 /* bit number */
inn EM_WSIZE
zne *2
@ -35,10 +38,9 @@
/* Test non-existent high bit */
.3
rom 0I1, 0I1, 0I1, 0I1
rom 0I1, 0I1, 0I1, 0I1
rom 0, 0
.31
rom (EM_WSIZE*8)+1 /* to defeat constant folding */
rom 8 /* to defeat constant folding */
lae .3
loi EM_WSIZE*2
@ -54,16 +56,7 @@
/* Test existent high bit */
.4
#if EM_WSIZE == 2
rom 0I1, 0I1
rom 2I1, 0I1
#elif EM_WSIZE == 4
rom 0I1, 0I1, 0I1, 0I1
rom 2I1, 0I1, 0I1, 0I1
#else
#error Unknown word size
#endif
rom 0, 2
.41
rom (EM_WSIZE*8)+1 /* to defeat constant folding */

View file

@ -27,7 +27,7 @@ get_test_output() {
qemu-system-ppc) img="-kernel $img" ;;
esac
$timeoutprog -t $timeout -- $method -nographic $img 2>&1 > $result
$timeoutprog -t $timeout -- $method -nographic $img > $result 2>&1
;;
qemu-*)
@ -37,7 +37,7 @@ get_test_output() {
exit 0
fi
$method $img 2>&1 > $result
$method $img > $result 2>&1
;;
*)