mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-25 23:45:36 +00:00
[X86][AVX] Extend hasVEX_WPrefix bit to accept WIG value (W Ignore) + update all AVX instructions with the new value.
Add WIG value to all of AVX instructions which ignore the W-bit in their encoding, instead of giving them the default value of 0. This patch is needed for a follow up work on EVEX2VEX pass (replacing EVEX encoded instructions with their corresponding VEX version when possible). Differential Revision: https://reviews.llvm.org/D29876 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1fe7ec3f8e
commit
5cb227868c
@ -199,7 +199,8 @@ class TAPS : TA { Prefix OpPrefix = PS; }
|
||||
class TAPD : TA { Prefix OpPrefix = PD; }
|
||||
class TAXD : TA { Prefix OpPrefix = XD; }
|
||||
class VEX { Encoding OpEnc = EncVEX; }
|
||||
class VEX_W { bit hasVEX_WPrefix = 1; }
|
||||
class VEX_W { bits<2> VEX_WPrefix = 1; }
|
||||
class VEX_WIG { bits<2> VEX_WPrefix = 2; }
|
||||
class VEX_4V : VEX { bit hasVEX_4V = 1; }
|
||||
class VEX_L { bit hasVEX_L = 1; }
|
||||
class VEX_LIG { bit ignoresVEX_L = 1; }
|
||||
@ -270,7 +271,7 @@ class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
|
||||
bit hasREPPrefix = 0; // Does this inst have a REP prefix?
|
||||
Encoding OpEnc = EncNormal; // Encoding used by this instruction
|
||||
bits<2> OpEncBits = OpEnc.Value;
|
||||
bit hasVEX_WPrefix = 0; // Does this inst set the VEX_W field?
|
||||
bits<2> VEX_WPrefix = 0; // Does this inst set the VEX_W field?
|
||||
bit hasVEX_4V = 0; // Does this inst require the VEX.VVVV field?
|
||||
bit hasVEX_L = 0; // Does this inst use large (256-bit) registers?
|
||||
bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit
|
||||
@ -317,7 +318,8 @@ class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins,
|
||||
let TSFlags{28-27} = ExeDomain.Value;
|
||||
let TSFlags{30-29} = OpEncBits;
|
||||
let TSFlags{38-31} = Opcode;
|
||||
let TSFlags{39} = hasVEX_WPrefix;
|
||||
// Currently no need for second bit in TSFlags - W Ignore is equivalent to 0.
|
||||
let TSFlags{39} = VEX_WPrefix{0};
|
||||
let TSFlags{40} = hasVEX_4V;
|
||||
let TSFlags{41} = hasVEX_L;
|
||||
let TSFlags{42} = hasEVEX_K;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -138,6 +138,10 @@ namespace X86Local {
|
||||
enum {
|
||||
AdSize16 = 1, AdSize32 = 2, AdSize64 = 3
|
||||
};
|
||||
|
||||
enum {
|
||||
VEX_W0 = 0, VEX_W1 = 1, VEX_WIG = 2
|
||||
};
|
||||
}
|
||||
|
||||
using namespace X86Disassembler;
|
||||
@ -203,7 +207,7 @@ RecognizableInstr::RecognizableInstr(DisassemblerTables &tables,
|
||||
AdSize = byteFromRec(Rec, "AdSizeBits");
|
||||
HasREX_WPrefix = Rec->getValueAsBit("hasREX_WPrefix");
|
||||
HasVEX_4V = Rec->getValueAsBit("hasVEX_4V");
|
||||
HasVEX_WPrefix = Rec->getValueAsBit("hasVEX_WPrefix");
|
||||
VEX_WPrefix = byteFromRec(Rec,"VEX_WPrefix");
|
||||
IgnoresVEX_L = Rec->getValueAsBit("ignoresVEX_L");
|
||||
HasEVEX_L2Prefix = Rec->getValueAsBit("hasEVEX_L2");
|
||||
HasEVEX_K = Rec->getValueAsBit("hasEVEX_K");
|
||||
@ -280,7 +284,7 @@ InstructionContext RecognizableInstr::insnContext() const {
|
||||
llvm_unreachable("Don't support VEX.L if EVEX_L2 is enabled");
|
||||
}
|
||||
// VEX_L & VEX_W
|
||||
if (HasVEX_LPrefix && HasVEX_WPrefix) {
|
||||
if (HasVEX_LPrefix && VEX_WPrefix == X86Local::VEX_W1) {
|
||||
if (OpPrefix == X86Local::PD)
|
||||
insnContext = EVEX_KB(IC_EVEX_L_W_OPSIZE);
|
||||
else if (OpPrefix == X86Local::XS)
|
||||
@ -308,7 +312,7 @@ InstructionContext RecognizableInstr::insnContext() const {
|
||||
llvm_unreachable("Invalid prefix");
|
||||
}
|
||||
}
|
||||
else if (HasEVEX_L2Prefix && HasVEX_WPrefix) {
|
||||
else if (HasEVEX_L2Prefix && VEX_WPrefix == X86Local::VEX_W1) {
|
||||
// EVEX_L2 & VEX_W
|
||||
if (OpPrefix == X86Local::PD)
|
||||
insnContext = EVEX_KB(IC_EVEX_L2_W_OPSIZE);
|
||||
@ -337,7 +341,7 @@ InstructionContext RecognizableInstr::insnContext() const {
|
||||
llvm_unreachable("Invalid prefix");
|
||||
}
|
||||
}
|
||||
else if (HasVEX_WPrefix) {
|
||||
else if (VEX_WPrefix == X86Local::VEX_W1) {
|
||||
// VEX_W
|
||||
if (OpPrefix == X86Local::PD)
|
||||
insnContext = EVEX_KB(IC_EVEX_W_OPSIZE);
|
||||
@ -363,7 +367,7 @@ InstructionContext RecognizableInstr::insnContext() const {
|
||||
insnContext = EVEX_KB(IC_EVEX);
|
||||
/// eof EVEX
|
||||
} else if (Encoding == X86Local::VEX || Encoding == X86Local::XOP) {
|
||||
if (HasVEX_LPrefix && HasVEX_WPrefix) {
|
||||
if (HasVEX_LPrefix && VEX_WPrefix == X86Local::VEX_W1) {
|
||||
if (OpPrefix == X86Local::PD)
|
||||
insnContext = IC_VEX_L_W_OPSIZE;
|
||||
else if (OpPrefix == X86Local::XS)
|
||||
@ -378,7 +382,7 @@ InstructionContext RecognizableInstr::insnContext() const {
|
||||
}
|
||||
} else if (OpPrefix == X86Local::PD && HasVEX_LPrefix)
|
||||
insnContext = IC_VEX_L_OPSIZE;
|
||||
else if (OpPrefix == X86Local::PD && HasVEX_WPrefix)
|
||||
else if (OpPrefix == X86Local::PD && VEX_WPrefix == X86Local::VEX_W1)
|
||||
insnContext = IC_VEX_W_OPSIZE;
|
||||
else if (OpPrefix == X86Local::PD)
|
||||
insnContext = IC_VEX_OPSIZE;
|
||||
@ -386,11 +390,11 @@ InstructionContext RecognizableInstr::insnContext() const {
|
||||
insnContext = IC_VEX_L_XS;
|
||||
else if (HasVEX_LPrefix && OpPrefix == X86Local::XD)
|
||||
insnContext = IC_VEX_L_XD;
|
||||
else if (HasVEX_WPrefix && OpPrefix == X86Local::XS)
|
||||
else if (VEX_WPrefix == X86Local::VEX_W1 && OpPrefix == X86Local::XS)
|
||||
insnContext = IC_VEX_W_XS;
|
||||
else if (HasVEX_WPrefix && OpPrefix == X86Local::XD)
|
||||
else if (VEX_WPrefix == X86Local::VEX_W1 && OpPrefix == X86Local::XD)
|
||||
insnContext = IC_VEX_W_XD;
|
||||
else if (HasVEX_WPrefix && OpPrefix == X86Local::PS)
|
||||
else if (VEX_WPrefix == X86Local::VEX_W1 && OpPrefix == X86Local::PS)
|
||||
insnContext = IC_VEX_W;
|
||||
else if (HasVEX_LPrefix && OpPrefix == X86Local::PS)
|
||||
insnContext = IC_VEX_L;
|
||||
|
@ -55,8 +55,8 @@ private:
|
||||
bool HasREX_WPrefix;
|
||||
/// The hasVEX_4V field from the record
|
||||
bool HasVEX_4V;
|
||||
/// The hasVEX_WPrefix field from the record
|
||||
bool HasVEX_WPrefix;
|
||||
/// The VEX_WPrefix field from the record
|
||||
uint8_t VEX_WPrefix;
|
||||
/// Inferred from the operands; indicates whether the L bit in the VEX prefix is set
|
||||
bool HasVEX_LPrefix;
|
||||
/// The ignoreVEX_L field from the record
|
||||
|
Loading…
x
Reference in New Issue
Block a user