aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apx.cpp69
1 files changed, 41 insertions, 28 deletions
diff --git a/test/apx.cpp b/test/apx.cpp
index a5ada01..08cbbb9 100644
--- a/test/apx.cpp
+++ b/test/apx.cpp
@@ -735,7 +735,7 @@ CYBOZU_TEST_AUTO(inc_dec)
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}
-CYBOZU_TEST_AUTO(div)
+CYBOZU_TEST_AUTO(div_op1)
{
struct Code : Xbyak::CodeGenerator {
Code()
@@ -804,29 +804,6 @@ CYBOZU_TEST_AUTO(div)
not_(word [r20+r30*1]);
not_(dword [r20+r30*1]);
not_(qword [r20+r30*1]);
-
- // 2op
- // imul(r30b, al); // QQQ : not supported?
- imul(r30w, ax);
- imul(r30d, eax);
- imul(r30, rax);
- imul(r30|T_nf, rax);
- imul(rcx|T_nf, rax);
- imul(rcx, ptr [r30]);
-
- neg(r30b, al);
- neg(r30w, ax);
- neg(r30d, eax);
- neg(r30, rax);
- neg(r30|T_nf, rax);
- neg(rcx|T_nf, rax);
- neg(rcx, ptr [r30]);
-
- not_(r30b, al);
- not_(r30w, ax);
- not_(r30d, eax);
- not_(r30, rax);
- not_(rcx, ptr [r30]);
}
} c;
const uint8_t tbl[] = {
@@ -862,12 +839,48 @@ CYBOZU_TEST_AUTO(div)
0xf7, 0xd4, 0x62, 0xfc, 0xfc, 0x08, 0xf7, 0xd4, 0x62, 0xbc, 0x78, 0x08, 0xf6, 0x14, 0x34, 0x62,
0xbc, 0x79, 0x08, 0xf7, 0x14, 0x34, 0x62, 0xbc, 0x78, 0x08, 0xf7, 0x14, 0x34, 0x62, 0xbc, 0xf8,
0x08, 0xf7, 0x14, 0x34,
+ };
+ const size_t n = sizeof(tbl);
+ CYBOZU_TEST_EQUAL(c.getSize(), n);
+ CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
+}
- // 2op
+CYBOZU_TEST_AUTO(imul_2op)
+{
+ struct Code : Xbyak::CodeGenerator {
+ Code()
+ {
+ // imul(r30b, al); // QQQ : not supported?
+ imul(r30w, ax);
+ imul(r30d, eax);
+ imul(r30, rax);
+ imul(r30|T_nf, rax);
+ imul(rcx|T_nf, rax);
+ imul(rcx, ptr [r30]);
+
+ neg(r30b, al);
+ neg(r30w, ax);
+ neg(r30d, eax);
+ neg(r30, rax);
+ neg(r30|T_nf, rax);
+ neg(rcx|T_nf, rax);
+ neg(rcx, ptr [r30]);
+
+ not_(r30b, al);
+ not_(r30w, ax);
+ not_(r30d, eax);
+ not_(r30, rax);
+ not_(rcx, ptr [r30]);
+ }
+ } c;
+ const uint8_t tbl[] = {
// imul
- 0x62, 0x64, 0x7d, 0x08, 0xaf, 0xf0, 0x62, 0x64, 0x7c, 0x08, 0xaf, 0xf0, 0x62, 0x64, 0xfc, 0x08,
- 0xaf, 0xf0, 0x62, 0x64, 0xfc, 0x0c, 0xaf, 0xf0, 0x62, 0xf4, 0xfc, 0x0c, 0xaf, 0xc8, 0x62, 0xdc,
- 0xfc, 0x08, 0xaf, 0x0e,
+ 0x62, 0x64, 0x7d, 0x08, 0xaf, 0xf0,
+ 0x62, 0x64, 0x7c, 0x08, 0xaf, 0xf0,
+ 0x62, 0x64, 0xfc, 0x08, 0xaf, 0xf0,
+ 0x62, 0x64, 0xfc, 0x0c, 0xaf, 0xf0,
+ 0x62, 0xf4, 0xfc, 0x0c, 0xaf, 0xc8,
+ 0x62, 0xdc, 0xfc, 0x08, 0xaf, 0x0e,
// neg
0x62, 0xf4, 0x0c, 0x10, 0xf6, 0xd8, 0x62, 0xf4, 0x0d, 0x10, 0xf7, 0xd8, 0x62, 0xf4, 0x0c, 0x10,