aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2014-05-20 14:28:46 +0900
committerMITSUNARI Shigeo <[email protected]>2014-05-20 14:28:46 +0900
commit2d599b3bd64a6d13c8b47a5f7410c67837bfff5d (patch)
tree90487f915d060d1690f0134a8b588e5b309f297e /test
parent38d3d7074feda2cd6a0e71b5fb2b46adeb9a7829 (diff)
downloadxbyak-2d599b3bd64a6d13c8b47a5f7410c67837bfff5d.tar.gz
xbyak-2d599b3bd64a6d13c8b47a5f7410c67837bfff5d.zip
lost to upload of TEST_EXCEPTION
Diffstat (limited to 'test')
-rw-r--r--test/bad_address.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/bad_address.cpp b/test/bad_address.cpp
new file mode 100644
index 0000000..3cac3fa
--- /dev/null
+++ b/test/bad_address.cpp
@@ -0,0 +1,45 @@
+#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++; \
+ } \
+}
+
+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(vgatherdpd(xmm0, ptr [eax * 2], ymm3));
+ TEST_EXCEPTION(vgatherdpd(xmm0, ptr [xmm0 + xmm1], ymm3));
+#ifdef XBYAK64
+ TEST_EXCEPTION(mov(eax, ptr [rax + eax]));
+ TEST_EXCEPTION(mov(eax, ptr [xmm0 + ymm0]));
+#endif
+ if (!err) {
+ printf("bad_address test %d ok\n", num);
+ }
+ }
+};
+
+int main()
+{
+ Code c;
+}