aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile33
-rw-r--r--test/make_nm.cpp8
-rw-r--r--test/misc.cpp63
-rw-r--r--test/noexception.cpp2
-rwxr-xr-xtest/test_address.sh8
-rwxr-xr-xtest/test_avx.sh7
-rwxr-xr-xtest/test_avx512.sh7
-rwxr-xr-xtest/test_nm.sh7
8 files changed, 100 insertions, 35 deletions
diff --git a/test/Makefile b/test/Makefile
index 2b9bd1a..feef445 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -23,9 +23,9 @@ endif
all: $(TARGET)
-CFLAGS_WARN=-Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith
+CFLAGS_WARN=-Wall -Wextra -Wformat=2 -Wcast-qual -Wwrite-strings -Wfloat-equal -Wpointer-arith
-CFLAGS=-O2 -fomit-frame-pointer -Wall -fno-operator-names -I../ -I./ $(CFLAGS_WARN) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) #-std=c++0x
+CFLAGS=-O2 -Wall -I../ -I./ $(CFLAGS_WARN) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) #-std=c++0x
make_nm:
$(CXX) $(CFLAGS) make_nm.cpp -o $@
normalize_prefix: normalize_prefix.cpp ../xbyak/xbyak.h
@@ -56,12 +56,11 @@ noexception: noexception.cpp ../xbyak/xbyak.h
test_nm: normalize_prefix $(TARGET)
$(MAKE) -C ../gen
ifneq ($(ONLY_64BIT),1)
- ./test_nm.sh
- ./test_nm.sh noexcept
- ./noexception
- ./test_nm.sh Y
- ./test_nm.sh avx512
- ./test_address.sh
+ env CXX=$(CXX) sh -e ./test_nm.sh
+ env CXX=$(CXX) sh -e ./test_nm.sh noexcept
+ env CXX=$(CXX) sh -e ./test_nm.sh Y
+ env CXX=$(CXX) sh -e ./test_nm.sh avx512
+ env CXX=$(CXX) sh -e ./test_address.sh
./jmp
./cvt_test32
endif
@@ -70,32 +69,32 @@ endif
./misc32
./cvt_test
ifeq ($(BIT),64)
- ./test_address.sh 64
+ env CXX=$(CXX) sh -e ./test_address.sh 64
ifneq ($(X32),1)
- ./test_nm.sh 64
- ./test_nm.sh Y64
+ env CXX=$(CXX) sh -e ./test_nm.sh 64
+ env CXX=$(CXX) sh -e ./test_nm.sh Y64
endif
./jmp64
endif
test_avx: normalize_prefix
ifneq ($(ONLY_64BIT),0)
- ./test_avx.sh
- ./test_avx.sh Y
+ env CXX=$(CXX) sh -e ./test_avx.sh
+ env CXX=$(CXX) sh -e ./test_avx.sh Y
endif
ifeq ($(BIT),64)
- ./test_avx.sh 64
+ env CXX=$(CXX) sh -e ./test_avx.sh 64
ifneq ($(X32),1)
- ./test_avx.sh Y64
+ env CXX=$(CXX) sh -e ./test_avx.sh Y64
endif
endif
test_avx512: normalize_prefix
ifneq ($(ONLY_64BIT),0)
- ./test_avx512.sh
+ env CXX=$(CXX) sh -e ./test_avx512.sh
endif
ifeq ($(BIT),64)
- ./test_avx512.sh 64
+ env CXX=$(CXX) sh -e ./test_avx512.sh 64
endif
detect_x32: detect_x32.c
diff --git a/test/make_nm.cpp b/test/make_nm.cpp
index 5106bf9..e5939eb 100644
--- a/test/make_nm.cpp
+++ b/test/make_nm.cpp
@@ -1018,9 +1018,7 @@ class Test {
}
void putCmov() const
{
- const struct {
- const char *s;
- } tbl[] = {
+ const char tbl[][4] = {
"o",
"no",
"b",
@@ -1054,11 +1052,11 @@ class Test {
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
char buf[32];
- snprintf(buf, sizeof(buf), "cmov%s", tbl[i].s);
+ snprintf(buf, sizeof(buf), "cmov%s", tbl[i]);
put(buf, REG16, REG16|MEM);
put(buf, REG32, REG32|MEM);
put(buf, REG64, REG64|MEM);
- snprintf(buf, sizeof(buf), "set%s", tbl[i].s);
+ snprintf(buf, sizeof(buf), "set%s", tbl[i]);
put(buf, REG8|REG8_3|MEM);
}
}
diff --git a/test/misc.cpp b/test/misc.cpp
index 6225690..7653673 100644
--- a/test/misc.cpp
+++ b/test/misc.cpp
@@ -1993,3 +1993,66 @@ CYBOZU_TEST_AUTO(minmax)
CYBOZU_TEST_EQUAL((std::min)(3, 4), local::min_(3, 4));
CYBOZU_TEST_EQUAL((std::max)(3, 4), local::max_(3, 4));
}
+
+CYBOZU_TEST_AUTO(rao_int)
+{
+ struct Code : Xbyak::CodeGenerator {
+ Code()
+ {
+#ifdef XBYAK64
+ aadd(ptr[rax], ecx);
+ aadd(ptr[eax], ecx);
+ aadd(ptr[rax], r10);
+ aand(ptr[rax], ecx);
+ aand(ptr[eax], ecx);
+ aand(ptr[rax], r10);
+ aor(ptr[rax], ecx);
+ aor(ptr[eax], ecx);
+ aor(ptr[rax], r10);
+ axor(ptr[rax], ecx);
+ axor(ptr[eax], ecx);
+ axor(ptr[rax], r10);
+#else
+ aadd(ptr[eax], ecx);
+ aand(ptr[eax], ecx);
+ aor(ptr[eax], ecx);
+ axor(ptr[eax], ecx);
+#endif
+ }
+ } c;
+ const uint8_t tbl[] = {
+#ifdef XBYAK64
+ // aadd
+ 0x0f, 0x38, 0xfc, 0x08,
+ 0x67, 0x0f, 0x38, 0xfc, 0x08,
+ 0x4c, 0x0f, 0x38, 0xfc, 0x10,
+
+ // aand
+ 0x66, 0x0f, 0x38, 0xfc, 0x08,
+ 0x66, 0x67, 0x0f, 0x38, 0xfc, 0x08,
+ 0x66, 0x4c, 0x0f, 0x38, 0xfc, 0x10,
+
+ // aor
+ 0xf2, 0x0f, 0x38, 0xfc, 0x08,
+ 0xf2, 0x67, 0x0f, 0x38, 0xfc, 0x08,
+ 0xf2, 0x4c, 0x0f, 0x38, 0xfc, 0x10,
+
+ // axor
+ 0xf3, 0x0f, 0x38, 0xfc, 0x08,
+ 0xf3, 0x67, 0x0f, 0x38, 0xfc, 0x08,
+ 0xf3, 0x4c, 0x0f, 0x38, 0xfc, 0x10,
+#else
+ // aadd
+ 0x0f, 0x38, 0xfc, 0x08,
+ // aand
+ 0x66, 0x0f, 0x38, 0xfc, 0x08,
+ // aor
+ 0xf2, 0x0f, 0x38, 0xfc, 0x08,
+ // axor
+ 0xf3, 0x0f, 0x38, 0xfc, 0x08,
+#endif
+ };
+ const size_t n = sizeof(tbl) / sizeof(tbl[0]);
+ CYBOZU_TEST_EQUAL(c.getSize(), n);
+ CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
+}
diff --git a/test/noexception.cpp b/test/noexception.cpp
index 04a6dbc..9ef0ee8 100644
--- a/test/noexception.cpp
+++ b/test/noexception.cpp
@@ -56,7 +56,7 @@ void test2()
void test3()
{
static struct EmptyAllocator : Xbyak::Allocator {
- uint8_t *alloc() { return 0; }
+ uint8_t *alloc(size_t) { return 0; }
} emptyAllocator;
struct Code : CodeGenerator {
Code() : CodeGenerator(8, 0, &emptyAllocator)
diff --git a/test/test_address.sh b/test/test_address.sh
index d283a5f..7960700 100755
--- a/test/test_address.sh
+++ b/test/test_address.sh
@@ -5,9 +5,11 @@ FILTER="grep -v warning"
sub()
{
-CFLAGS="-Wall -fno-operator-names -I../ $OPT2"
+CFLAGS="-Wall -I../ $OPT2"
+CXX=${CXX:=g++}
+
echo "compile address.cpp"
-g++ $CFLAGS address.cpp -o address
+$CXX $CFLAGS address.cpp -o address
./address $1 > a.asm
echo "asm"
@@ -17,7 +19,7 @@ awk '{printf "%s", sub(/-$/, "", $3) ? $3 : $3 ORS}' a.lst | $FILTER > ok.lst
echo "xbyak"
./address $1 jit > nm.cpp
echo "compile nm_frame.cpp"
-g++ $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame
+$CXX $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame
./nm_frame > x.lst
diff ok.lst x.lst && echo "ok"
diff --git a/test/test_avx.sh b/test/test_avx.sh
index 34dc1e5..35087cd 100755
--- a/test/test_avx.sh
+++ b/test/test_avx.sh
@@ -1,6 +1,7 @@
#!/bin/sh
FILTER="grep -v warning"
+CXX=${CXX:=g++}
case $1 in
Y)
@@ -31,9 +32,9 @@ Y64)
;;
esac
-CFLAGS="-Wall -fno-operator-names -I../ $OPT2 -DUSE_AVX"
+CFLAGS="-Wall -I../ $OPT2 -DUSE_AVX"
echo "compile make_nm.cpp"
-g++ $CFLAGS make_nm.cpp -o make_nm
+$CXX $CFLAGS make_nm.cpp -o make_nm
./make_nm > a.asm
echo "asm"
@@ -43,6 +44,6 @@ awk '$3 != "1+1" {printf "%s", sub(/-$/, "", $3) ? $3 : $3 ORS}' a.lst | $FILTER
echo "xbyak"
./make_nm jit > nm.cpp
echo "compile nm_frame.cpp"
-g++ $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame
+$CXX $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame
./nm_frame | $FILTER > x.lst
diff -B ok.lst x.lst && echo "ok"
diff --git a/test/test_avx512.sh b/test/test_avx512.sh
index 17edfee..90d14df 100755
--- a/test/test_avx512.sh
+++ b/test/test_avx512.sh
@@ -1,6 +1,7 @@
#!/bin/sh
FILTER="grep -v warning"
+CXX=${CXX:=g++}
case $1 in
64)
@@ -18,9 +19,9 @@ case $1 in
;;
esac
-CFLAGS="-Wall -fno-operator-names -I../ $OPT2 -DUSE_AVX512"
+CFLAGS="-Wall -I../ $OPT2 -DUSE_AVX512"
echo "compile make_512.cpp"
-g++ $CFLAGS make_512.cpp -o make_512
+$CXX $CFLAGS make_512.cpp -o make_512
./make_512 > a.asm
echo "asm"
@@ -30,6 +31,6 @@ awk '{printf "%s", sub(/-$/, "", $3) ? $3 : $3 ORS}' a.lst | $FILTER > ok.lst
echo "xbyak"
./make_512 jit > nm.cpp
echo "compile nm_frame.cpp"
-g++ $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame -DXBYAK_AVX512
+$CXX $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame -DXBYAK_AVX512
./nm_frame | $FILTER > x.lst
diff -B ok.lst x.lst && echo "ok"
diff --git a/test/test_nm.sh b/test/test_nm.sh
index afa2b1e..019f278 100755
--- a/test/test_nm.sh
+++ b/test/test_nm.sh
@@ -1,6 +1,7 @@
#!/bin/sh
FILTER=cat
+CXX=${CXX:=g++}
case $1 in
Y)
@@ -44,9 +45,9 @@ noexcept)
;;
esac
-CFLAGS="-Wall -fno-operator-names -I../ $OPT2"
+CFLAGS="-Wall -I../ $OPT2"
echo "compile make_nm.cpp with $CFLAGS"
-g++ $CFLAGS make_nm.cpp -o make_nm
+$CXX $CFLAGS make_nm.cpp -o make_nm
./make_nm > a.asm
echo "asm"
@@ -56,6 +57,6 @@ awk '$3 != "1+1" {printf "%s", sub(/-$/, "", $3) ? $3 : $3 ORS}' a.lst | $FILTER
echo "xbyak"
./make_nm jit > nm.cpp
echo "compile nm_frame.cpp"
-g++ $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame
+$CXX $CFLAGS -DXBYAK_TEST nm_frame.cpp -o nm_frame
./nm_frame | $FILTER > x.lst
diff -B ok.lst x.lst && echo "ok"