X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FX86%2FX86InstrFormats.td;h=344c14c112a0eeb22c59c0d44a3bd6be2b34d20f;hb=0be938e38916cecd4d3406c8531a341b2e1c9ec5;hp=76e65086f3abd31867893a9c086067e046ba1a55;hpb=6596a6207627ed59f568883924a21e642934c083;p=oota-llvm.git diff --git a/lib/Target/X86/X86InstrFormats.td b/lib/Target/X86/X86InstrFormats.td index 76e65086f3a..344c14c112a 100644 --- a/lib/Target/X86/X86InstrFormats.td +++ b/lib/Target/X86/X86InstrFormats.td @@ -39,6 +39,8 @@ def MRM_E8 : Format<39>; def MRM_F0 : Format<40>; def MRM_F8 : Format<41>; def MRM_F9 : Format<42>; +def RawFrmImm8 : Format<43>; +def RawFrmImm16 : Format<44>; // ImmType - This specifies the immediate type used by an instruction. This is // part of the ad-hoc solution used to emit machine instruction encodings by our @@ -50,9 +52,10 @@ def NoImm : ImmType<0>; def Imm8 : ImmType<1>; def Imm8PCRel : ImmType<2>; def Imm16 : ImmType<3>; -def Imm32 : ImmType<4>; -def Imm32PCRel : ImmType<5>; -def Imm64 : ImmType<6>; +def Imm16PCRel : ImmType<4>; +def Imm32 : ImmType<5>; +def Imm32PCRel : ImmType<6>; +def Imm64 : ImmType<7>; // FPFormat - This specifies what form this FP instruction has. This is used by // the Floating-Point stackifier pass. @@ -104,6 +107,9 @@ class TF { bits<4> Prefix = 15; } class VEX { bit hasVEXPrefix = 1; } class VEX_W { bit hasVEX_WPrefix = 1; } class VEX_4V : VEX { bit hasVEX_4VPrefix = 1; } +class VEX_I8IMM { bit hasVEX_i8ImmReg = 1; } +class VEX_L { bit hasVEX_L = 1; } +class Has3DNow0F0FOpcode { bit has3DNow0F0FOpcode = 1; } class X86Inst opcod, Format f, ImmType i, dag outs, dag ins, string AsmStr, Domain d = GenericDomain> @@ -119,6 +125,9 @@ class X86Inst opcod, Format f, ImmType i, dag outs, dag ins, dag InOperandList = ins; string AsmString = AsmStr; + // If this is a pseudo instruction, mark it isCodeGenOnly. + let isCodeGenOnly = !eq(!cast(f), "Pseudo"); + // // Attributes specific to X86 instructions... // @@ -126,14 +135,18 @@ class X86Inst opcod, Format f, ImmType i, dag outs, dag ins, bit hasAdSizePrefix = 0; // Does this inst have a 0x67 prefix? bits<4> Prefix = 0; // Which prefix byte does this inst have? - bit hasREX_WPrefix = 0; // Does this inst requires the REX.W prefix? + bit hasREX_WPrefix = 0; // Does this inst require the REX.W prefix? FPFormat FPForm = NotFP; // What flavor of FP instruction is this? bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix? bits<2> SegOvrBits = 0; // Segment override prefix. Domain ExeDomain = d; - bit hasVEXPrefix = 0; // Does this inst requires a VEX prefix? + bit hasVEXPrefix = 0; // Does this inst require a VEX prefix? bit hasVEX_WPrefix = 0; // Does this inst set the VEX_W field? - bit hasVEX_4VPrefix = 0; // Does this inst requires the VEX.VVVV field? + bit hasVEX_4VPrefix = 0; // Does this inst require the VEX.VVVV field? + bit hasVEX_i8ImmReg = 0; // Does this inst require the last source register + // to be encoded in a immediate field? + bit hasVEX_L = 0; // Does this inst use large (256-bit) registers? + bit has3DNow0F0FOpcode =0;// Wacky 3dNow! encoding? // TSFlags layout should be kept in sync with X86InstrInfo.h. let TSFlags{5-0} = FormBits; @@ -150,6 +163,14 @@ class X86Inst opcod, Format f, ImmType i, dag outs, dag ins, let TSFlags{32} = hasVEXPrefix; let TSFlags{33} = hasVEX_WPrefix; let TSFlags{34} = hasVEX_4VPrefix; + let TSFlags{35} = hasVEX_i8ImmReg; + let TSFlags{36} = hasVEX_L; + let TSFlags{37} = has3DNow0F0FOpcode; +} + +class PseudoI pattern> + : X86Inst<0, Pseudo, NoImm, oops, iops, ""> { + let Pattern = pattern; } class I o, Format f, dag outs, dag ins, string asm, @@ -183,6 +204,13 @@ class Ii32 o, Format f, dag outs, dag ins, string asm, let CodeSize = 3; } +class Ii16PCRel o, Format f, dag outs, dag ins, string asm, + list pattern> + : X86Inst { + let Pattern = pattern; + let CodeSize = 3; +} + class Ii32PCRel o, Format f, dag outs, dag ins, string asm, list pattern> : X86Inst { @@ -195,7 +223,7 @@ class Ii32PCRel o, Format f, dag outs, dag ins, string asm, class FPI o, Format F, dag outs, dag ins, string asm> : I {} -// FpI_ - Floating Point Psuedo Instruction template. Not Predicated. +// FpI_ - Floating Point Pseudo Instruction template. Not Predicated. class FpI_ pattern> : X86Inst<0, Pseudo, NoImm, outs, ins, ""> { let FPForm = fp; @@ -209,13 +237,13 @@ class FpI_ pattern> // Iseg32 - 16-bit segment selector, 32-bit offset class Iseg16 o, Format f, dag outs, dag ins, string asm, - list pattern> : X86Inst { + list pattern> : X86Inst { let Pattern = pattern; let CodeSize = 3; } class Iseg32 o, Format f, dag outs, dag ins, string asm, - list pattern> : X86Inst { + list pattern> : X86Inst { let Pattern = pattern; let CodeSize = 3; } @@ -223,8 +251,7 @@ class Iseg32 o, Format f, dag outs, dag ins, string asm, // SI - SSE 1 & 2 scalar instructions class SI o, Format F, dag outs, dag ins, string asm, list pattern> : I { - let Predicates = !if(hasVEXPrefix /* VEX_4V */, - !if(!eq(Prefix, 11 /* XD */), [HasAVX, HasSSE2], [HasAVX, HasSSE1]), + let Predicates = !if(hasVEXPrefix /* VEX */, [HasAVX], !if(!eq(Prefix, 12 /* XS */), [HasSSE1], [HasSSE2])); // AVX instructions have a 'v' prefix in the mnemonic @@ -235,8 +262,7 @@ class SI o, Format F, dag outs, dag ins, string asm, list pattern> class SIi8 o, Format F, dag outs, dag ins, string asm, list pattern> : Ii8 { - let Predicates = !if(hasVEXPrefix /* VEX_4V */, - !if(!eq(Prefix, 11 /* XD */), [HasAVX, HasSSE2], [HasAVX, HasSSE1]), + let Predicates = !if(hasVEXPrefix /* VEX */, [HasAVX], !if(!eq(Prefix, 12 /* XS */), [HasSSE1], [HasSSE2])); // AVX instructions have a 'v' prefix in the mnemonic @@ -247,8 +273,7 @@ class SIi8 o, Format F, dag outs, dag ins, string asm, class PI o, Format F, dag outs, dag ins, string asm, list pattern, Domain d> : I { - let Predicates = !if(hasVEXPrefix /* VEX_4V */, - !if(hasOpSizePrefix /* OpSize */, [HasAVX, HasSSE2], [HasAVX, HasSSE1]), + let Predicates = !if(hasVEXPrefix /* VEX */, [HasAVX], !if(hasOpSizePrefix /* OpSize */, [HasSSE2], [HasSSE1])); // AVX instructions have a 'v' prefix in the mnemonic @@ -259,8 +284,7 @@ class PI o, Format F, dag outs, dag ins, string asm, list pattern, class PIi8 o, Format F, dag outs, dag ins, string asm, list pattern, Domain d> : Ii8 { - let Predicates = !if(hasVEX_4VPrefix /* VEX_4V */, - !if(hasOpSizePrefix /* OpSize */, [HasAVX, HasSSE2], [HasAVX, HasSSE1]), + let Predicates = !if(hasVEX_4VPrefix /* VEX */, [HasAVX], !if(hasOpSizePrefix /* OpSize */, [HasSSE2], [HasSSE1])); // AVX instructions have a 'v' prefix in the mnemonic @@ -290,11 +314,11 @@ class PSIi8 o, Format F, dag outs, dag ins, string asm, class VSSI o, Format F, dag outs, dag ins, string asm, list pattern> : I, XS, - Requires<[HasAVX, HasSSE1]>; + Requires<[HasAVX]>; class VPSI o, Format F, dag outs, dag ins, string asm, list pattern> : I, - Requires<[HasAVX, HasSSE1]>; + Requires<[HasAVX]>; // SSE2 Instruction Templates: // @@ -324,11 +348,11 @@ class PDIi8 o, Format F, dag outs, dag ins, string asm, class VSDI o, Format F, dag outs, dag ins, string asm, list pattern> : I, XD, - Requires<[HasAVX, HasSSE2]>; + Requires<[HasAVX]>; class VPDI o, Format F, dag outs, dag ins, string asm, list pattern> : I, - OpSize, Requires<[HasAVX, HasSSE2]>; + OpSize, Requires<[HasAVX]>; // SSE3 Instruction Templates: // @@ -400,6 +424,20 @@ class SS42AI o, Format F, dag outs, dag ins, string asm, : Ii8, TA, Requires<[HasSSE42]>; +// AVX Instruction Templates: +// Instructions introduced in AVX (no SSE equivalent forms) +// +// AVX8I - AVX instructions with T8 and OpSize prefix. +// AVXAIi8 - AVX instructions with TA, OpSize prefix and ImmT = Imm8. +class AVX8I o, Format F, dag outs, dag ins, string asm, + list pattern> + : I, T8, OpSize, + Requires<[HasAVX]>; +class AVXAIi8 o, Format F, dag outs, dag ins, string asm, + list pattern> + : Ii8, TA, OpSize, + Requires<[HasAVX]>; + // AES Instruction Templates: // // AES8I @@ -414,6 +452,18 @@ class AESAI o, Format F, dag outs, dag ins, string asm, : Ii8, TA, Requires<[HasAES]>; +// CLMUL Instruction Templates +class CLMULIi8 o, Format F, dag outs, dag ins, string asm, + listpattern> + : Ii8, TA, + OpSize, VEX_4V, Requires<[HasAVX, HasCLMUL]>; + +// FMA3 Instruction Templates +class FMA3 o, Format F, dag outs, dag ins, string asm, + listpattern> + : I, T8, + OpSize, VEX_4V, Requires<[HasFMA3]>; + // X86-64 Instruction templates... //