mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Initial import
This commit is contained in:
commit
c91b3c5006
14915 changed files with 590219 additions and 0 deletions
13
test/libc/xed/lib.h
Normal file
13
test/libc/xed/lib.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef COSMOPOLITAN_TEST_LIBC_XED_LIB_H_
|
||||
#define COSMOPOLITAN_TEST_LIBC_XED_LIB_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int ild(const char16_t *codez);
|
||||
int ildreal(const char16_t *codez);
|
||||
int ildlegacy(const char16_t *codez);
|
||||
uint8_t *unbingx86op(const char16_t *codez) nodiscard;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_TEST_LIBC_XED_LIB_H_ */
|
102
test/libc/xed/test.mk
Normal file
102
test/libc/xed/test.mk
Normal file
|
@ -0,0 +1,102 @@
|
|||
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
||||
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
|
||||
|
||||
TEST_LIBC_XED_FILES := $(wildcard test/libc/xed/*)
|
||||
TEST_LIBC_XED_HDRS = $(filter %.h,$(TEST_LIBC_XED_FILES))
|
||||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
PKGS += TEST_LIBC_XED_TESTLIB
|
||||
|
||||
TEST_LIBC_XED_TESTLIB_SRCS = \
|
||||
$(TEST_LIBC_XED_TESTLIB_A_SRCS)
|
||||
|
||||
TEST_LIBC_XED_TESTLIB_OBJS = \
|
||||
$(TEST_LIBC_XED_TESTLIB_A_OBJS)
|
||||
|
||||
TEST_LIBC_XED_TESTLIB = \
|
||||
$(TEST_LIBC_XED_TESTLIB_A_DEPS) \
|
||||
$(TEST_LIBC_XED_TESTLIB_A)
|
||||
|
||||
TEST_LIBC_XED_TESTLIB_A = o/$(MODE)/test/libc/xed/testlib.a
|
||||
TEST_LIBC_XED_TESTLIB_A_SRCS = $(filter %_lib.c,$(TEST_LIBC_XED_FILES))
|
||||
|
||||
TEST_LIBC_XED_TESTLIB_A_OBJS = \
|
||||
$(TEST_LIBC_XED_TESTLIB_A_SRCS:%=o/$(MODE)/%.zip.o) \
|
||||
$(TEST_LIBC_XED_TESTLIB_A_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
TEST_LIBC_XED_TESTLIB_A_DIRECTDEPS = \
|
||||
LIBC_MEM \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_STUBS \
|
||||
LIBC_TESTLIB \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_XED
|
||||
|
||||
TEST_LIBC_XED_TESTLIB_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(TEST_LIBC_XED_TESTLIB_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
$(TEST_LIBC_XED_TESTLIB_A).pkg: \
|
||||
$(TEST_LIBC_XED_TESTLIB_A_OBJS) \
|
||||
$(foreach x,$(TEST_LIBC_XED_TESTLIB_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
$(TEST_LIBC_XED_TESTLIB_A): \
|
||||
test/libc/xed/ \
|
||||
$(TEST_LIBC_XED_TESTLIB_A).pkg \
|
||||
$(TEST_LIBC_XED_TESTLIB_A_OBJS)
|
||||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
PKGS += TEST_LIBC_XED
|
||||
|
||||
TEST_LIBC_XED_SRCS = $(filter %_test.c,$(TEST_LIBC_XED_FILES))
|
||||
TEST_LIBC_XED_COMS = $(TEST_LIBC_XED_OBJS:%.o=%.com)
|
||||
|
||||
TEST_LIBC_XED_OBJS = \
|
||||
$(TEST_LIBC_XED_SRCS:%=o/$(MODE)/%.zip.o) \
|
||||
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.o)
|
||||
|
||||
TEST_LIBC_XED_BINS = \
|
||||
$(TEST_LIBC_XED_COMS) \
|
||||
$(TEST_LIBC_XED_COMS:%=%.dbg)
|
||||
|
||||
TEST_LIBC_XED_TESTS = \
|
||||
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com.ok)
|
||||
|
||||
TEST_LIBC_XED_CHECKS = \
|
||||
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com.runs)
|
||||
|
||||
TEST_LIBC_XED_DIRECTDEPS = \
|
||||
LIBC_CALLS_HEFTY \
|
||||
LIBC_MEM \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_STUBS \
|
||||
LIBC_TESTLIB \
|
||||
TEST_LIBC_XED_TESTLIB \
|
||||
THIRD_PARTY_XED
|
||||
|
||||
TEST_LIBC_XED_DEPS := \
|
||||
$(call uniq,$(foreach x,$(TEST_LIBC_XED_DIRECTDEPS),$($(x))))
|
||||
|
||||
o/$(MODE)/test/libc/xed/xed.pkg: \
|
||||
$(TEST_LIBC_XED_OBJS) \
|
||||
$(foreach x,$(TEST_LIBC_XED_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/test/libc/xed/%.com.dbg: \
|
||||
$(TEST_LIBC_XED_DEPS) \
|
||||
o/$(MODE)/test/libc/xed/%.o \
|
||||
o/$(MODE)/test/libc/xed/xed.pkg \
|
||||
$(LIBC_TESTMAIN) \
|
||||
$(CRT) \
|
||||
$(APE)
|
||||
@$(APELINK)
|
||||
|
||||
#───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
.PHONY: o/$(MODE)/test/libc/xed
|
||||
o/$(MODE)/test/libc/xed: \
|
||||
$(TEST_LIBC_XED_BINS) \
|
||||
$(TEST_LIBC_XED_CHECKS)
|
69
test/libc/xed/x86ild_lib.c
Normal file
69
test/libc/xed/x86ild_lib.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/bing.h"
|
||||
#include "libc/macros.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "test/libc/xed/lib.h"
|
||||
#include "third_party/xed/x86.h"
|
||||
|
||||
testonly nodiscard uint8_t *unbingx86op(const char16_t *codez) {
|
||||
size_t len;
|
||||
len = strlen(codez);
|
||||
return unbingbuf(xmalloc(ROUNDUP(len, 16)), len, codez, 0x90);
|
||||
}
|
||||
|
||||
/**
|
||||
* Long mode instruction length decoder.
|
||||
*/
|
||||
testonly int ild(const char16_t *codez) {
|
||||
struct XedDecodedInst xedd;
|
||||
enum XedError error;
|
||||
error = xed_instruction_length_decode(
|
||||
xed_decoded_inst_zero_set_mode(&xedd, XED_MACHINE_MODE_LONG_64),
|
||||
gc(unbingx86op(codez)), strlen16(codez) + 16);
|
||||
return error == XED_ERROR_NONE ? xedd.decoded_length : -error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Real mode instruction length decoder.
|
||||
*/
|
||||
testonly int ildreal(const char16_t *codez) {
|
||||
struct XedDecodedInst xedd;
|
||||
enum XedError error;
|
||||
error = xed_instruction_length_decode(
|
||||
xed_decoded_inst_zero_set_mode(&xedd, XED_MACHINE_MODE_REAL),
|
||||
gc(unbingx86op(codez)), strlen16(codez) + 16);
|
||||
return error == XED_ERROR_NONE ? xedd.decoded_length : -error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy mode instruction length decoder.
|
||||
*/
|
||||
testonly int ildlegacy(const char16_t *codez) {
|
||||
struct XedDecodedInst xedd;
|
||||
enum XedError error;
|
||||
error = xed_instruction_length_decode(
|
||||
xed_decoded_inst_zero_set_mode(&xedd, XED_MACHINE_MODE_LEGACY_32),
|
||||
gc(unbingx86op(codez)), strlen16(codez) + 16);
|
||||
return error == XED_ERROR_NONE ? xedd.decoded_length : -error;
|
||||
}
|
2794
test/libc/xed/x86ild_popular_binary_test.c
Normal file
2794
test/libc/xed/x86ild_popular_binary_test.c
Normal file
File diff suppressed because it is too large
Load diff
226
test/libc/xed/x86ild_popular_cmov_test.c
Normal file
226
test/libc/xed/x86ild_popular_cmov_test.c
Normal file
|
@ -0,0 +1,226 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "test/libc/xed/lib.h"
|
||||
#include "third_party/xed/x86.h"
|
||||
|
||||
TEST(x86ild, test_0F45C2) {
|
||||
/*
|
||||
ICLASS: CMOVNZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVNZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovnz eax, edx
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼E┬"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F47F8) {
|
||||
/*
|
||||
ICLASS: CMOVNBE
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVNBE_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovnbe edi, eax
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼G°"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_480F44F0) {
|
||||
/*
|
||||
ICLASS: CMOVZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovz rsi, rax
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H☼D≡"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F44C2) {
|
||||
/*
|
||||
ICLASS: CMOVZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovz eax, edx
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼D┬"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F47E8) {
|
||||
/*
|
||||
ICLASS: CMOVNBE
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVNBE_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovnbe ebp, eax
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼GΦ"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F45C3) {
|
||||
/*
|
||||
ICLASS: CMOVNZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVNZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovnz eax, ebx
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼E├"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F44C7) {
|
||||
/*
|
||||
ICLASS: CMOVZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovz eax, edi
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼D╟"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_480F44F2) {
|
||||
/*
|
||||
ICLASS: CMOVZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovz rsi, rdx
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H☼D≥"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_480F44C7) {
|
||||
/*
|
||||
ICLASS: CMOVZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovz rax, rdi
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H☼D╟"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_440F45F2) {
|
||||
/*
|
||||
ICLASS: CMOVNZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVNZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovnz r14d, edx
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"D☼E≥"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_440F45F0) {
|
||||
/*
|
||||
ICLASS: CMOVNZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVNZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovnz r14d, eax
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"D☼E≡"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F4DC8) {
|
||||
/*
|
||||
ICLASS: CMOVNL
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVNL_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovnl ecx, eax
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼M╚"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F46D8) {
|
||||
/*
|
||||
ICLASS: CMOVBE
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVBE_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovbe ebx, eax
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼F╪"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F46CF) {
|
||||
/*
|
||||
ICLASS: CMOVBE
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVBE_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovbe ecx, edi
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼F╧"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F46C1) {
|
||||
/*
|
||||
ICLASS: CMOVBE
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVBE_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovbe eax, ecx
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼F┴"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F45C6) {
|
||||
/*
|
||||
ICLASS: CMOVNZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVNZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovnz eax, esi
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼E╞"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_0F44D0) {
|
||||
/*
|
||||
ICLASS: CMOVZ
|
||||
CATEGORY: CMOV
|
||||
EXTENSION: BASE
|
||||
IFORM: CMOVZ_GPRv_GPRv
|
||||
ISA_SET: CMOV
|
||||
SHORT: cmovz edx, eax
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼D╨"));
|
||||
}
|
830
test/libc/xed/x86ild_popular_i186_test.c
Normal file
830
test/libc/xed/x86ild_popular_i186_test.c
Normal file
|
@ -0,0 +1,830 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "test/libc/xed/lib.h"
|
||||
#include "third_party/xed/x86.h"
|
||||
|
||||
/**
|
||||
* @fileoverview GCC's popular i186+ instruction w/ NexGen32e encoding.
|
||||
*/
|
||||
|
||||
TEST(x86ild, test_C0E800) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr al, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└Φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1EE00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr esi, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴ε "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1E000) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl rax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴α "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_66C1EE00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr si, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"f┴ε "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_486BC000) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: imul rax, rax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"Hk└ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1E000) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl eax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴α "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_486BED00) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: imul rbp, rbp, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"Hkφ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_69D000000000) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMz
|
||||
ISA_SET: I186
|
||||
SHORT: imul edx, eax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(6, ild(u"i╨ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1EA00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr rdx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴Ω "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C0EA00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr dl, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└Ω "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1E200) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl edx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴Γ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1E600) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl esi, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴μ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_66C1EA00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr dx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"f┴Ω "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_486BD200) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: imul rdx, rdx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"Hk╥ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C0EA83) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr dl, 0x83
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└Ωâ"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1E800) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr eax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴Φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1EA00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr edx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴Ω "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1E500) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl rbp, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴σ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_66C1E800) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr ax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"f┴Φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1E700) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl edi, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴τ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C0E900) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr cl, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└Θ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1E100) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl ecx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴ß "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1E200) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl rdx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴Γ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_40C0EE00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr sil, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"@└ε "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_69C000000000) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMz
|
||||
ISA_SET: I186
|
||||
SHORT: imul eax, eax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(6, ild(u"i└ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1E800) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr rax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴Φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C0E883) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr al, 0x83
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└Φâ"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1E100) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl rcx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴ß "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_4869C000000000) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMz
|
||||
ISA_SET: I186
|
||||
SHORT: imul rax, rax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(7, ild(u"Hi└ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1E700) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl rdi, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴τ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C0E800) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r8b, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A└Φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C0E8C0) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr al, 0xc0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└Φ└"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C0EA66) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr dl, 0x66
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└Ωf"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1E600) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl rsi, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴μ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C0E848) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr al, 0x48
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└ΦH"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_4869D200000000) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMz
|
||||
ISA_SET: I186
|
||||
SHORT: imul rdx, rdx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(7, ild(u"Hi╥ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1E900) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr ecx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴Θ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_40C0ED00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr bpl, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"@└φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1EF00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr edi, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴∩ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_66C1EF00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr di, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"f┴∩ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_486BCA00) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: imul rcx, rdx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"Hk╩ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1EA00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r10d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴Ω "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1E000) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl r8d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴α "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_40C0EF00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr dil, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"@└∩ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_49C1E000) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl r8, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"I┴α "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1E800) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r8d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴Φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1E200) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl r10d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴Γ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C0E900) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r9b, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A└Θ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C0EAC0) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPR8_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr dl, 0xc0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"└Ω└"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_66C1E900) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr cx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"f┴Θ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1F800) {
|
||||
/*
|
||||
ICLASS: SAR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SAR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: sar rax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴° "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1EB00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r11d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴δ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1E300) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl r11d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴π "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1ED00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr ebp, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1EB00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr ebx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴δ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_C1E500) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl ebp, 0x0
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"┴σ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_69D800000000) {
|
||||
/*
|
||||
ICLASS: IMUL
|
||||
CATEGORY: BINARY
|
||||
EXTENSION: BASE
|
||||
IFORM: IMUL_GPRv_GPRv_IMMz
|
||||
ISA_SET: I186
|
||||
SHORT: imul ebx, eax, 0x0
|
||||
*/
|
||||
ASSERT_EQ(6, ild(u"i╪ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_6641C1EE00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r14w, 0x0
|
||||
*/
|
||||
ASSERT_EQ(5, ild(u"fA┴ε "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_6641C1ED00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r13w, 0x0
|
||||
*/
|
||||
ASSERT_EQ(5, ild(u"fA┴φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_6641C1E800) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r8w, 0x0
|
||||
*/
|
||||
ASSERT_EQ(5, ild(u"fA┴Φ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_49C1E100) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl r9, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"I┴ß "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1FE74) {
|
||||
/*
|
||||
ICLASS: SAR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SAR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: sar rsi, 0x74
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴■t"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1FE00) {
|
||||
/*
|
||||
ICLASS: SAR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SAR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: sar rsi, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴■ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_48C1FB00) {
|
||||
/*
|
||||
ICLASS: SAR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SAR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: sar rbx, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"H┴√ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1EE00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r14d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴ε "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1EC00) {
|
||||
/*
|
||||
ICLASS: SHR
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHR_GPRv_IMMb
|
||||
ISA_SET: I186
|
||||
SHORT: shr r12d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴∞ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_41C1E700) {
|
||||
/*
|
||||
ICLASS: SHL
|
||||
CATEGORY: SHIFT
|
||||
EXTENSION: BASE
|
||||
IFORM: SHL_GPRv_IMMb_C1r4
|
||||
ISA_SET: I186
|
||||
SHORT: shl r15d, 0x0
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"A┴τ "));
|
||||
}
|
1754
test/libc/xed/x86ild_popular_i386_test.c
Normal file
1754
test/libc/xed/x86ild_popular_i386_test.c
Normal file
File diff suppressed because it is too large
Load diff
7426
test/libc/xed/x86ild_popular_i86_test.c
Normal file
7426
test/libc/xed/x86ild_popular_i86_test.c
Normal file
File diff suppressed because it is too large
Load diff
2206
test/libc/xed/x86ild_popular_logical_test.c
Normal file
2206
test/libc/xed/x86ild_popular_logical_test.c
Normal file
File diff suppressed because it is too large
Load diff
1930
test/libc/xed/x86ild_popular_misc_test.c
Normal file
1930
test/libc/xed/x86ild_popular_misc_test.c
Normal file
File diff suppressed because it is too large
Load diff
99
test/libc/xed/x86ild_test.c
Normal file
99
test/libc/xed/x86ild_test.c
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "test/libc/xed/lib.h"
|
||||
#include "third_party/xed/x86.h"
|
||||
|
||||
/**
|
||||
* @fileoverview Instruction Length Decoding Tests.
|
||||
*
|
||||
* It is demonstrated that our 3.5kb x86 parser supports all legal x86
|
||||
* instruction set architectures and addressing modes since the 1970's,
|
||||
* including the really complicated ones, e.g. avx512; or the unpopular
|
||||
* ones, e.g. amd 3dnow.
|
||||
*/
|
||||
|
||||
TEST(x86ild, testSomeThingsNeverChange) {
|
||||
ASSERT_EQ(3, ildreal(u"â└↨")); /* add $23,%ax */
|
||||
ASSERT_EQ(3, ildlegacy(u"â└↨")); /* add $23,%eax */
|
||||
ASSERT_EQ(3, ild(u"â└↨")); /* add $23,%eax */
|
||||
}
|
||||
|
||||
TEST(x86ild, testSomeThingsDoChange) {
|
||||
ASSERT_EQ(3, ildreal(u"♣7‼ÉÉ")); /* add $0x1337,%ax */
|
||||
ASSERT_EQ(5, ildlegacy(u"♣7‼ÉÉ")); /* add $0x90901337,%eax */
|
||||
ASSERT_EQ(5, ild(u"♣7‼ÉÉ")); /* add $0x90901337,%eax */
|
||||
ASSERT_EQ(1, ildreal(u"@É")); /* inc %ax */
|
||||
ASSERT_EQ(1, ildlegacy(u"@É")); /* inc %eax */
|
||||
ASSERT_EQ(2, ild(u"@É")); /* rex xchg %eax,%eax */
|
||||
}
|
||||
|
||||
TEST(x86ild, testHugeInstructions) {
|
||||
ASSERT_EQ(10, ild(u"H║ Ç")); /* movabs $0x8000000000000000,%rdx */
|
||||
ASSERT_EQ(11, ild(u"H╟♣8l É ")); /* movq $0x209000,0x6c38(%rip) */
|
||||
ASSERT_EQ(12, ild(u"H╟ä$á ")); /* movq $0x0,0xa0(%rsp) */
|
||||
}
|
||||
|
||||
TEST(x86ild, testLaughOutLoudLargeCanonicalInstructions) {
|
||||
ASSERT_EQ(15, /* lock addl $0x12331337,%fs:-0x1337(%ebx,%esi,1) */
|
||||
ildreal(u"≡dfgüä3╔∞λλ7‼3↕"));
|
||||
}
|
||||
|
||||
TEST(x86ild, testEncodingDisagreements) {
|
||||
ASSERT_EQ(13, /* lock addw $0x1337,%fs:-0x1337(%ebx,%esi,1) */
|
||||
ild(u"fg≡düä3╔∞λλ7‼")); /* ← xed encoding */
|
||||
ASSERT_EQ(13, /* lock addw $0x1337,%fs:-0x1337(%ebx,%esi,1) */
|
||||
ild(u"dgf≡üä3╔∞λλ7‼")); /* ← gas encoding */
|
||||
}
|
||||
|
||||
TEST(x86ild, testOverlongInstructions) {
|
||||
ASSERT_EQ(3, ild(u"≤≤É")); /* rep pause */
|
||||
ASSERT_EQ(-XED_ERROR_BUFFER_TOO_SHORT /* suboptimal error code */,
|
||||
ildreal(u"≡≡≡≡dfgüä3╔∞λλ7‼3↕"));
|
||||
}
|
||||
|
||||
TEST(x86ild, testAvx512_inRealMode_throwsError) {
|
||||
ASSERT_EQ(-XED_ERROR_INVALID_MODE, ildreal(u"bßTXYö∟¶♦ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, testAvx512) {
|
||||
ASSERT_EQ(6, /* vaddps %zmm17,%zmm16,%zmm16 */
|
||||
ild(u"b¡|@X┴"));
|
||||
ASSERT_EQ(11, /* vmulps 0x414(%rsp,%rbx,1){1to16},%zmm5,%zmm18 */
|
||||
ild(u"bßTXYö∟¶♦ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, testCascadeLake_advancedNeuralNetworkInstructions) {
|
||||
ASSERT_EQ(6, ild(u"b≥m◘P╦")); /* vpdpbusd %xmm3,%xmm2,%xmm1 */
|
||||
ASSERT_EQ(11 /* vpdpbusd 0x10000000(%rcx,%r14,8),%xmm2,%xmm1 */,
|
||||
ild(u"b▓m◘Pî± ►"));
|
||||
}
|
||||
|
||||
TEST(x86ild, testAmd3dnow) {
|
||||
ASSERT_EQ(4, ild(u"☼☼╚ª")); /* pfrcpit1 %mm0,%mm1 */
|
||||
struct XedDecodedInst xedd;
|
||||
ASSERT_EQ(
|
||||
0, xed_instruction_length_decode(
|
||||
xed_decoded_inst_zero_set_mode(&xedd, XED_MACHINE_MODE_LEGACY_32),
|
||||
gc(unbingx86op(u"☼☼╚ª")), 4));
|
||||
ASSERT_EQ(true, xedd.operands.amd3dnow);
|
||||
ASSERT_EQ(0xa6, xedd.operands.nominal_opcode);
|
||||
}
|
106
test/libc/xed/x86ild_widenop_test.c
Normal file
106
test/libc/xed/x86ild_widenop_test.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "test/libc/xed/lib.h"
|
||||
#include "third_party/xed/x86.h"
|
||||
|
||||
/**
|
||||
* @fileoverview Hefty NOPs.
|
||||
*/
|
||||
|
||||
TEST(x86ild, test_nop9_660F1F840000000000) {
|
||||
/*
|
||||
ICLASS: NOP
|
||||
CATEGORY: WIDENOP
|
||||
EXTENSION: BASE
|
||||
IFORM: NOP_MEMv_GPRv_0F1F
|
||||
ISA_SET: FAT_NOP
|
||||
SHORT: nop word ptr [rax+rax*1], ax
|
||||
*/
|
||||
ASSERT_EQ(9, ild(u"f☼▼ä "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_nop8_0F1F840000000000) {
|
||||
/* nopl 0x00000000(%rax,%rax,1) */
|
||||
ASSERT_EQ(8, ild(u"☼▼ä "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_nop7_0F1F8000000000) {
|
||||
/* nopl 0x00000000(%rax) */
|
||||
ASSERT_EQ(7, ild(u"☼▼Ç "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_nop6_660F1F440000) {
|
||||
/*
|
||||
ICLASS: NOP
|
||||
CATEGORY: WIDENOP
|
||||
EXTENSION: BASE
|
||||
IFORM: NOP_MEMv_GPRv_0F1F
|
||||
ISA_SET: FAT_NOP
|
||||
SHORT: nop word ptr [rax+rax*1], ax
|
||||
*/
|
||||
ASSERT_EQ(6, ild(u"f☼▼D "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_nop5_0F1F440000) {
|
||||
/*
|
||||
ICLASS: NOP
|
||||
CATEGORY: WIDENOP
|
||||
EXTENSION: BASE
|
||||
IFORM: NOP_MEMv_GPRv_0F1F
|
||||
ISA_SET: FAT_NOP
|
||||
SHORT: nop dword ptr [rax+rax*1], eax
|
||||
*/
|
||||
ASSERT_EQ(5, ild(u"☼▼D "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_nop4_0F1F4000) {
|
||||
/*
|
||||
ICLASS: NOP
|
||||
CATEGORY: WIDENOP
|
||||
EXTENSION: BASE
|
||||
IFORM: NOP_MEMv_GPRv_0F1F
|
||||
ISA_SET: FAT_NOP
|
||||
SHORT: nop dword ptr [rax], eax
|
||||
*/
|
||||
ASSERT_EQ(4, ild(u"☼▼@ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_nop3_0F1F00) {
|
||||
/*
|
||||
ICLASS: NOP
|
||||
CATEGORY: WIDENOP
|
||||
EXTENSION: BASE
|
||||
IFORM: NOP_MEMv_GPRv_0F1F
|
||||
ISA_SET: FAT_NOP
|
||||
SHORT: nop dword ptr [rax], eax
|
||||
*/
|
||||
ASSERT_EQ(3, ild(u"☼▼ "));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_nop2_6690) {
|
||||
/* xchg %ax,%ax */
|
||||
ASSERT_EQ(2, ild(u"fÉ"));
|
||||
}
|
||||
|
||||
TEST(x86ild, test_nop1_90) {
|
||||
/* xchg %eax,%eax */
|
||||
ASSERT_EQ(1, ild(u"É"));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue