Merge pull request #25 from davidgiven/dtrg-inn
Fix endianess issue with inn.
This commit is contained in:
commit
97acc7bcad
7 changed files with 47 additions and 27 deletions
|
@ -18,7 +18,7 @@ vars.plats = {
|
||||||
vars.plats_with_tests = {
|
vars.plats_with_tests = {
|
||||||
"linux386",
|
"linux386",
|
||||||
"linuxppc",
|
"linuxppc",
|
||||||
"qemuppc",
|
-- "qemuppc", FIXME: disable until we figure out why qemu won't run binaries bigger than 4kB
|
||||||
"pc86",
|
"pc86",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
lwz r4, 4(sp) /* r4 = bit number */
|
lwz r4, 4(sp) /* r4 = bit number */
|
||||||
addi r5, sp, 8 /* r5 = base address of bit set */
|
addi r5, sp, 8 /* r5 = base address of bit set */
|
||||||
|
|
||||||
srawi r6, r4, 3 /* r6 = byte address into set */
|
rlwinm r6, r4, 29, 3, 29 /* r6 = byte index of word in set */
|
||||||
andi. r7, r4, 7 /* r7 = bit within byte */
|
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
|
sraw r8, r8, r7
|
||||||
rlwinm r8, r8, 0, 31, 31
|
rlwinm r8, r8, 0, 31, 31
|
||||||
|
|
||||||
|
|
26
tests/plat/bugs/bug-22-inn_mod.mod
Normal file
26
tests/plat/bugs/bug-22-inn_mod.mod
Normal 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.
|
|
@ -11,7 +11,8 @@ definerule("plat_testsuite",
|
||||||
local testfiles = filenamesof(
|
local testfiles = filenamesof(
|
||||||
"tests/plat/*.c",
|
"tests/plat/*.c",
|
||||||
"tests/plat/*.e",
|
"tests/plat/*.e",
|
||||||
"tests/plat/*.p"
|
"tests/plat/*.p",
|
||||||
|
"tests/plat/bugs/*.mod"
|
||||||
)
|
)
|
||||||
|
|
||||||
acklibrary {
|
acklibrary {
|
||||||
|
@ -23,8 +24,8 @@ definerule("plat_testsuite",
|
||||||
|
|
||||||
local tests = {}
|
local tests = {}
|
||||||
for _, f in ipairs(testfiles) do
|
for _, f in ipairs(testfiles) do
|
||||||
local fs = replace(basename(f), "%..$", "")
|
local fs = replace(basename(f), "%.[^.]+$", "")
|
||||||
local _, _, lang = fs:find("_(.)$")
|
local _, _, lang = fs:find("_([^_]+)$")
|
||||||
if not lang then
|
if not lang then
|
||||||
lang = "e"
|
lang = "e"
|
||||||
end
|
end
|
||||||
|
@ -49,7 +50,7 @@ definerule("plat_testsuite",
|
||||||
"util/build+testrunner"
|
"util/build+testrunner"
|
||||||
},
|
},
|
||||||
commands = {
|
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
|
end
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
/* Test non-existent bit */
|
/* Test non-existent bit */
|
||||||
|
|
||||||
.1
|
.1
|
||||||
rom 0I1, 0I1, 0I1, 0I1
|
rom 0I4
|
||||||
loe .1
|
loe .1
|
||||||
loc 1 /* bit number */
|
loc 1 /* bit number */
|
||||||
inn EM_WSIZE
|
inn 4
|
||||||
zeq *1
|
zeq *1
|
||||||
|
|
||||||
loc __LINE__
|
loc __LINE__
|
||||||
|
@ -21,9 +21,12 @@
|
||||||
/* Test existent bit */
|
/* Test existent bit */
|
||||||
|
|
||||||
.2
|
.2
|
||||||
rom 2I1, 0I1, 0I1, 0I1
|
rom 16384
|
||||||
|
.21
|
||||||
|
rom 14 /* to defeat constant folding */
|
||||||
|
|
||||||
loe .2
|
loe .2
|
||||||
loc 1 /* bit number */
|
loe .21 /* bit number */
|
||||||
inn EM_WSIZE
|
inn EM_WSIZE
|
||||||
zne *2
|
zne *2
|
||||||
|
|
||||||
|
@ -35,10 +38,9 @@
|
||||||
/* Test non-existent high bit */
|
/* Test non-existent high bit */
|
||||||
|
|
||||||
.3
|
.3
|
||||||
rom 0I1, 0I1, 0I1, 0I1
|
rom 0, 0
|
||||||
rom 0I1, 0I1, 0I1, 0I1
|
|
||||||
.31
|
.31
|
||||||
rom (EM_WSIZE*8)+1 /* to defeat constant folding */
|
rom 8 /* to defeat constant folding */
|
||||||
|
|
||||||
lae .3
|
lae .3
|
||||||
loi EM_WSIZE*2
|
loi EM_WSIZE*2
|
||||||
|
@ -54,16 +56,7 @@
|
||||||
/* Test existent high bit */
|
/* Test existent high bit */
|
||||||
|
|
||||||
.4
|
.4
|
||||||
#if EM_WSIZE == 2
|
rom 0, 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
|
|
||||||
|
|
||||||
.41
|
.41
|
||||||
rom (EM_WSIZE*8)+1 /* to defeat constant folding */
|
rom (EM_WSIZE*8)+1 /* to defeat constant folding */
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ get_test_output() {
|
||||||
qemu-system-ppc) img="-kernel $img" ;;
|
qemu-system-ppc) img="-kernel $img" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
$timeoutprog -t $timeout -- $method -nographic $img 2>&1 > $result
|
$timeoutprog -t $timeout -- $method -nographic $img > $result 2>&1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
qemu-*)
|
qemu-*)
|
||||||
|
@ -37,7 +37,7 @@ get_test_output() {
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$method $img 2>&1 > $result
|
$method $img > $result 2>&1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
Loading…
Add table
Reference in a new issue