aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2023-11-22 10:54:26 +0900
committerMITSUNARI Shigeo <[email protected]>2023-11-22 10:54:26 +0900
commit77eca6d0dcd75e7a0d24b3a86506ebaba6879d8f (patch)
tree4b164f80c724c11c8e9c7b16b801ce2bc6a120df /test
parent5e54ffdfaf8a38efcd0821c74bde63379c0e914a (diff)
downloadxbyak-77eca6d0dcd75e7a0d24b3a86506ebaba6879d8f.tar.gz
xbyak-77eca6d0dcd75e7a0d24b3a86506ebaba6879d8f.zip
add tests of 3-op shift
Diffstat (limited to 'test')
-rw-r--r--test/apx.cpp163
1 files changed, 163 insertions, 0 deletions
diff --git a/test/apx.cpp b/test/apx.cpp
index c272231..a5d2ebf 100644
--- a/test/apx.cpp
+++ b/test/apx.cpp
@@ -1230,3 +1230,166 @@ CYBOZU_TEST_AUTO(shift_2op)
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}
+
+CYBOZU_TEST_AUTO(shift_3op)
+{
+ struct Code : Xbyak::CodeGenerator {
+ Code()
+ {
+ rcl(r20b, r16b, cl);
+ rcl(r20w, r16w, cl);
+ rcl(r20d, r16d, cl);
+ rcl(r20, r16, cl);
+ rcl(r20b, ptr [r16], cl);
+ rcl(r20w, ptr [r16], cl);
+ rcl(r20d, ptr [r16], cl);
+ rcl(r20, ptr [r16], cl);
+ rcl(r20b, r16b, 0x2);
+ rcl(r20w, r16w, 0x4);
+ rcl(r20d, r16d, 0x6);
+ rcl(r20, r16, 0x8);
+ rcl(r20b, ptr [r16], 0x2);
+ rcl(r20w, ptr [r16], 0x4);
+ rcl(r20d, ptr [r16], 0x6);
+ rcl(r20, ptr [r16], 0x8);
+
+ rcr(r20b, r16b, cl);
+ rcr(r20w, r16w, cl);
+ rcr(r20d, r16d, cl);
+ rcr(r20, r16, cl);
+ rcr(r20b, ptr [r16], cl);
+ rcr(r20w, ptr [r16], cl);
+ rcr(r20d, ptr [r16], cl);
+ rcr(r20, ptr [r16], cl);
+ rcr(r20b, r16b, 0x2);
+ rcr(r20w, r16w, 0x4);
+ rcr(r20d, r16d, 0x6);
+ rcr(r20, r16, 0x8);
+ rcr(r20b, ptr [r16], 0x2);
+ rcr(r20w, ptr [r16], 0x4);
+ rcr(r20d, ptr [r16], 0x6);
+ rcr(r20, ptr [r16], 0x8);
+
+ rol(r20b, r16b, cl);
+ rol(r20w, r16w, cl);
+ rol(r20d, r16d, cl);
+ rol(r20, r16, cl);
+ rol(r20b, ptr [r16], cl);
+ rol(r20w, ptr [r16], cl);
+ rol(r20d, ptr [r16], cl);
+ rol(r20, ptr [r16], cl);
+ rol(r20b, r16b, 0x2);
+ rol(r20w, r16w, 0x4);
+ rol(r20d, r16d, 0x6);
+ rol(r20, r16, 0x8);
+ rol(r20b, ptr [r16], 0x2);
+ rol(r20w, ptr [r16], 0x4);
+ rol(r20d, ptr [r16], 0x6);
+ rol(r20, ptr [r16], 0x8);
+
+ shl(r20b, r16b, cl);
+ shl(r20w, r16w, cl);
+ shl(r20d, r16d, cl);
+ shl(r20, r16, cl);
+ shl(r20b, ptr [r16], cl);
+ shl(r20w, ptr [r16], cl);
+ shl(r20d, ptr [r16], cl);
+ shl(r20, ptr [r16], cl);
+ shl(r20b, r16b, 0x2);
+ shl(r20w, r16w, 0x4);
+ shl(r20d, r16d, 0x6);
+ shl(r20, r16, 0x8);
+ shl(r20b, ptr [r16], 0x2);
+ shl(r20w, ptr [r16], 0x4);
+ shl(r20d, ptr [r16], 0x6);
+ shl(r20, ptr [r16], 0x8);
+
+ shr(r20b, r16b, cl);
+ shr(r20w, r16w, cl);
+ shr(r20d, r16d, cl);
+ shr(r20, r16, cl);
+ shr(r20b, ptr [r16], cl);
+ shr(r20w, ptr [r16], cl);
+ shr(r20d, ptr [r16], cl);
+ shr(r20, ptr [r16], cl);
+ shr(r20b, r16b, 0x2);
+ shr(r20w, r16w, 0x4);
+ shr(r20d, r16d, 0x6);
+ shr(r20, r16, 0x8);
+ shr(r20b, ptr [r16], 0x2);
+ shr(r20w, ptr [r16], 0x4);
+ shr(r20d, ptr [r16], 0x6);
+ shr(r20, ptr [r16], 0x8);
+
+ sar(r20b, r16b, cl);
+ sar(r20w, r16w, cl);
+ sar(r20d, r16d, cl);
+ sar(r20, r16, cl);
+ sar(r20b, ptr [r16], cl);
+ sar(r20w, ptr [r16], cl);
+ sar(r20d, ptr [r16], cl);
+ sar(r20, ptr [r16], cl);
+ sar(r20b, r16b, 0x2);
+ sar(r20w, r16w, 0x4);
+ sar(r20d, r16d, 0x6);
+ sar(r20, r16, 0x8);
+ sar(r20b, ptr [r16], 0x2);
+ sar(r20w, ptr [r16], 0x4);
+ sar(r20d, ptr [r16], 0x6);
+ sar(r20, ptr [r16], 0x8);
+ }
+ } c;
+ const uint8_t tbl[] = {
+ // rcl
+ 0x62, 0xfc, 0x5c, 0x10, 0xd2, 0xd0, 0x62, 0xfc, 0x5d, 0x10, 0xd3, 0xd0, 0x62, 0xfc, 0x5c, 0x10,
+ 0xd3, 0xd0, 0x62, 0xfc, 0xdc, 0x10, 0xd3, 0xd0, 0x62, 0xfc, 0x5c, 0x10, 0xd2, 0x10, 0x62, 0xfc,
+ 0x5d, 0x10, 0xd3, 0x10, 0x62, 0xfc, 0x5c, 0x10, 0xd3, 0x10, 0x62, 0xfc, 0xdc, 0x10, 0xd3, 0x10,
+ 0x62, 0xfc, 0x5c, 0x10, 0xc0, 0xd0, 0x02, 0x62, 0xfc, 0x5d, 0x10, 0xc1, 0xd0, 0x04, 0x62, 0xfc,
+ 0x5c, 0x10, 0xc1, 0xd0, 0x06, 0x62, 0xfc, 0xdc, 0x10, 0xc1, 0xd0, 0x08, 0x62, 0xfc, 0x5c, 0x10,
+ 0xc0, 0x10, 0x02, 0x62, 0xfc, 0x5d, 0x10, 0xc1, 0x10, 0x04, 0x62, 0xfc, 0x5c, 0x10, 0xc1, 0x10,
+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