mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 603890 add --endianness to lirasm, make tests endianness aware r=nnethercote
--HG-- extra : convert_revision : c7cd544f32aae57d3d359756db867bb33dd83e73
This commit is contained in:
parent
257334300b
commit
5e1533734b
@ -2235,6 +2235,7 @@ usageAndQuit(const string& progname)
|
||||
" --[no-]optimize enable or disable optimization of the LIR (default=off)\n"
|
||||
" --random [N] generate a random LIR block of size N (default=1000)\n"
|
||||
" --word-size prints the word size (32 or 64) for this build of lirasm and exits\n"
|
||||
" --endianness prints endianness (little-endian or big-endian) for this build of librasm and exits\n"
|
||||
" i386-specific options:\n"
|
||||
" --sse use SSE2 instructions\n"
|
||||
" ARM-specific options:\n"
|
||||
@ -2313,6 +2314,15 @@ processCmdLine(int argc, char **argv, CmdLineOptions& opts)
|
||||
cout << sizeof(void*) * 8 << "\n";
|
||||
exit(0);
|
||||
}
|
||||
else if (arg == "--endianness") {
|
||||
int32_t x = 0x01020304;
|
||||
if (*(char*)&x == 0x1) {
|
||||
cout << "big-endian" << "\n";
|
||||
} else {
|
||||
cout << "little-endian" << "\n";
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Architecture-specific flags.
|
||||
#if defined NANOJIT_IA32
|
||||
|
@ -77,6 +77,24 @@ then
|
||||
done
|
||||
fi
|
||||
|
||||
# little endian
|
||||
if [[ $($LIRASM --endianness 2>/dev/null) != "big-endian" ]]
|
||||
then
|
||||
for infile in "$TESTS_DIR"/littleendian/*.in
|
||||
do
|
||||
runtest $infile
|
||||
done
|
||||
fi
|
||||
|
||||
# big endian
|
||||
if [[ $($LIRASM --endianness 2>/dev/null) == "big-endian" ]]
|
||||
then
|
||||
for infile in "$TESTS_DIR"/bigendian/*.in
|
||||
do
|
||||
runtest $infile
|
||||
done
|
||||
fi
|
||||
|
||||
# ARM
|
||||
if [[ $(uname -m) == arm* ]]
|
||||
then
|
||||
|
5
js/src/lirasm/tests/littleendian/fuzz-527178.in
Normal file
5
js/src/lirasm/tests/littleendian/fuzz-527178.in
Normal file
@ -0,0 +1,5 @@
|
||||
base = allocp 512
|
||||
five = immi 5
|
||||
sti five base 256
|
||||
x = ldus2ui base 256
|
||||
reti x
|
1
js/src/lirasm/tests/littleendian/fuzz-527178.out
Normal file
1
js/src/lirasm/tests/littleendian/fuzz-527178.out
Normal file
@ -0,0 +1 @@
|
||||
Output is: 5
|
26
js/src/lirasm/tests/littleendian/ldc2i.in
Normal file
26
js/src/lirasm/tests/littleendian/ldc2i.in
Normal file
@ -0,0 +1,26 @@
|
||||
full = immi 1288908529 ; 0x4cd32ef1
|
||||
p = allocp 4
|
||||
sti full p 0
|
||||
|
||||
n0chk = immi -15 ; sign_extend(0xf1)
|
||||
n1chk = immi 46 ; sign_extend(0x2e)
|
||||
n2chk = immi -45 ; sign_extend(0xd3)
|
||||
n3chk = immi 76 ; sign_extend(0x4c)
|
||||
|
||||
n0 = ldc2i p 0
|
||||
n1 = ldc2i p 1
|
||||
n2 = ldc2i p 2
|
||||
n3 = ldc2i p 3
|
||||
|
||||
; Collate the results.
|
||||
r0 = xori n0chk n0
|
||||
r1 = xori n1chk n1
|
||||
r2 = xori n2chk n2
|
||||
r3 = xori n3chk n3
|
||||
|
||||
r0_1 = ori r0 r1
|
||||
r2_3 = ori r2 r3
|
||||
|
||||
r = ori r0_1 r2_3
|
||||
reti r
|
||||
|
1
js/src/lirasm/tests/littleendian/ldc2i.out
Normal file
1
js/src/lirasm/tests/littleendian/ldc2i.out
Normal file
@ -0,0 +1 @@
|
||||
Output is: 0
|
17
js/src/lirasm/tests/littleendian/lds2i.in
Normal file
17
js/src/lirasm/tests/littleendian/lds2i.in
Normal file
@ -0,0 +1,17 @@
|
||||
full = immi -249334698 ; 0xf1237456
|
||||
p = allocp 4
|
||||
sti full p 0
|
||||
|
||||
n0chk = immi 29782 ; sign_extend(0x7456)
|
||||
n1chk = immi -3805 ; sign_extend(0xf123)
|
||||
|
||||
n0 = lds2i p 0
|
||||
n1 = lds2i p 2
|
||||
|
||||
; Collate the results.
|
||||
r0 = xori n0chk n0
|
||||
r1 = xori n1chk n1
|
||||
|
||||
r = ori r0 r1
|
||||
reti r
|
||||
|
1
js/src/lirasm/tests/littleendian/lds2i.out
Normal file
1
js/src/lirasm/tests/littleendian/lds2i.out
Normal file
@ -0,0 +1 @@
|
||||
Output is: 0
|
26
js/src/lirasm/tests/littleendian/lduc2ui.in
Normal file
26
js/src/lirasm/tests/littleendian/lduc2ui.in
Normal file
@ -0,0 +1,26 @@
|
||||
full = immi -992746767 ; 0xc4d3e2f1
|
||||
p = allocp 4
|
||||
sti full p 0
|
||||
|
||||
n0chk = immi 241 ; 0xf1
|
||||
n1chk = immi 226 ; 0xe2
|
||||
n2chk = immi 211 ; 0xd3
|
||||
n3chk = immi 196 ; 0xc4
|
||||
|
||||
n0 = lduc2ui p 0
|
||||
n1 = lduc2ui p 1
|
||||
n2 = lduc2ui p 2
|
||||
n3 = lduc2ui p 3
|
||||
|
||||
; Collate the results.
|
||||
r0 = xori n0chk n0
|
||||
r1 = xori n1chk n1
|
||||
r2 = xori n2chk n2
|
||||
r3 = xori n3chk n3
|
||||
|
||||
r0_1 = ori r0 r1
|
||||
r2_3 = ori r2 r3
|
||||
|
||||
r = ori r0_1 r2_3
|
||||
reti r
|
||||
|
1
js/src/lirasm/tests/littleendian/lduc2ui.out
Normal file
1
js/src/lirasm/tests/littleendian/lduc2ui.out
Normal file
@ -0,0 +1 @@
|
||||
Output is: 0
|
17
js/src/lirasm/tests/littleendian/ldus2ui.in
Normal file
17
js/src/lirasm/tests/littleendian/ldus2ui.in
Normal file
@ -0,0 +1,17 @@
|
||||
full = immi -249334698 ; 0xf1237456
|
||||
p = allocp 4
|
||||
sti full p 0
|
||||
|
||||
n0chk = immi 29782 ; sign_extend(0x7456)
|
||||
n1chk = immi 61731 ; sign_extend(0xf123)
|
||||
|
||||
n0 = ldus2ui p 0
|
||||
n1 = ldus2ui p 2
|
||||
|
||||
; Collate the results.
|
||||
r0 = xori n0chk n0
|
||||
r1 = xori n1chk n1
|
||||
|
||||
r = ori r0 r1
|
||||
reti r
|
||||
|
1
js/src/lirasm/tests/littleendian/ldus2ui.out
Normal file
1
js/src/lirasm/tests/littleendian/ldus2ui.out
Normal file
@ -0,0 +1 @@
|
||||
Output is: 0
|
Loading…
Reference in New Issue
Block a user