asmjit 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +5 -3
- data/asmjit.gemspec +1 -3
- data/ext/asmjit/asmjit/.editorconfig +10 -0
- data/ext/asmjit/asmjit/.github/FUNDING.yml +1 -0
- data/ext/asmjit/asmjit/.github/workflows/build-config.json +47 -0
- data/ext/asmjit/asmjit/.github/workflows/build.yml +156 -0
- data/ext/asmjit/asmjit/.gitignore +6 -0
- data/ext/asmjit/asmjit/CMakeLists.txt +611 -0
- data/ext/asmjit/asmjit/LICENSE.md +17 -0
- data/ext/asmjit/asmjit/README.md +69 -0
- data/ext/asmjit/asmjit/src/asmjit/a64.h +62 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64archtraits_p.h +81 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.cpp +5115 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.h +72 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.cpp +51 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.h +57 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.cpp +60 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.h +247 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper.cpp +464 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper_p.h +50 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emitter.h +1228 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter.cpp +298 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter_p.h +59 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64func.cpp +189 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64func_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64globals.h +1894 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi.cpp +278 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi_p.h +41 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.cpp +1957 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.h +74 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb_p.h +876 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.cpp +85 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.h +312 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass.cpp +852 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass_p.h +105 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64utils.h +179 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armformatter.cpp +143 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armformatter_p.h +44 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armglobals.h +21 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armoperand.h +621 -0
- data/ext/asmjit/asmjit/src/asmjit/arm.h +62 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-begin.h +17 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-end.h +9 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/core/api-build_p.h +55 -0
- data/ext/asmjit/asmjit/src/asmjit/core/api-config.h +613 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archcommons.h +229 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archtraits.cpp +160 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archtraits.h +290 -0
- data/ext/asmjit/asmjit/src/asmjit/core/assembler.cpp +406 -0
- data/ext/asmjit/asmjit/src/asmjit/core/assembler.h +129 -0
- data/ext/asmjit/asmjit/src/asmjit/core/builder.cpp +889 -0
- data/ext/asmjit/asmjit/src/asmjit/core/builder.h +1391 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codebuffer.h +113 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codeholder.cpp +1149 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codeholder.h +1035 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codewriter.cpp +175 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codewriter_p.h +179 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compiler.cpp +582 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compiler.h +737 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compilerdefs.h +173 -0
- data/ext/asmjit/asmjit/src/asmjit/core/constpool.cpp +363 -0
- data/ext/asmjit/asmjit/src/asmjit/core/constpool.h +250 -0
- data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.cpp +1162 -0
- data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.h +813 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emithelper.cpp +323 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emithelper_p.h +58 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitter.cpp +333 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitter.h +741 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitterutils.cpp +129 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitterutils_p.h +89 -0
- data/ext/asmjit/asmjit/src/asmjit/core/environment.cpp +46 -0
- data/ext/asmjit/asmjit/src/asmjit/core/environment.h +508 -0
- data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.cpp +14 -0
- data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.h +228 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter.cpp +584 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter.h +247 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter_p.h +34 -0
- data/ext/asmjit/asmjit/src/asmjit/core/func.cpp +286 -0
- data/ext/asmjit/asmjit/src/asmjit/core/func.h +1445 -0
- data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext.cpp +293 -0
- data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext_p.h +199 -0
- data/ext/asmjit/asmjit/src/asmjit/core/globals.cpp +133 -0
- data/ext/asmjit/asmjit/src/asmjit/core/globals.h +393 -0
- data/ext/asmjit/asmjit/src/asmjit/core/inst.cpp +113 -0
- data/ext/asmjit/asmjit/src/asmjit/core/inst.h +772 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.cpp +1242 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.h +261 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.cpp +80 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.h +89 -0
- data/ext/asmjit/asmjit/src/asmjit/core/logger.cpp +69 -0
- data/ext/asmjit/asmjit/src/asmjit/core/logger.h +198 -0
- data/ext/asmjit/asmjit/src/asmjit/core/misc_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/core/operand.cpp +132 -0
- data/ext/asmjit/asmjit/src/asmjit/core/operand.h +1611 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils.cpp +84 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils.h +61 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils_p.h +68 -0
- data/ext/asmjit/asmjit/src/asmjit/core/raassignment_p.h +418 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rabuilders_p.h +612 -0
- data/ext/asmjit/asmjit/src/asmjit/core/radefs_p.h +1204 -0
- data/ext/asmjit/asmjit/src/asmjit/core/ralocal.cpp +1166 -0
- data/ext/asmjit/asmjit/src/asmjit/core/ralocal_p.h +254 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rapass.cpp +1969 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rapass_p.h +1183 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rastack.cpp +184 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rastack_p.h +171 -0
- data/ext/asmjit/asmjit/src/asmjit/core/string.cpp +559 -0
- data/ext/asmjit/asmjit/src/asmjit/core/string.h +372 -0
- data/ext/asmjit/asmjit/src/asmjit/core/support.cpp +494 -0
- data/ext/asmjit/asmjit/src/asmjit/core/support.h +1773 -0
- data/ext/asmjit/asmjit/src/asmjit/core/target.cpp +14 -0
- data/ext/asmjit/asmjit/src/asmjit/core/target.h +53 -0
- data/ext/asmjit/asmjit/src/asmjit/core/type.cpp +74 -0
- data/ext/asmjit/asmjit/src/asmjit/core/type.h +419 -0
- data/ext/asmjit/asmjit/src/asmjit/core/virtmem.cpp +722 -0
- data/ext/asmjit/asmjit/src/asmjit/core/virtmem.h +242 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zone.cpp +353 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zone.h +615 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonehash.cpp +309 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonehash.h +186 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonelist.cpp +163 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonelist.h +209 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestack.cpp +176 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestack.h +239 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestring.h +120 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonetree.cpp +99 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonetree.h +380 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonevector.cpp +356 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonevector.h +690 -0
- data/ext/asmjit/asmjit/src/asmjit/core.h +1861 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86archtraits_p.h +148 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.cpp +5110 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.h +685 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.cpp +52 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.h +351 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.cpp +61 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.h +721 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper.cpp +619 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper_p.h +60 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emitter.h +4315 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter.cpp +944 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter_p.h +58 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86func.cpp +503 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86func_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86globals.h +2169 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi.cpp +1732 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi_p.h +41 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.cpp +4427 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.h +563 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb_p.h +311 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86opcode_p.h +436 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.cpp +231 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.h +1085 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass.cpp +1509 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass_p.h +94 -0
- data/ext/asmjit/asmjit/src/asmjit/x86.h +93 -0
- data/ext/asmjit/asmjit/src/asmjit.natvis +245 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler.cpp +84 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler.h +85 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_a64.cpp +4006 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_x64.cpp +17833 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_x86.cpp +8300 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler.cpp +253 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler.h +73 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler_a64.cpp +690 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler_x86.cpp +4317 -0
- data/ext/asmjit/asmjit/test/asmjit_test_emitters.cpp +197 -0
- data/ext/asmjit/asmjit/test/asmjit_test_instinfo.cpp +181 -0
- data/ext/asmjit/asmjit/test/asmjit_test_misc.h +257 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf.cpp +62 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf.h +61 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf_a64.cpp +699 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf_x86.cpp +5032 -0
- data/ext/asmjit/asmjit/test/asmjit_test_unit.cpp +172 -0
- data/ext/asmjit/asmjit/test/asmjit_test_x86_sections.cpp +172 -0
- data/ext/asmjit/asmjit/test/asmjitutils.h +38 -0
- data/ext/asmjit/asmjit/test/broken.cpp +312 -0
- data/ext/asmjit/asmjit/test/broken.h +148 -0
- data/ext/asmjit/asmjit/test/cmdline.h +61 -0
- data/ext/asmjit/asmjit/test/performancetimer.h +41 -0
- data/ext/asmjit/asmjit/tools/configure-makefiles.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-ninja.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-sanitizers.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-vs2019-x64.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2019-x86.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2022-x64.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2022-x86.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-xcode.sh +8 -0
- data/ext/asmjit/asmjit/tools/enumgen.js +417 -0
- data/ext/asmjit/asmjit/tools/enumgen.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen-arm.js +365 -0
- data/ext/asmjit/asmjit/tools/tablegen-arm.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen-x86.js +2638 -0
- data/ext/asmjit/asmjit/tools/tablegen-x86.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen.js +947 -0
- data/ext/asmjit/asmjit/tools/tablegen.sh +4 -0
- data/ext/asmjit/asmjit.cc +167 -30
- data/ext/asmjit/extconf.rb +9 -9
- data/lib/asmjit/version.rb +1 -1
- data/lib/asmjit.rb +14 -4
- metadata +198 -17
@@ -0,0 +1,944 @@
|
|
1
|
+
// This file is part of AsmJit project <https://asmjit.com>
|
2
|
+
//
|
3
|
+
// See asmjit.h or LICENSE.md for license and copyright information
|
4
|
+
// SPDX-License-Identifier: Zlib
|
5
|
+
|
6
|
+
#include "../core/api-build_p.h"
|
7
|
+
#ifndef ASMJIT_NO_LOGGING
|
8
|
+
|
9
|
+
#include "../core/cpuinfo.h"
|
10
|
+
#include "../core/misc_p.h"
|
11
|
+
#include "../core/support.h"
|
12
|
+
#include "../x86/x86formatter_p.h"
|
13
|
+
#include "../x86/x86instapi_p.h"
|
14
|
+
#include "../x86/x86instdb_p.h"
|
15
|
+
#include "../x86/x86operand.h"
|
16
|
+
|
17
|
+
#ifndef ASMJIT_NO_COMPILER
|
18
|
+
#include "../core/compiler.h"
|
19
|
+
#endif
|
20
|
+
|
21
|
+
ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
22
|
+
|
23
|
+
// x86::FormatterInternal - Constants
|
24
|
+
// ==================================
|
25
|
+
|
26
|
+
struct RegFormatInfo {
|
27
|
+
struct TypeEntry {
|
28
|
+
uint8_t index;
|
29
|
+
};
|
30
|
+
|
31
|
+
struct NameEntry {
|
32
|
+
uint8_t count;
|
33
|
+
uint8_t formatIndex;
|
34
|
+
uint8_t specialIndex;
|
35
|
+
uint8_t specialCount;
|
36
|
+
};
|
37
|
+
|
38
|
+
TypeEntry typeEntries[uint32_t(RegType::kMaxValue) + 1];
|
39
|
+
char typeStrings[128 - 32];
|
40
|
+
|
41
|
+
NameEntry nameEntries[uint32_t(RegType::kMaxValue) + 1];
|
42
|
+
char nameStrings[280];
|
43
|
+
};
|
44
|
+
|
45
|
+
template<uint32_t X>
|
46
|
+
struct RegFormatInfo_T {
|
47
|
+
enum {
|
48
|
+
kTypeIndex = X == uint32_t(RegType::kX86_GpbLo) ? 1 :
|
49
|
+
X == uint32_t(RegType::kX86_GpbHi) ? 8 :
|
50
|
+
X == uint32_t(RegType::kX86_Gpw ) ? 15 :
|
51
|
+
X == uint32_t(RegType::kX86_Gpd ) ? 19 :
|
52
|
+
X == uint32_t(RegType::kX86_Gpq ) ? 23 :
|
53
|
+
X == uint32_t(RegType::kX86_Xmm ) ? 27 :
|
54
|
+
X == uint32_t(RegType::kX86_Ymm ) ? 31 :
|
55
|
+
X == uint32_t(RegType::kX86_Zmm ) ? 35 :
|
56
|
+
X == uint32_t(RegType::kX86_Mm ) ? 50 :
|
57
|
+
X == uint32_t(RegType::kX86_KReg ) ? 53 :
|
58
|
+
X == uint32_t(RegType::kX86_SReg ) ? 43 :
|
59
|
+
X == uint32_t(RegType::kX86_CReg ) ? 59 :
|
60
|
+
X == uint32_t(RegType::kX86_DReg ) ? 62 :
|
61
|
+
X == uint32_t(RegType::kX86_St ) ? 47 :
|
62
|
+
X == uint32_t(RegType::kX86_Bnd ) ? 55 :
|
63
|
+
X == uint32_t(RegType::kX86_Tmm ) ? 65 :
|
64
|
+
X == uint32_t(RegType::kX86_Rip ) ? 39 : 0,
|
65
|
+
|
66
|
+
kFormatIndex = X == uint32_t(RegType::kX86_GpbLo) ? 1 :
|
67
|
+
X == uint32_t(RegType::kX86_GpbHi) ? 6 :
|
68
|
+
X == uint32_t(RegType::kX86_Gpw ) ? 11 :
|
69
|
+
X == uint32_t(RegType::kX86_Gpd ) ? 16 :
|
70
|
+
X == uint32_t(RegType::kX86_Gpq ) ? 21 :
|
71
|
+
X == uint32_t(RegType::kX86_Xmm ) ? 25 :
|
72
|
+
X == uint32_t(RegType::kX86_Ymm ) ? 31 :
|
73
|
+
X == uint32_t(RegType::kX86_Zmm ) ? 37 :
|
74
|
+
X == uint32_t(RegType::kX86_Mm ) ? 60 :
|
75
|
+
X == uint32_t(RegType::kX86_KReg ) ? 65 :
|
76
|
+
X == uint32_t(RegType::kX86_SReg ) ? 49 :
|
77
|
+
X == uint32_t(RegType::kX86_CReg ) ? 75 :
|
78
|
+
X == uint32_t(RegType::kX86_DReg ) ? 80 :
|
79
|
+
X == uint32_t(RegType::kX86_St ) ? 55 :
|
80
|
+
X == uint32_t(RegType::kX86_Bnd ) ? 69 :
|
81
|
+
X == uint32_t(RegType::kX86_Tmm ) ? 89 :
|
82
|
+
X == uint32_t(RegType::kX86_Rip ) ? 43 : 0,
|
83
|
+
|
84
|
+
kSpecialIndex = X == uint32_t(RegType::kX86_GpbLo) ? 96 :
|
85
|
+
X == uint32_t(RegType::kX86_GpbHi) ? 128 :
|
86
|
+
X == uint32_t(RegType::kX86_Gpw ) ? 161 :
|
87
|
+
X == uint32_t(RegType::kX86_Gpd ) ? 160 :
|
88
|
+
X == uint32_t(RegType::kX86_Gpq ) ? 192 :
|
89
|
+
X == uint32_t(RegType::kX86_SReg ) ? 224 :
|
90
|
+
X == uint32_t(RegType::kX86_Rip ) ? 85 : 0,
|
91
|
+
|
92
|
+
kSpecialCount = X == uint32_t(RegType::kX86_GpbLo) ? 8 :
|
93
|
+
X == uint32_t(RegType::kX86_GpbHi) ? 4 :
|
94
|
+
X == uint32_t(RegType::kX86_Gpw ) ? 8 :
|
95
|
+
X == uint32_t(RegType::kX86_Gpd ) ? 8 :
|
96
|
+
X == uint32_t(RegType::kX86_Gpq ) ? 8 :
|
97
|
+
X == uint32_t(RegType::kX86_SReg ) ? 7 :
|
98
|
+
X == uint32_t(RegType::kX86_Rip ) ? 1 : 0
|
99
|
+
};
|
100
|
+
};
|
101
|
+
|
102
|
+
#define ASMJIT_REG_TYPE_ENTRY(TYPE) { \
|
103
|
+
RegFormatInfo_T<TYPE>::kTypeIndex \
|
104
|
+
}
|
105
|
+
|
106
|
+
#define ASMJIT_REG_NAME_ENTRY(TYPE) { \
|
107
|
+
RegTraits<RegType(TYPE)>::kCount, \
|
108
|
+
RegFormatInfo_T<TYPE>::kFormatIndex, \
|
109
|
+
RegFormatInfo_T<TYPE>::kSpecialIndex, \
|
110
|
+
RegFormatInfo_T<TYPE>::kSpecialCount \
|
111
|
+
}
|
112
|
+
|
113
|
+
static const RegFormatInfo x86RegFormatInfo = {
|
114
|
+
// Register type entries and strings.
|
115
|
+
{ ASMJIT_LOOKUP_TABLE_32(ASMJIT_REG_TYPE_ENTRY, 0) },
|
116
|
+
|
117
|
+
"\0" // #0
|
118
|
+
"gpb\0\0\0\0" // #1
|
119
|
+
"gpb.hi\0" // #8
|
120
|
+
"gpw\0" // #15
|
121
|
+
"gpd\0" // #19
|
122
|
+
"gpq\0" // #23
|
123
|
+
"xmm\0" // #27
|
124
|
+
"ymm\0" // #31
|
125
|
+
"zmm\0" // #35
|
126
|
+
"rip\0" // #39
|
127
|
+
"seg\0" // #43
|
128
|
+
"st\0" // #47
|
129
|
+
"mm\0" // #50
|
130
|
+
"k\0" // #53
|
131
|
+
"bnd\0" // #55
|
132
|
+
"cr\0" // #59
|
133
|
+
"dr\0" // #62
|
134
|
+
"tmm\0" // #65
|
135
|
+
,
|
136
|
+
|
137
|
+
// Register name entries and strings.
|
138
|
+
{ ASMJIT_LOOKUP_TABLE_32(ASMJIT_REG_NAME_ENTRY, 0) },
|
139
|
+
|
140
|
+
"\0"
|
141
|
+
"r%ub\0" // #1
|
142
|
+
"r%uh\0" // #6
|
143
|
+
"r%uw\0" // #11
|
144
|
+
"r%ud\0" // #16
|
145
|
+
"r%u\0" // #21
|
146
|
+
"xmm%u\0" // #25
|
147
|
+
"ymm%u\0" // #31
|
148
|
+
"zmm%u\0" // #37
|
149
|
+
"rip%u\0" // #43
|
150
|
+
"seg%u\0" // #49
|
151
|
+
"st%u\0" // #55
|
152
|
+
"mm%u\0" // #60
|
153
|
+
"k%u\0" // #65
|
154
|
+
"bnd%u\0" // #69
|
155
|
+
"cr%u\0" // #75
|
156
|
+
"dr%u\0" // #80
|
157
|
+
|
158
|
+
"rip\0" // #85
|
159
|
+
"tmm%u\0" // #89
|
160
|
+
"\0" // #95
|
161
|
+
|
162
|
+
"al\0\0" "cl\0\0" "dl\0\0" "bl\0\0" "spl\0" "bpl\0" "sil\0" "dil\0" // #96
|
163
|
+
"ah\0\0" "ch\0\0" "dh\0\0" "bh\0\0" "n/a\0" "n/a\0" "n/a\0" "n/a\0" // #128
|
164
|
+
"eax\0" "ecx\0" "edx\0" "ebx\0" "esp\0" "ebp\0" "esi\0" "edi\0" // #160
|
165
|
+
"rax\0" "rcx\0" "rdx\0" "rbx\0" "rsp\0" "rbp\0" "rsi\0" "rdi\0" // #192
|
166
|
+
"n/a\0" "es\0\0" "cs\0\0" "ss\0\0" "ds\0\0" "fs\0\0" "gs\0\0" "n/a\0" // #224
|
167
|
+
};
|
168
|
+
#undef ASMJIT_REG_NAME_ENTRY
|
169
|
+
#undef ASMJIT_REG_TYPE_ENTRY
|
170
|
+
|
171
|
+
static const char* x86GetAddressSizeString(uint32_t size) noexcept {
|
172
|
+
switch (size) {
|
173
|
+
case 1 : return "byte ptr ";
|
174
|
+
case 2 : return "word ptr ";
|
175
|
+
case 4 : return "dword ptr ";
|
176
|
+
case 6 : return "fword ptr ";
|
177
|
+
case 8 : return "qword ptr ";
|
178
|
+
case 10: return "tbyte ptr ";
|
179
|
+
case 16: return "xmmword ptr ";
|
180
|
+
case 32: return "ymmword ptr ";
|
181
|
+
case 64: return "zmmword ptr ";
|
182
|
+
default: return "";
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
// x86::FormatterInternal - Format FeatureId
|
187
|
+
// =========================================
|
188
|
+
|
189
|
+
Error FormatterInternal::formatFeature(String& sb, uint32_t featureId) noexcept {
|
190
|
+
// @EnumStringBegin{"enum": "CpuFeatures::X86", "output": "sFeature", "strip": "k"}@
|
191
|
+
static const char sFeatureString[] =
|
192
|
+
"None\0"
|
193
|
+
"MT\0"
|
194
|
+
"NX\0"
|
195
|
+
"3DNOW\0"
|
196
|
+
"3DNOW2\0"
|
197
|
+
"ADX\0"
|
198
|
+
"AESNI\0"
|
199
|
+
"ALTMOVCR8\0"
|
200
|
+
"AMX_BF16\0"
|
201
|
+
"AMX_INT8\0"
|
202
|
+
"AMX_TILE\0"
|
203
|
+
"AVX\0"
|
204
|
+
"AVX2\0"
|
205
|
+
"AVX512_4FMAPS\0"
|
206
|
+
"AVX512_4VNNIW\0"
|
207
|
+
"AVX512_BF16\0"
|
208
|
+
"AVX512_BITALG\0"
|
209
|
+
"AVX512_BW\0"
|
210
|
+
"AVX512_CDI\0"
|
211
|
+
"AVX512_DQ\0"
|
212
|
+
"AVX512_ERI\0"
|
213
|
+
"AVX512_F\0"
|
214
|
+
"AVX512_FP16\0"
|
215
|
+
"AVX512_IFMA\0"
|
216
|
+
"AVX512_PFI\0"
|
217
|
+
"AVX512_VBMI\0"
|
218
|
+
"AVX512_VBMI2\0"
|
219
|
+
"AVX512_VL\0"
|
220
|
+
"AVX512_VNNI\0"
|
221
|
+
"AVX512_VP2INTERSECT\0"
|
222
|
+
"AVX512_VPOPCNTDQ\0"
|
223
|
+
"AVX_VNNI\0"
|
224
|
+
"BMI\0"
|
225
|
+
"BMI2\0"
|
226
|
+
"CET_IBT\0"
|
227
|
+
"CET_SS\0"
|
228
|
+
"CLDEMOTE\0"
|
229
|
+
"CLFLUSH\0"
|
230
|
+
"CLFLUSHOPT\0"
|
231
|
+
"CLWB\0"
|
232
|
+
"CLZERO\0"
|
233
|
+
"CMOV\0"
|
234
|
+
"CMPXCHG16B\0"
|
235
|
+
"CMPXCHG8B\0"
|
236
|
+
"ENCLV\0"
|
237
|
+
"ENQCMD\0"
|
238
|
+
"ERMS\0"
|
239
|
+
"F16C\0"
|
240
|
+
"FMA\0"
|
241
|
+
"FMA4\0"
|
242
|
+
"FPU\0"
|
243
|
+
"FSGSBASE\0"
|
244
|
+
"FXSR\0"
|
245
|
+
"FXSROPT\0"
|
246
|
+
"GEODE\0"
|
247
|
+
"GFNI\0"
|
248
|
+
"HLE\0"
|
249
|
+
"HRESET\0"
|
250
|
+
"I486\0"
|
251
|
+
"LAHFSAHF\0"
|
252
|
+
"LWP\0"
|
253
|
+
"LZCNT\0"
|
254
|
+
"MCOMMIT\0"
|
255
|
+
"MMX\0"
|
256
|
+
"MMX2\0"
|
257
|
+
"MONITOR\0"
|
258
|
+
"MONITORX\0"
|
259
|
+
"MOVBE\0"
|
260
|
+
"MOVDIR64B\0"
|
261
|
+
"MOVDIRI\0"
|
262
|
+
"MPX\0"
|
263
|
+
"MSR\0"
|
264
|
+
"MSSE\0"
|
265
|
+
"OSXSAVE\0"
|
266
|
+
"OSPKE\0"
|
267
|
+
"PCLMULQDQ\0"
|
268
|
+
"PCONFIG\0"
|
269
|
+
"POPCNT\0"
|
270
|
+
"PREFETCHW\0"
|
271
|
+
"PREFETCHWT1\0"
|
272
|
+
"PTWRITE\0"
|
273
|
+
"RDPID\0"
|
274
|
+
"RDPRU\0"
|
275
|
+
"RDRAND\0"
|
276
|
+
"RDSEED\0"
|
277
|
+
"RDTSC\0"
|
278
|
+
"RDTSCP\0"
|
279
|
+
"RTM\0"
|
280
|
+
"SERIALIZE\0"
|
281
|
+
"SHA\0"
|
282
|
+
"SKINIT\0"
|
283
|
+
"SMAP\0"
|
284
|
+
"SMEP\0"
|
285
|
+
"SMX\0"
|
286
|
+
"SNP\0"
|
287
|
+
"SSE\0"
|
288
|
+
"SSE2\0"
|
289
|
+
"SSE3\0"
|
290
|
+
"SSE4_1\0"
|
291
|
+
"SSE4_2\0"
|
292
|
+
"SSE4A\0"
|
293
|
+
"SSSE3\0"
|
294
|
+
"SVM\0"
|
295
|
+
"TBM\0"
|
296
|
+
"TSX\0"
|
297
|
+
"TSXLDTRK\0"
|
298
|
+
"UINTR\0"
|
299
|
+
"VAES\0"
|
300
|
+
"VMX\0"
|
301
|
+
"VPCLMULQDQ\0"
|
302
|
+
"WAITPKG\0"
|
303
|
+
"WBNOINVD\0"
|
304
|
+
"XOP\0"
|
305
|
+
"XSAVE\0"
|
306
|
+
"XSAVEC\0"
|
307
|
+
"XSAVEOPT\0"
|
308
|
+
"XSAVES\0"
|
309
|
+
"<Unknown>\0";
|
310
|
+
|
311
|
+
static const uint16_t sFeatureIndex[] = {
|
312
|
+
0, 5, 8, 11, 17, 24, 28, 34, 44, 53, 62, 71, 75, 80, 94, 108, 120, 134, 144,
|
313
|
+
155, 165, 176, 185, 197, 209, 220, 232, 245, 255, 267, 287, 304, 313, 317,
|
314
|
+
322, 330, 337, 346, 354, 365, 370, 377, 382, 393, 403, 409, 416, 421, 426,
|
315
|
+
430, 435, 439, 448, 453, 461, 467, 472, 476, 483, 488, 497, 501, 507, 515,
|
316
|
+
519, 524, 532, 541, 547, 557, 565, 569, 573, 578, 586, 592, 602, 610, 617,
|
317
|
+
627, 639, 647, 653, 659, 666, 673, 679, 686, 690, 700, 704, 711, 716, 721,
|
318
|
+
725, 729, 733, 738, 743, 750, 757, 763, 769, 773, 777, 781, 790, 796, 801,
|
319
|
+
805, 816, 824, 833, 837, 843, 850, 859, 866
|
320
|
+
};
|
321
|
+
// @EnumStringEnd@
|
322
|
+
|
323
|
+
return sb.append(sFeatureString + sFeatureIndex[Support::min<uint32_t>(featureId, uint32_t(CpuFeatures::X86::kMaxValue) + 1)]);
|
324
|
+
}
|
325
|
+
|
326
|
+
// x86::FormatterInternal - Format Register
|
327
|
+
// ========================================
|
328
|
+
|
329
|
+
ASMJIT_FAVOR_SIZE Error FormatterInternal::formatRegister(String& sb, FormatFlags formatFlags, const BaseEmitter* emitter, Arch arch, RegType type, uint32_t id) noexcept {
|
330
|
+
DebugUtils::unused(arch);
|
331
|
+
const RegFormatInfo& info = x86RegFormatInfo;
|
332
|
+
|
333
|
+
#ifndef ASMJIT_NO_COMPILER
|
334
|
+
if (Operand::isVirtId(id)) {
|
335
|
+
if (emitter && emitter->emitterType() == EmitterType::kCompiler) {
|
336
|
+
const BaseCompiler* cc = static_cast<const BaseCompiler*>(emitter);
|
337
|
+
if (cc->isVirtIdValid(id)) {
|
338
|
+
VirtReg* vReg = cc->virtRegById(id);
|
339
|
+
ASMJIT_ASSERT(vReg != nullptr);
|
340
|
+
|
341
|
+
const char* name = vReg->name();
|
342
|
+
if (name && name[0] != '\0')
|
343
|
+
ASMJIT_PROPAGATE(sb.append(name));
|
344
|
+
else
|
345
|
+
ASMJIT_PROPAGATE(sb.appendFormat("%%%u", unsigned(Operand::virtIdToIndex(id))));
|
346
|
+
|
347
|
+
if (vReg->type() != type && uint32_t(type) <= uint32_t(RegType::kMaxValue) && Support::test(formatFlags, FormatFlags::kRegCasts)) {
|
348
|
+
const RegFormatInfo::TypeEntry& typeEntry = info.typeEntries[size_t(type)];
|
349
|
+
if (typeEntry.index)
|
350
|
+
ASMJIT_PROPAGATE(sb.appendFormat("@%s", info.typeStrings + typeEntry.index));
|
351
|
+
}
|
352
|
+
|
353
|
+
return kErrorOk;
|
354
|
+
}
|
355
|
+
}
|
356
|
+
}
|
357
|
+
#else
|
358
|
+
DebugUtils::unused(emitter, formatFlags);
|
359
|
+
#endif
|
360
|
+
|
361
|
+
if (uint32_t(type) <= uint32_t(RegType::kMaxValue)) {
|
362
|
+
const RegFormatInfo::NameEntry& nameEntry = info.nameEntries[size_t(type)];
|
363
|
+
|
364
|
+
if (id < nameEntry.specialCount)
|
365
|
+
return sb.append(info.nameStrings + nameEntry.specialIndex + id * 4);
|
366
|
+
|
367
|
+
if (id < nameEntry.count)
|
368
|
+
return sb.appendFormat(info.nameStrings + nameEntry.formatIndex, unsigned(id));
|
369
|
+
|
370
|
+
const RegFormatInfo::TypeEntry& typeEntry = info.typeEntries[size_t(type)];
|
371
|
+
if (typeEntry.index)
|
372
|
+
return sb.appendFormat("%s@%u", info.typeStrings + typeEntry.index, id);
|
373
|
+
}
|
374
|
+
|
375
|
+
return sb.appendFormat("<Reg-%u>?%u", uint32_t(type), id);
|
376
|
+
}
|
377
|
+
|
378
|
+
// x86::FormatterInternal - Format Operand
|
379
|
+
// =======================================
|
380
|
+
|
381
|
+
ASMJIT_FAVOR_SIZE Error FormatterInternal::formatOperand(
|
382
|
+
String& sb,
|
383
|
+
FormatFlags formatFlags,
|
384
|
+
const BaseEmitter* emitter,
|
385
|
+
Arch arch,
|
386
|
+
const Operand_& op) noexcept {
|
387
|
+
|
388
|
+
if (op.isReg())
|
389
|
+
return formatRegister(sb, formatFlags, emitter, arch, op.as<BaseReg>().type(), op.as<BaseReg>().id());
|
390
|
+
|
391
|
+
if (op.isMem()) {
|
392
|
+
const Mem& m = op.as<Mem>();
|
393
|
+
ASMJIT_PROPAGATE(sb.append(x86GetAddressSizeString(m.size())));
|
394
|
+
|
395
|
+
// Segment override prefix.
|
396
|
+
uint32_t seg = m.segmentId();
|
397
|
+
if (seg != SReg::kIdNone && seg < SReg::kIdCount)
|
398
|
+
ASMJIT_PROPAGATE(sb.appendFormat("%s:", x86RegFormatInfo.nameStrings + 224 + size_t(seg) * 4));
|
399
|
+
|
400
|
+
ASMJIT_PROPAGATE(sb.append('['));
|
401
|
+
switch (m.addrType()) {
|
402
|
+
case Mem::AddrType::kDefault:
|
403
|
+
break;
|
404
|
+
case Mem::AddrType::kAbs:
|
405
|
+
ASMJIT_PROPAGATE(sb.append("abs "));
|
406
|
+
break;
|
407
|
+
case Mem::AddrType::kRel:
|
408
|
+
ASMJIT_PROPAGATE(sb.append("rel "));
|
409
|
+
break;
|
410
|
+
}
|
411
|
+
|
412
|
+
char opSign = '\0';
|
413
|
+
if (m.hasBase()) {
|
414
|
+
opSign = '+';
|
415
|
+
if (m.hasBaseLabel()) {
|
416
|
+
ASMJIT_PROPAGATE(Formatter::formatLabel(sb, formatFlags, emitter, m.baseId()));
|
417
|
+
}
|
418
|
+
else {
|
419
|
+
FormatFlags modifiedFlags = formatFlags;
|
420
|
+
if (m.isRegHome()) {
|
421
|
+
ASMJIT_PROPAGATE(sb.append("&"));
|
422
|
+
modifiedFlags &= ~FormatFlags::kRegCasts;
|
423
|
+
}
|
424
|
+
ASMJIT_PROPAGATE(formatRegister(sb, modifiedFlags, emitter, arch, m.baseType(), m.baseId()));
|
425
|
+
}
|
426
|
+
}
|
427
|
+
|
428
|
+
if (m.hasIndex()) {
|
429
|
+
if (opSign)
|
430
|
+
ASMJIT_PROPAGATE(sb.append(opSign));
|
431
|
+
|
432
|
+
opSign = '+';
|
433
|
+
ASMJIT_PROPAGATE(formatRegister(sb, formatFlags, emitter, arch, m.indexType(), m.indexId()));
|
434
|
+
if (m.hasShift())
|
435
|
+
ASMJIT_PROPAGATE(sb.appendFormat("*%u", 1 << m.shift()));
|
436
|
+
}
|
437
|
+
|
438
|
+
uint64_t off = uint64_t(m.offset());
|
439
|
+
if (off || !m.hasBaseOrIndex()) {
|
440
|
+
if (int64_t(off) < 0) {
|
441
|
+
opSign = '-';
|
442
|
+
off = ~off + 1;
|
443
|
+
}
|
444
|
+
|
445
|
+
if (opSign)
|
446
|
+
ASMJIT_PROPAGATE(sb.append(opSign));
|
447
|
+
|
448
|
+
uint32_t base = 10;
|
449
|
+
if (Support::test(formatFlags, FormatFlags::kHexOffsets) && off > 9) {
|
450
|
+
ASMJIT_PROPAGATE(sb.append("0x", 2));
|
451
|
+
base = 16;
|
452
|
+
}
|
453
|
+
|
454
|
+
ASMJIT_PROPAGATE(sb.appendUInt(off, base));
|
455
|
+
}
|
456
|
+
|
457
|
+
return sb.append(']');
|
458
|
+
}
|
459
|
+
|
460
|
+
if (op.isImm()) {
|
461
|
+
const Imm& i = op.as<Imm>();
|
462
|
+
int64_t val = i.value();
|
463
|
+
|
464
|
+
if (Support::test(formatFlags, FormatFlags::kHexImms) && uint64_t(val) > 9) {
|
465
|
+
ASMJIT_PROPAGATE(sb.append("0x", 2));
|
466
|
+
return sb.appendUInt(uint64_t(val), 16);
|
467
|
+
}
|
468
|
+
else {
|
469
|
+
return sb.appendInt(val, 10);
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
if (op.isLabel()) {
|
474
|
+
return Formatter::formatLabel(sb, formatFlags, emitter, op.id());
|
475
|
+
}
|
476
|
+
|
477
|
+
return sb.append("<None>");
|
478
|
+
}
|
479
|
+
|
480
|
+
// x86::FormatterInternal - Format Immediate (Extension)
|
481
|
+
// =====================================================
|
482
|
+
|
483
|
+
static constexpr char kImmCharStart = '{';
|
484
|
+
static constexpr char kImmCharEnd = '}';
|
485
|
+
static constexpr char kImmCharOr = '|';
|
486
|
+
|
487
|
+
struct ImmBits {
|
488
|
+
enum Mode : uint32_t {
|
489
|
+
kModeLookup = 0,
|
490
|
+
kModeFormat = 1
|
491
|
+
};
|
492
|
+
|
493
|
+
uint8_t mask;
|
494
|
+
uint8_t shift;
|
495
|
+
uint8_t mode;
|
496
|
+
char text[48 - 3];
|
497
|
+
};
|
498
|
+
|
499
|
+
ASMJIT_FAVOR_SIZE static Error FormatterInternal_formatImmShuf(String& sb, uint32_t u8, uint32_t bits, uint32_t count) noexcept {
|
500
|
+
uint32_t mask = (1 << bits) - 1;
|
501
|
+
|
502
|
+
for (uint32_t i = 0; i < count; i++, u8 >>= bits) {
|
503
|
+
uint32_t value = u8 & mask;
|
504
|
+
ASMJIT_PROPAGATE(sb.append(i == 0 ? kImmCharStart : kImmCharOr));
|
505
|
+
ASMJIT_PROPAGATE(sb.appendUInt(value));
|
506
|
+
}
|
507
|
+
|
508
|
+
if (kImmCharEnd)
|
509
|
+
ASMJIT_PROPAGATE(sb.append(kImmCharEnd));
|
510
|
+
|
511
|
+
return kErrorOk;
|
512
|
+
}
|
513
|
+
|
514
|
+
ASMJIT_FAVOR_SIZE static Error FormatterInternal_formatImmBits(String& sb, uint32_t u8, const ImmBits* bits, uint32_t count) noexcept {
|
515
|
+
uint32_t n = 0;
|
516
|
+
char buf[64];
|
517
|
+
|
518
|
+
for (uint32_t i = 0; i < count; i++) {
|
519
|
+
const ImmBits& spec = bits[i];
|
520
|
+
|
521
|
+
uint32_t value = (u8 & uint32_t(spec.mask)) >> spec.shift;
|
522
|
+
const char* str = nullptr;
|
523
|
+
|
524
|
+
switch (spec.mode) {
|
525
|
+
case ImmBits::kModeLookup:
|
526
|
+
str = Support::findPackedString(spec.text, value);
|
527
|
+
break;
|
528
|
+
|
529
|
+
case ImmBits::kModeFormat:
|
530
|
+
snprintf(buf, sizeof(buf), spec.text, unsigned(value));
|
531
|
+
str = buf;
|
532
|
+
break;
|
533
|
+
|
534
|
+
default:
|
535
|
+
return DebugUtils::errored(kErrorInvalidState);
|
536
|
+
}
|
537
|
+
|
538
|
+
if (!str[0])
|
539
|
+
continue;
|
540
|
+
|
541
|
+
ASMJIT_PROPAGATE(sb.append(++n == 1 ? kImmCharStart : kImmCharOr));
|
542
|
+
ASMJIT_PROPAGATE(sb.append(str));
|
543
|
+
}
|
544
|
+
|
545
|
+
if (n && kImmCharEnd)
|
546
|
+
ASMJIT_PROPAGATE(sb.append(kImmCharEnd));
|
547
|
+
|
548
|
+
return kErrorOk;
|
549
|
+
}
|
550
|
+
|
551
|
+
ASMJIT_FAVOR_SIZE static Error FormatterInternal_formatImmText(String& sb, uint32_t u8, uint32_t bits, uint32_t advance, const char* text, uint32_t count = 1) noexcept {
|
552
|
+
uint32_t mask = (1u << bits) - 1;
|
553
|
+
uint32_t pos = 0;
|
554
|
+
|
555
|
+
for (uint32_t i = 0; i < count; i++, u8 >>= bits, pos += advance) {
|
556
|
+
uint32_t value = (u8 & mask) + pos;
|
557
|
+
ASMJIT_PROPAGATE(sb.append(i == 0 ? kImmCharStart : kImmCharOr));
|
558
|
+
ASMJIT_PROPAGATE(sb.append(Support::findPackedString(text, value)));
|
559
|
+
}
|
560
|
+
|
561
|
+
if (kImmCharEnd)
|
562
|
+
ASMJIT_PROPAGATE(sb.append(kImmCharEnd));
|
563
|
+
|
564
|
+
return kErrorOk;
|
565
|
+
}
|
566
|
+
|
567
|
+
ASMJIT_FAVOR_SIZE static Error FormatterInternal_explainConst(
|
568
|
+
String& sb,
|
569
|
+
FormatFlags formatFlags,
|
570
|
+
InstId instId,
|
571
|
+
uint32_t vecSize,
|
572
|
+
const Imm& imm) noexcept {
|
573
|
+
|
574
|
+
DebugUtils::unused(formatFlags);
|
575
|
+
|
576
|
+
static const char vcmpx[] =
|
577
|
+
"EQ_OQ\0" "LT_OS\0" "LE_OS\0" "UNORD_Q\0" "NEQ_UQ\0" "NLT_US\0" "NLE_US\0" "ORD_Q\0"
|
578
|
+
"EQ_UQ\0" "NGE_US\0" "NGT_US\0" "FALSE_OQ\0" "NEQ_OQ\0" "GE_OS\0" "GT_OS\0" "TRUE_UQ\0"
|
579
|
+
"EQ_OS\0" "LT_OQ\0" "LE_OQ\0" "UNORD_S\0" "NEQ_US\0" "NLT_UQ\0" "NLE_UQ\0" "ORD_S\0"
|
580
|
+
"EQ_US\0" "NGE_UQ\0" "NGT_UQ\0" "FALSE_OS\0" "NEQ_OS\0" "GE_OQ\0" "GT_OQ\0" "TRUE_US\0";
|
581
|
+
|
582
|
+
// Why to make it compatible...
|
583
|
+
static const char vpcmpx[] = "EQ\0" "LT\0" "LE\0" "FALSE\0" "NEQ\0" "GE\0" "GT\0" "TRUE\0";
|
584
|
+
static const char vpcomx[] = "LT\0" "LE\0" "GT\0" "GE\0" "EQ\0" "NEQ\0" "FALSE\0" "TRUE\0";
|
585
|
+
|
586
|
+
static const char vshufpd[] = "A0\0A1\0B0\0B1\0A2\0A3\0B2\0B3\0A4\0A5\0B4\0B5\0A6\0A7\0B6\0B7\0";
|
587
|
+
static const char vshufps[] = "A0\0A1\0A2\0A3\0A0\0A1\0A2\0A3\0B0\0B1\0B2\0B3\0B0\0B1\0B2\0B3\0";
|
588
|
+
|
589
|
+
static const ImmBits vfpclassxx[] = {
|
590
|
+
{ 0x07u, 0, ImmBits::kModeLookup, "QNAN\0" "+0\0" "-0\0" "+INF\0" "-INF\0" "DENORMAL\0" "-FINITE\0" "SNAN\0" }
|
591
|
+
};
|
592
|
+
|
593
|
+
static const ImmBits vfixupimmxx[] = {
|
594
|
+
{ 0x01u, 0, ImmBits::kModeLookup, "\0" "+INF_IE\0" },
|
595
|
+
{ 0x02u, 1, ImmBits::kModeLookup, "\0" "-VE_IE\0" },
|
596
|
+
{ 0x04u, 2, ImmBits::kModeLookup, "\0" "-INF_IE\0" },
|
597
|
+
{ 0x08u, 3, ImmBits::kModeLookup, "\0" "SNAN_IE\0" },
|
598
|
+
{ 0x10u, 4, ImmBits::kModeLookup, "\0" "ONE_IE\0" },
|
599
|
+
{ 0x20u, 5, ImmBits::kModeLookup, "\0" "ONE_ZE\0" },
|
600
|
+
{ 0x40u, 6, ImmBits::kModeLookup, "\0" "ZERO_IE\0" },
|
601
|
+
{ 0x80u, 7, ImmBits::kModeLookup, "\0" "ZERO_ZE\0" }
|
602
|
+
};
|
603
|
+
|
604
|
+
static const ImmBits vgetmantxx[] = {
|
605
|
+
{ 0x03u, 0, ImmBits::kModeLookup, "[1, 2)\0" "[.5, 2)\0" "[.5, 1)\0" "[.75, 1.5)\0" },
|
606
|
+
{ 0x04u, 2, ImmBits::kModeLookup, "\0" "NO_SIGN\0" },
|
607
|
+
{ 0x08u, 3, ImmBits::kModeLookup, "\0" "QNAN_IF_SIGN\0" }
|
608
|
+
};
|
609
|
+
|
610
|
+
static const ImmBits vmpsadbw[] = {
|
611
|
+
{ 0x04u, 2, ImmBits::kModeLookup, "BLK1[0]\0" "BLK1[1]\0" },
|
612
|
+
{ 0x03u, 0, ImmBits::kModeLookup, "BLK2[0]\0" "BLK2[1]\0" "BLK2[2]\0" "BLK2[3]\0" },
|
613
|
+
{ 0x40u, 6, ImmBits::kModeLookup, "BLK1[4]\0" "BLK1[5]\0" },
|
614
|
+
{ 0x30u, 4, ImmBits::kModeLookup, "BLK2[4]\0" "BLK2[5]\0" "BLK2[6]\0" "BLK2[7]\0" }
|
615
|
+
};
|
616
|
+
|
617
|
+
static const ImmBits vpclmulqdq[] = {
|
618
|
+
{ 0x01u, 0, ImmBits::kModeLookup, "LQ\0" "HQ\0" },
|
619
|
+
{ 0x10u, 4, ImmBits::kModeLookup, "LQ\0" "HQ\0" }
|
620
|
+
};
|
621
|
+
|
622
|
+
static const ImmBits vperm2x128[] = {
|
623
|
+
{ 0x0Bu, 0, ImmBits::kModeLookup, "A0\0" "A1\0" "B0\0" "B1\0" "\0" "\0" "\0" "\0" "0\0" "0\0" "0\0" "0\0" },
|
624
|
+
{ 0xB0u, 4, ImmBits::kModeLookup, "A0\0" "A1\0" "B0\0" "B1\0" "\0" "\0" "\0" "\0" "0\0" "0\0" "0\0" "0\0" }
|
625
|
+
};
|
626
|
+
|
627
|
+
static const ImmBits vrangexx[] = {
|
628
|
+
{ 0x03u, 0, ImmBits::kModeLookup, "MIN\0" "MAX\0" "MIN_ABS\0" "MAX_ABS\0" },
|
629
|
+
{ 0x0Cu, 2, ImmBits::kModeLookup, "SIGN_A\0" "SIGN_B\0" "SIGN_0\0" "SIGN_1\0" }
|
630
|
+
};
|
631
|
+
|
632
|
+
static const ImmBits vreducexx_vrndscalexx[] = {
|
633
|
+
{ 0x07u, 0, ImmBits::kModeLookup, "\0" "\0" "\0" "\0" "ROUND\0" "FLOOR\0" "CEIL\0" "TRUNC\0" },
|
634
|
+
{ 0x08u, 3, ImmBits::kModeLookup, "\0" "SAE\0" },
|
635
|
+
{ 0xF0u, 4, ImmBits::kModeFormat, "LEN=%d" }
|
636
|
+
};
|
637
|
+
|
638
|
+
static const ImmBits vroundxx[] = {
|
639
|
+
{ 0x07u, 0, ImmBits::kModeLookup, "ROUND\0" "FLOOR\0" "CEIL\0" "TRUNC\0" "\0" "\0" "\0" "\0" },
|
640
|
+
{ 0x08u, 3, ImmBits::kModeLookup, "\0" "INEXACT\0" }
|
641
|
+
};
|
642
|
+
|
643
|
+
uint32_t u8 = imm.valueAs<uint8_t>();
|
644
|
+
switch (instId) {
|
645
|
+
case Inst::kIdVblendpd:
|
646
|
+
case Inst::kIdBlendpd:
|
647
|
+
return FormatterInternal_formatImmShuf(sb, u8, 1, vecSize / 8);
|
648
|
+
|
649
|
+
case Inst::kIdVblendps:
|
650
|
+
case Inst::kIdBlendps:
|
651
|
+
return FormatterInternal_formatImmShuf(sb, u8, 1, vecSize / 4);
|
652
|
+
|
653
|
+
case Inst::kIdVcmppd:
|
654
|
+
case Inst::kIdVcmpps:
|
655
|
+
case Inst::kIdVcmpsd:
|
656
|
+
case Inst::kIdVcmpss:
|
657
|
+
return FormatterInternal_formatImmText(sb, u8, 5, 0, vcmpx);
|
658
|
+
|
659
|
+
case Inst::kIdCmppd:
|
660
|
+
case Inst::kIdCmpps:
|
661
|
+
case Inst::kIdCmpsd:
|
662
|
+
case Inst::kIdCmpss:
|
663
|
+
return FormatterInternal_formatImmText(sb, u8, 3, 0, vcmpx);
|
664
|
+
|
665
|
+
case Inst::kIdVdbpsadbw:
|
666
|
+
return FormatterInternal_formatImmShuf(sb, u8, 2, 4);
|
667
|
+
|
668
|
+
case Inst::kIdVdppd:
|
669
|
+
case Inst::kIdVdpps:
|
670
|
+
case Inst::kIdDppd:
|
671
|
+
case Inst::kIdDpps:
|
672
|
+
return FormatterInternal_formatImmShuf(sb, u8, 1, 8);
|
673
|
+
|
674
|
+
case Inst::kIdVmpsadbw:
|
675
|
+
case Inst::kIdMpsadbw:
|
676
|
+
return FormatterInternal_formatImmBits(sb, u8, vmpsadbw, Support::min<uint32_t>(vecSize / 8, 4));
|
677
|
+
|
678
|
+
case Inst::kIdVpblendw:
|
679
|
+
case Inst::kIdPblendw:
|
680
|
+
return FormatterInternal_formatImmShuf(sb, u8, 1, 8);
|
681
|
+
|
682
|
+
case Inst::kIdVpblendd:
|
683
|
+
return FormatterInternal_formatImmShuf(sb, u8, 1, Support::min<uint32_t>(vecSize / 4, 8));
|
684
|
+
|
685
|
+
case Inst::kIdVpclmulqdq:
|
686
|
+
case Inst::kIdPclmulqdq:
|
687
|
+
return FormatterInternal_formatImmBits(sb, u8, vpclmulqdq, ASMJIT_ARRAY_SIZE(vpclmulqdq));
|
688
|
+
|
689
|
+
case Inst::kIdVroundpd:
|
690
|
+
case Inst::kIdVroundps:
|
691
|
+
case Inst::kIdVroundsd:
|
692
|
+
case Inst::kIdVroundss:
|
693
|
+
case Inst::kIdRoundpd:
|
694
|
+
case Inst::kIdRoundps:
|
695
|
+
case Inst::kIdRoundsd:
|
696
|
+
case Inst::kIdRoundss:
|
697
|
+
return FormatterInternal_formatImmBits(sb, u8, vroundxx, ASMJIT_ARRAY_SIZE(vroundxx));
|
698
|
+
|
699
|
+
case Inst::kIdVshufpd:
|
700
|
+
case Inst::kIdShufpd:
|
701
|
+
return FormatterInternal_formatImmText(sb, u8, 1, 2, vshufpd, Support::min<uint32_t>(vecSize / 8, 8));
|
702
|
+
|
703
|
+
case Inst::kIdVshufps:
|
704
|
+
case Inst::kIdShufps:
|
705
|
+
return FormatterInternal_formatImmText(sb, u8, 2, 4, vshufps, 4);
|
706
|
+
|
707
|
+
case Inst::kIdVcvtps2ph:
|
708
|
+
return FormatterInternal_formatImmBits(sb, u8, vroundxx, 1);
|
709
|
+
|
710
|
+
case Inst::kIdVperm2f128:
|
711
|
+
case Inst::kIdVperm2i128:
|
712
|
+
return FormatterInternal_formatImmBits(sb, u8, vperm2x128, ASMJIT_ARRAY_SIZE(vperm2x128));
|
713
|
+
|
714
|
+
case Inst::kIdVpermilpd:
|
715
|
+
return FormatterInternal_formatImmShuf(sb, u8, 1, vecSize / 8);
|
716
|
+
|
717
|
+
case Inst::kIdVpermilps:
|
718
|
+
return FormatterInternal_formatImmShuf(sb, u8, 2, 4);
|
719
|
+
|
720
|
+
case Inst::kIdVpshufd:
|
721
|
+
case Inst::kIdPshufd:
|
722
|
+
return FormatterInternal_formatImmShuf(sb, u8, 2, 4);
|
723
|
+
|
724
|
+
case Inst::kIdVpshufhw:
|
725
|
+
case Inst::kIdVpshuflw:
|
726
|
+
case Inst::kIdPshufhw:
|
727
|
+
case Inst::kIdPshuflw:
|
728
|
+
case Inst::kIdPshufw:
|
729
|
+
return FormatterInternal_formatImmShuf(sb, u8, 2, 4);
|
730
|
+
|
731
|
+
case Inst::kIdVfixupimmpd:
|
732
|
+
case Inst::kIdVfixupimmps:
|
733
|
+
case Inst::kIdVfixupimmsd:
|
734
|
+
case Inst::kIdVfixupimmss:
|
735
|
+
return FormatterInternal_formatImmBits(sb, u8, vfixupimmxx, ASMJIT_ARRAY_SIZE(vfixupimmxx));
|
736
|
+
|
737
|
+
case Inst::kIdVfpclasspd:
|
738
|
+
case Inst::kIdVfpclassps:
|
739
|
+
case Inst::kIdVfpclasssd:
|
740
|
+
case Inst::kIdVfpclassss:
|
741
|
+
return FormatterInternal_formatImmBits(sb, u8, vfpclassxx, ASMJIT_ARRAY_SIZE(vfpclassxx));
|
742
|
+
|
743
|
+
case Inst::kIdVgetmantpd:
|
744
|
+
case Inst::kIdVgetmantps:
|
745
|
+
case Inst::kIdVgetmantsd:
|
746
|
+
case Inst::kIdVgetmantss:
|
747
|
+
return FormatterInternal_formatImmBits(sb, u8, vgetmantxx, ASMJIT_ARRAY_SIZE(vgetmantxx));
|
748
|
+
|
749
|
+
case Inst::kIdVpcmpb:
|
750
|
+
case Inst::kIdVpcmpd:
|
751
|
+
case Inst::kIdVpcmpq:
|
752
|
+
case Inst::kIdVpcmpw:
|
753
|
+
case Inst::kIdVpcmpub:
|
754
|
+
case Inst::kIdVpcmpud:
|
755
|
+
case Inst::kIdVpcmpuq:
|
756
|
+
case Inst::kIdVpcmpuw:
|
757
|
+
return FormatterInternal_formatImmText(sb, u8, 3, 0, vpcmpx);
|
758
|
+
|
759
|
+
case Inst::kIdVpcomb:
|
760
|
+
case Inst::kIdVpcomd:
|
761
|
+
case Inst::kIdVpcomq:
|
762
|
+
case Inst::kIdVpcomw:
|
763
|
+
case Inst::kIdVpcomub:
|
764
|
+
case Inst::kIdVpcomud:
|
765
|
+
case Inst::kIdVpcomuq:
|
766
|
+
case Inst::kIdVpcomuw:
|
767
|
+
return FormatterInternal_formatImmText(sb, u8, 3, 0, vpcomx);
|
768
|
+
|
769
|
+
case Inst::kIdVpermq:
|
770
|
+
case Inst::kIdVpermpd:
|
771
|
+
return FormatterInternal_formatImmShuf(sb, u8, 2, 4);
|
772
|
+
|
773
|
+
case Inst::kIdVpternlogd:
|
774
|
+
case Inst::kIdVpternlogq:
|
775
|
+
return FormatterInternal_formatImmShuf(sb, u8, 1, 8);
|
776
|
+
|
777
|
+
case Inst::kIdVrangepd:
|
778
|
+
case Inst::kIdVrangeps:
|
779
|
+
case Inst::kIdVrangesd:
|
780
|
+
case Inst::kIdVrangess:
|
781
|
+
return FormatterInternal_formatImmBits(sb, u8, vrangexx, ASMJIT_ARRAY_SIZE(vrangexx));
|
782
|
+
|
783
|
+
case Inst::kIdVreducepd:
|
784
|
+
case Inst::kIdVreduceps:
|
785
|
+
case Inst::kIdVreducesd:
|
786
|
+
case Inst::kIdVreducess:
|
787
|
+
case Inst::kIdVrndscalepd:
|
788
|
+
case Inst::kIdVrndscaleps:
|
789
|
+
case Inst::kIdVrndscalesd:
|
790
|
+
case Inst::kIdVrndscaless:
|
791
|
+
return FormatterInternal_formatImmBits(sb, u8, vreducexx_vrndscalexx, ASMJIT_ARRAY_SIZE(vreducexx_vrndscalexx));
|
792
|
+
|
793
|
+
case Inst::kIdVshuff32x4:
|
794
|
+
case Inst::kIdVshuff64x2:
|
795
|
+
case Inst::kIdVshufi32x4:
|
796
|
+
case Inst::kIdVshufi64x2: {
|
797
|
+
uint32_t count = Support::max<uint32_t>(vecSize / 16, 2u);
|
798
|
+
uint32_t bits = count <= 2 ? 1u : 2u;
|
799
|
+
return FormatterInternal_formatImmShuf(sb, u8, bits, count);
|
800
|
+
}
|
801
|
+
|
802
|
+
default:
|
803
|
+
return kErrorOk;
|
804
|
+
}
|
805
|
+
}
|
806
|
+
|
807
|
+
// x86::FormatterInternal - Format Instruction
|
808
|
+
// ===========================================
|
809
|
+
|
810
|
+
ASMJIT_FAVOR_SIZE Error FormatterInternal::formatInstruction(
|
811
|
+
String& sb,
|
812
|
+
FormatFlags formatFlags,
|
813
|
+
const BaseEmitter* emitter,
|
814
|
+
Arch arch,
|
815
|
+
const BaseInst& inst, const Operand_* operands, size_t opCount) noexcept {
|
816
|
+
|
817
|
+
InstId instId = inst.id();
|
818
|
+
InstOptions options = inst.options();
|
819
|
+
|
820
|
+
// Format instruction options and instruction mnemonic.
|
821
|
+
if (instId < Inst::_kIdCount) {
|
822
|
+
// VEX|EVEX options.
|
823
|
+
if (Support::test(options, InstOptions::kX86_Vex))
|
824
|
+
ASMJIT_PROPAGATE(sb.append("{vex} "));
|
825
|
+
|
826
|
+
if (Support::test(options, InstOptions::kX86_Vex3))
|
827
|
+
ASMJIT_PROPAGATE(sb.append("{vex3} "));
|
828
|
+
|
829
|
+
if (Support::test(options, InstOptions::kX86_Evex))
|
830
|
+
ASMJIT_PROPAGATE(sb.append("{evex} "));
|
831
|
+
|
832
|
+
// MOD/RM and MOD/MR options
|
833
|
+
if (Support::test(options, InstOptions::kX86_ModRM))
|
834
|
+
ASMJIT_PROPAGATE(sb.append("{modrm} "));
|
835
|
+
else if (Support::test(options, InstOptions::kX86_ModMR))
|
836
|
+
ASMJIT_PROPAGATE(sb.append("{modmr} "));
|
837
|
+
|
838
|
+
// SHORT|LONG options.
|
839
|
+
if (Support::test(options, InstOptions::kShortForm))
|
840
|
+
ASMJIT_PROPAGATE(sb.append("short "));
|
841
|
+
|
842
|
+
if (Support::test(options, InstOptions::kLongForm))
|
843
|
+
ASMJIT_PROPAGATE(sb.append("long "));
|
844
|
+
|
845
|
+
// LOCK|XACQUIRE|XRELEASE options.
|
846
|
+
if (Support::test(options, InstOptions::kX86_XAcquire))
|
847
|
+
ASMJIT_PROPAGATE(sb.append("xacquire "));
|
848
|
+
|
849
|
+
if (Support::test(options, InstOptions::kX86_XRelease))
|
850
|
+
ASMJIT_PROPAGATE(sb.append("xrelease "));
|
851
|
+
|
852
|
+
if (Support::test(options, InstOptions::kX86_Lock))
|
853
|
+
ASMJIT_PROPAGATE(sb.append("lock "));
|
854
|
+
|
855
|
+
// REP|REPNE options.
|
856
|
+
if (Support::test(options, InstOptions::kX86_Rep | InstOptions::kX86_Repne)) {
|
857
|
+
sb.append(Support::test(options, InstOptions::kX86_Rep) ? "rep " : "repnz ");
|
858
|
+
if (inst.hasExtraReg()) {
|
859
|
+
ASMJIT_PROPAGATE(sb.append("{"));
|
860
|
+
ASMJIT_PROPAGATE(formatOperand(sb, formatFlags, emitter, arch, inst.extraReg().toReg<BaseReg>()));
|
861
|
+
ASMJIT_PROPAGATE(sb.append("} "));
|
862
|
+
}
|
863
|
+
}
|
864
|
+
|
865
|
+
// REX options.
|
866
|
+
if (Support::test(options, InstOptions::kX86_Rex)) {
|
867
|
+
const InstOptions kRXBWMask = InstOptions::kX86_OpCodeR |
|
868
|
+
InstOptions::kX86_OpCodeX |
|
869
|
+
InstOptions::kX86_OpCodeB |
|
870
|
+
InstOptions::kX86_OpCodeW ;
|
871
|
+
if (Support::test(options, kRXBWMask)) {
|
872
|
+
ASMJIT_PROPAGATE(sb.append("rex."));
|
873
|
+
if (Support::test(options, InstOptions::kX86_OpCodeR)) sb.append('r');
|
874
|
+
if (Support::test(options, InstOptions::kX86_OpCodeX)) sb.append('x');
|
875
|
+
if (Support::test(options, InstOptions::kX86_OpCodeB)) sb.append('b');
|
876
|
+
if (Support::test(options, InstOptions::kX86_OpCodeW)) sb.append('w');
|
877
|
+
sb.append(' ');
|
878
|
+
}
|
879
|
+
else {
|
880
|
+
ASMJIT_PROPAGATE(sb.append("rex "));
|
881
|
+
}
|
882
|
+
}
|
883
|
+
|
884
|
+
ASMJIT_PROPAGATE(InstInternal::instIdToString(arch, instId, sb));
|
885
|
+
}
|
886
|
+
else {
|
887
|
+
ASMJIT_PROPAGATE(sb.appendFormat("[InstId=#%u]", unsigned(instId)));
|
888
|
+
}
|
889
|
+
|
890
|
+
for (uint32_t i = 0; i < opCount; i++) {
|
891
|
+
const Operand_& op = operands[i];
|
892
|
+
if (op.isNone()) break;
|
893
|
+
|
894
|
+
ASMJIT_PROPAGATE(sb.append(i == 0 ? " " : ", "));
|
895
|
+
ASMJIT_PROPAGATE(formatOperand(sb, formatFlags, emitter, arch, op));
|
896
|
+
|
897
|
+
if (op.isImm() && uint32_t(formatFlags & FormatFlags::kExplainImms)) {
|
898
|
+
uint32_t vecSize = 16;
|
899
|
+
for (uint32_t j = 0; j < opCount; j++)
|
900
|
+
if (operands[j].isReg())
|
901
|
+
vecSize = Support::max<uint32_t>(vecSize, operands[j].size());
|
902
|
+
ASMJIT_PROPAGATE(FormatterInternal_explainConst(sb, formatFlags, instId, vecSize, op.as<Imm>()));
|
903
|
+
}
|
904
|
+
|
905
|
+
// Support AVX-512 masking - {k}{z}.
|
906
|
+
if (i == 0) {
|
907
|
+
if (inst.extraReg().group() == RegGroup::kX86_K) {
|
908
|
+
ASMJIT_PROPAGATE(sb.append(" {"));
|
909
|
+
ASMJIT_PROPAGATE(formatRegister(sb, formatFlags, emitter, arch, inst.extraReg().type(), inst.extraReg().id()));
|
910
|
+
ASMJIT_PROPAGATE(sb.append('}'));
|
911
|
+
|
912
|
+
if (Support::test(options, InstOptions::kX86_ZMask))
|
913
|
+
ASMJIT_PROPAGATE(sb.append("{z}"));
|
914
|
+
}
|
915
|
+
else if (Support::test(options, InstOptions::kX86_ZMask)) {
|
916
|
+
ASMJIT_PROPAGATE(sb.append(" {z}"));
|
917
|
+
}
|
918
|
+
}
|
919
|
+
|
920
|
+
// Support AVX-512 broadcast - {1tox}.
|
921
|
+
if (op.isMem() && op.as<Mem>().hasBroadcast()) {
|
922
|
+
ASMJIT_PROPAGATE(sb.appendFormat(" {1to%u}", Support::bitMask(uint32_t(op.as<Mem>().getBroadcast()))));
|
923
|
+
}
|
924
|
+
}
|
925
|
+
|
926
|
+
// Support AVX-512 embedded rounding and suppress-all-exceptions {sae}.
|
927
|
+
if (inst.hasOption(InstOptions::kX86_ER | InstOptions::kX86_SAE)) {
|
928
|
+
if (inst.hasOption(InstOptions::kX86_ER)) {
|
929
|
+
uint32_t bits = uint32_t(inst.options() & InstOptions::kX86_ERMask) >> Support::ConstCTZ<uint32_t(InstOptions::kX86_ERMask)>::value;
|
930
|
+
|
931
|
+
const char roundingModes[] = "rn\0rd\0ru\0rz";
|
932
|
+
ASMJIT_PROPAGATE(sb.appendFormat(", {%s-sae}", roundingModes + bits * 3));
|
933
|
+
}
|
934
|
+
else {
|
935
|
+
ASMJIT_PROPAGATE(sb.append(", {sae}"));
|
936
|
+
}
|
937
|
+
}
|
938
|
+
|
939
|
+
return kErrorOk;
|
940
|
+
}
|
941
|
+
|
942
|
+
ASMJIT_END_SUB_NAMESPACE
|
943
|
+
|
944
|
+
#endif // !ASMJIT_NO_LOGGING
|