-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[X86][MC] Support encoding/decoding for JMPABS #72835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,8 +271,17 @@ class EVEX2VEXOverride<string VEXInstrName> { | |
// Prevent EVEX->VEX conversion from considering this instruction. | ||
class NotEVEX2VEXConvertible { bit notEVEX2VEXConvertible = 1; } | ||
|
||
// Force the instruction to use VEX encoding. | ||
class ExplicitVEXPrefix { bit ExplicitVEXPrefix = 1; } | ||
// Force the instruction to use REX2/VEX/EVEX encoding. | ||
class ExplicitOpPrefix<bits<2> val> { | ||
bits<2> Value = val; | ||
} | ||
def NoExplicitOpPrefix : ExplicitOpPrefix<0>; | ||
def ExplicitREX2 : ExplicitOpPrefix<1>; | ||
def ExplicitVEX : ExplicitOpPrefix<2>; | ||
def ExplicitEVEX : ExplicitOpPrefix<3>; | ||
class ExplicitREX2Prefix { ExplicitOpPrefix explicitOpPrefix = ExplicitREX2; } | ||
class ExplicitVEXPrefix { ExplicitOpPrefix explicitOpPrefix = ExplicitVEX; } | ||
class ExplicitEVEXPrefix { ExplicitOpPrefix explicitOpPrefix = ExplicitEVEX; } | ||
|
||
class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins, | ||
string AsmStr, Domain d = GenericDomain> | ||
|
@@ -354,7 +363,8 @@ class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins, | |
string EVEX2VEXOverride = ?; | ||
|
||
bit notEVEX2VEXConvertible = 0; // Prevent EVEX->VEX conversion. | ||
bit ExplicitVEXPrefix = 0; // Force the instruction to use VEX encoding. | ||
ExplicitOpPrefix explicitOpPrefix = NoExplicitOpPrefix; | ||
bits<2> explicitOpPrefixBits = explicitOpPrefix.Value; | ||
Comment on lines
+366
to
+367
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why need to define both? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need We need Similarly, we have both
in this file. |
||
// Force to check predicate before compress EVEX to VEX encoding. | ||
bit checkVEXPredicate = 0; | ||
// TSFlags layout should be kept in sync with X86BaseInfo.h. | ||
|
@@ -381,7 +391,7 @@ class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins, | |
let TSFlags{47-45} = !if(!eq(CD8_Scale, 0), 0, !add(!logtwo(CD8_Scale), 1)); | ||
let TSFlags{48} = hasEVEX_RC; | ||
let TSFlags{49} = hasNoTrackPrefix; | ||
let TSFlags{50} = ExplicitVEXPrefix; | ||
let TSFlags{51-50} = explicitOpPrefixBits; | ||
} | ||
|
||
class PseudoI<dag oops, dag iops, list<dag> pattern> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# RUN: llvm-mc -triple x86_64 -disassemble %s | FileCheck %s --check-prefix=ATT | ||
# RUN: llvm-mc -triple x86_64 -disassemble -output-asm-variant=1 %s | FileCheck %s --check-prefix=INTEL | ||
|
||
# ATT: jmpabs $1 | ||
# INTEL: jmpabs 1 | ||
0xd5,0x00,0xa1,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00 | ||
|
||
# ATT: jmpabs $72623859790382856 | ||
# INTEL: jmpabs 72623859790382856 | ||
0xd5,0x00,0xa1,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# RUN: llvm-mc -triple x86_64 -show-encoding %s | FileCheck %s | ||
# RUN: not llvm-mc -triple i386 -show-encoding %s 2>&1 | FileCheck %s --check-prefix=ERROR | ||
|
||
# ERROR-COUNT-2: error: | ||
# ERROR-NOT: error: | ||
|
||
# CHECK: jmpabs $1 | ||
# CHECK: encoding: [0xd5,0x00,0xa1,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00] | ||
jmpabs $1 | ||
# CHECK: jmpabs $72623859790382856 | ||
# CHECK: encoding: [0xd5,0x00,0xa1,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01] | ||
jmpabs $72623859790382856 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# RUN: llvm-mc -triple x86_64 -show-encoding -x86-asm-syntax=intel -output-asm-variant=1 %s | FileCheck %s | ||
|
||
# CHECK: jmpabs 1 | ||
# CHECK: encoding: [0xd5,0x00,0xa1,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00] | ||
jmpabs 1 | ||
# CHECK: jmpabs 72623859790382856 | ||
# CHECK: encoding: [0xd5,0x00,0xa1,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01] | ||
jmpabs 72623859790382856 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,6 +155,8 @@ namespace X86Local { | |
enum { | ||
AdSize16 = 1, AdSize32 = 2, AdSize64 = 3 | ||
}; | ||
|
||
enum { ExplicitREX2 = 1 }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need enum for one entry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If no this enum, then in X86RecognizableInstr.cpp, the code would be
which was hard to read. |
||
} | ||
|
||
namespace X86Disassembler { | ||
|
@@ -206,6 +208,8 @@ struct RecognizableInstrBase { | |
bool ForceDisassemble; | ||
// The CD8_Scale field from the record | ||
uint8_t CD8_Scale; | ||
/// If explicitOpPrefix field from the record equals ExplicitREX2 | ||
bool ExplicitREX2Prefix; | ||
/// \param insn The CodeGenInstruction to extract information from. | ||
RecognizableInstrBase(const CodeGenInstruction &insn); | ||
/// \returns true if this instruction should be emitted | ||
|
Uh oh!
There was an error while loading. Please reload this page.