diff --git a/test/readme.txt b/test/readme.txt new file mode 100644 index 0000000..afe5d67 --- /dev/null +++ b/test/readme.txt @@ -0,0 +1,6 @@ + +test script on Windows + +this test requires nasm.exe, yasm.exe, cl.exe, awk, diff + +test_all ; for all tests diff --git a/test/test_address.sh b/test/test_address.sh new file mode 100755 index 0000000..c54c338 --- /dev/null +++ b/test/test_address.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +FILTER=cat + +sub() +{ + +CFLAGS="-Wall -fno-operator-names -I../ $OPT2" +echo "compile address.cpp" +g++ $CFLAGS address.cpp -o address + +./address $1 > a.asm +echo "asm" +$EXE -f$OPT3 a.asm -l a.lst +awk '{print $3}' < a.lst > ok.lst + +echo "xbyak" +./address $1 jit > nm.cpp +echo "compile nm_frame.cpp" +g++ $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame +./nm_frame > x.lst +diff ok.lst x.lst && echo "ok" +wc x.lst + +} + +if [ "$1" = "64" ]; then + echo "nasm(64bit)" + EXE=nasm + OPT2=-DXBYAK64 + OPT3=win64 + + sub 1 + sub 2 +else + echo "nasm(32bit)" + EXE=nasm + OPT2=-DXBYAK32 + OPT3=win32 + sub 1 +fi + diff --git a/test/test_avx.bat b/test/test_avx.bat new file mode 100755 index 0000000..fbe7e63 --- /dev/null +++ b/test/test_avx.bat @@ -0,0 +1,42 @@ +@echo off +set FILTER=cat +set Y=0 +if /i "%1"=="Y" ( + set Y=1 + set EXE=yasm.exe + set OPT2=-DUSE_YASM -DXBYAK32 + set OPT3=win32 +) else if /i "%1"=="64" ( + set EXE=nasm.exe + set OPT2=-DXBYAK64 + set OPT3=win64 + set FILTER=normalize_prefix +) else if /i "%1"=="Y64" ( + set Y=1 + set EXE=yasm.exe + set OPT2=-DUSE_YASM -DXBYAK64 + set OPT3=win64 + set FILTER=normalize_prefix +) else ( + set EXE=nasm.exe + set OPT2=-DXBYAK32 + set OPT3=win32 +) +pushd ..\gen +call update +popd +echo cl -I../ make_nm.cpp %OPT% %OPT2% /EHs /DUSE_AVX +cl -I../ make_nm.cpp %OPT% %OPT2% /EHs /DUSE_AVX +make_nm > a.asm +%EXE% -f %OPT3% -l a.lst a.asm +rem connect "?????-" and "??" +if /i "%Y%"=="1" ( + awk "NR > 1 {if (index($3, ""-"")) { conti=substr($3, 0, length($3) - 1) } else { conti = conti $3; print conti; conti = """" }} " < a.lst |%FILTER% > ok.lst +) else ( + awk "{if (index($3, ""-"")) { conti=substr($3, 0, length($3) - 1) } else { conti = conti $3; print conti; conti = """" }} " < a.lst |%FILTER% > ok.lst +) +make_nm jit > nm.cpp +cl -I../ -DXBYAK_TEST nm_frame.cpp %OPT% %OPT2% +nm_frame |%FILTER% > x.lst +diff x.lst ok.lst +wc x.lst diff --git a/test/test_avx.sh b/test/test_avx.sh new file mode 100755 index 0000000..1940515 --- /dev/null +++ b/test/test_avx.sh @@ -0,0 +1,44 @@ +#!/bin/tcsh + +set FILTER=cat + +if ($1 == "Y") then + echo "yasm(32bit)" + set EXE=yasm + set OPT2="-DUSE_YASM -DXBYAK32" + set OPT3=win32 +else if ($1 == "64") then + echo "nasm(64bit)" + set EXE=nasm + set OPT2=-DXBYAK64 + set OPT3=win64 + set FILTER=./normalize_prefix +else if ($1 == "Y64") then + echo "yasm(64bit)" + set EXE=yasm + set OPT2="-DUSE_YASM -DXBYAK64" + set OPT3=win64 + set FILTER=./normalize_prefix +else + echo "nasm(32bit)" + set EXE=nasm + set OPT2=-DXBYAK32 + set OPT3=win32 +endif + +set CFLAGS="-Wall -fno-operator-names -I../ $OPT2 -DUSE_AVX" +echo "compile make_nm.cpp" +g++ $CFLAGS make_nm.cpp -o make_nm + +./make_nm > a.asm +echo "asm" +$EXE -f$OPT3 a.asm -l a.lst +awk '{if (index($3, "-")) { conti=substr($3, 0, length($3) - 1) } else { conti = conti $3; print conti; conti = "" }} ' < a.lst | $FILTER > ok.lst + +echo "xbyak" +./make_nm jit > nm.cpp +echo "compile nm_frame.cpp" +g++ $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame +./nm_frame | $FILTER > x.lst +diff ok.lst x.lst && echo "ok" +exit 0 diff --git a/test/test_avx_all.bat b/test/test_avx_all.bat new file mode 100755 index 0000000..ec74d28 --- /dev/null +++ b/test/test_avx_all.bat @@ -0,0 +1,9 @@ +@echo off +echo ** nasm-avx(32bit) *** +call test_avx +echo ** nasm-avx(64bit) *** +call test_avx 64 +echo ** yasm-avx(32bit) *** +call test_avx Y +echo ** yasm-avx(64bit) *** +call test_avx Y64