mirror of
https://github.com/herumi/xbyak
synced 2024-11-20 16:06:14 -07:00
refactor test
This commit is contained in:
parent
508b543cb8
commit
a29fa27b92
8 changed files with 31 additions and 48 deletions
|
@ -37,7 +37,7 @@ cvt_test: cvt_test.cpp ../xbyak/xbyak.h
|
|||
cvt_test32: cvt_test.cpp ../xbyak/xbyak.h
|
||||
$(CXX) $(CFLAGS) $< -o $@ -DXBYAK32
|
||||
|
||||
test: normalize_prefix jmp bad_address $(TARGET)
|
||||
test_nm: normalize_prefix jmp bad_address $(TARGET)
|
||||
$(MAKE) -C ../gen
|
||||
./test_nm.sh
|
||||
./test_nm.sh Y
|
||||
|
@ -69,6 +69,12 @@ test_avx512: normalize_prefix
|
|||
ifeq ($(BIT),64)
|
||||
./test_avx512.sh 64
|
||||
endif
|
||||
|
||||
test:
|
||||
$(MAKE) test_nm
|
||||
$(MAKE) test_avx
|
||||
$(MAKE) test_avx512
|
||||
|
||||
clean:
|
||||
rm -rf *.o $(TARGET) lib_run nm.cpp nm_frame make_512
|
||||
|
||||
|
|
|
@ -1,47 +1,28 @@
|
|||
#include <xbyak/xbyak.h>
|
||||
|
||||
#define TEST_EXCEPTION(state) \
|
||||
{ \
|
||||
num++; \
|
||||
bool exception = false; \
|
||||
try { \
|
||||
state; \
|
||||
} catch (...) { \
|
||||
exception = true; \
|
||||
} \
|
||||
if (!exception) { \
|
||||
printf("exception should arise for %s\n", #state); \
|
||||
err++; \
|
||||
} \
|
||||
}
|
||||
#include <cybozu/test.hpp>
|
||||
|
||||
struct Code : Xbyak::CodeGenerator {
|
||||
Code()
|
||||
{
|
||||
int err = 0;
|
||||
int num = 0;
|
||||
TEST_EXCEPTION(mov(eax, ptr [esp + esp]));
|
||||
TEST_EXCEPTION(mov(eax, ptr [ax])); // not support
|
||||
TEST_EXCEPTION(mov(eax, ptr [esp * 4]));
|
||||
TEST_EXCEPTION(mov(eax, ptr [eax * 16]));
|
||||
TEST_EXCEPTION(mov(eax, ptr [eax + eax + eax]));
|
||||
TEST_EXCEPTION(mov(eax, ptr [eax * 2 + ecx * 4]));
|
||||
TEST_EXCEPTION(mov(eax, ptr [eax * 2 + ecx * 4]));
|
||||
TEST_EXCEPTION(mov(eax, ptr [xmm0]));
|
||||
TEST_EXCEPTION(fld(dword [xmm0]));
|
||||
TEST_EXCEPTION(vgatherdpd(xmm0, ptr [eax * 2], ymm3));
|
||||
TEST_EXCEPTION(vgatherdpd(xmm0, ptr [xmm0 + xmm1], ymm3));
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [esp + esp]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [ax]), std::exception); // not support
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [esp * 4]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [eax * 16]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [eax + eax + eax]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [eax * 2 + ecx * 4]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [eax * 2 + ecx * 4]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [xmm0]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(fld(dword [xmm0]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(vgatherdpd(xmm0, ptr [eax * 2], ymm3), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(vgatherdpd(xmm0, ptr [xmm0 + xmm1], ymm3), std::exception);
|
||||
#ifdef XBYAK64
|
||||
TEST_EXCEPTION(mov(eax, ptr [rax + eax]));
|
||||
TEST_EXCEPTION(mov(eax, ptr [xmm0 + ymm0]));
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [rax + eax]), std::exception);
|
||||
CYBOZU_TEST_EXCEPTION(mov(eax, ptr [xmm0 + ymm0]), std::exception);
|
||||
#endif
|
||||
if (!err) {
|
||||
printf("bad_address test %d ok\n", num);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
CYBOZU_TEST_AUTO(exception)
|
||||
{
|
||||
Code c;
|
||||
}
|
||||
|
|
|
@ -574,9 +574,9 @@ public:
|
|||
for (size_t k = 0; k < N; k++) {
|
||||
#ifdef XBYAK64
|
||||
for (int kIdx = 0; kIdx < 8; kIdx++) {
|
||||
put_vaddpd(xTbl[i], xTbl[j], xTbl[k], kIdx);
|
||||
put_vaddpd(yTbl[i], yTbl[j], yTbl[k], kIdx);
|
||||
for (int z = 0; z < 2; z++) {
|
||||
put_vaddpd(xTbl[i], xTbl[j], xTbl[k], kIdx, z == 1);
|
||||
put_vaddpd(yTbl[i], yTbl[j], yTbl[k], kIdx, z == 1);
|
||||
for (int sae = 0; sae < 5; sae++) {
|
||||
put_vaddpd(zTbl[i], zTbl[j], zTbl[k], kIdx, z == 1, sae);
|
||||
}
|
||||
|
|
|
@ -2664,9 +2664,9 @@ public:
|
|||
for (size_t k = 0; k < N; k++) {
|
||||
#ifdef XBYAK64
|
||||
for (int kIdx = 0; kIdx < 8; kIdx++) {
|
||||
put_vaddpd(xTbl[i], xTbl[j], xTbl[k], kIdx);
|
||||
put_vaddpd(yTbl[i], yTbl[j], yTbl[k], kIdx);
|
||||
for (int z = 0; z < 2; z++) {
|
||||
put_vaddpd(xTbl[i], xTbl[j], xTbl[k], kIdx, z == 1);
|
||||
put_vaddpd(yTbl[i], yTbl[j], yTbl[k], kIdx, z == 1);
|
||||
for (int sae = 0; sae < 5; sae++) {
|
||||
put_vaddpd(zTbl[i], zTbl[j], zTbl[k], kIdx, z == 1, sae);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ 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
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,11 @@ 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
|
||||
awk '{if (index($3, "-")) { conti=substr($3, 0, length($3) - 1) } else { conti = conti $3; print conti; conti = "" }} ' < a.lst | $FILTER | grep -v "1+1" > 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 -B ok.lst x.lst && echo "ok"
|
||||
|
|
|
@ -29,5 +29,4 @@ echo "xbyak"
|
|||
echo "compile nm_frame.cpp"
|
||||
g++ $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame -DXBYAK_AVX512
|
||||
./nm_frame | $FILTER > x.lst
|
||||
diff ok.lst x.lst && echo "ok"
|
||||
exit 0
|
||||
diff -B ok.lst x.lst && echo "ok"
|
||||
|
|
|
@ -39,12 +39,11 @@ 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
|
||||
awk '{if (index($3, "-")) { conti=substr($3, 0, length($3) - 1) } else { conti = conti $3; print conti; conti = "" }} ' < a.lst | $FILTER | grep -v "1+1" > 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 -B ok.lst x.lst && echo "ok"
|
||||
|
|
Loading…
Reference in a new issue