1//===-- X86InstrFormats.td - X86 Instruction Formats -------*- tablegen -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9//===----------------------------------------------------------------------===// 10// X86 Instruction Format Definitions. 11// 12 13// Format specifies the encoding used by the instruction. This is part of the 14// ad-hoc solution used to emit machine instruction encodings by our machine 15// code emitter. 16class Format<bits<7> val> { 17 bits<7> Value = val; 18} 19 20def Pseudo : Format<0>; 21def RawFrm : Format<1>; 22def AddRegFrm : Format<2>; 23def RawFrmMemOffs : Format<3>; 24def RawFrmSrc : Format<4>; 25def RawFrmDst : Format<5>; 26def RawFrmDstSrc : Format<6>; 27def RawFrmImm8 : Format<7>; 28def RawFrmImm16 : Format<8>; 29def AddCCFrm : Format<9>; 30def PrefixByte : Format<10>; 31def MRMr0 : Format<21>; 32def MRMSrcMemFSIB : Format<22>; 33def MRMDestMemFSIB : Format<23>; 34def MRMDestMem : Format<24>; 35def MRMSrcMem : Format<25>; 36def MRMSrcMem4VOp3 : Format<26>; 37def MRMSrcMemOp4 : Format<27>; 38def MRMSrcMemCC : Format<28>; 39def MRMXmCC: Format<30>; 40def MRMXm : Format<31>; 41def MRM0m : Format<32>; def MRM1m : Format<33>; def MRM2m : Format<34>; 42def MRM3m : Format<35>; def MRM4m : Format<36>; def MRM5m : Format<37>; 43def MRM6m : Format<38>; def MRM7m : Format<39>; 44def MRMDestReg : Format<40>; 45def MRMSrcReg : Format<41>; 46def MRMSrcReg4VOp3 : Format<42>; 47def MRMSrcRegOp4 : Format<43>; 48def MRMSrcRegCC : Format<44>; 49def MRMXrCC: Format<46>; 50def MRMXr : Format<47>; 51def MRM0r : Format<48>; def MRM1r : Format<49>; def MRM2r : Format<50>; 52def MRM3r : Format<51>; def MRM4r : Format<52>; def MRM5r : Format<53>; 53def MRM6r : Format<54>; def MRM7r : Format<55>; 54def MRM0X : Format<56>; def MRM1X : Format<57>; def MRM2X : Format<58>; 55def MRM3X : Format<59>; def MRM4X : Format<60>; def MRM5X : Format<61>; 56def MRM6X : Format<62>; def MRM7X : Format<63>; 57def MRM_C0 : Format<64>; def MRM_C1 : Format<65>; def MRM_C2 : Format<66>; 58def MRM_C3 : Format<67>; def MRM_C4 : Format<68>; def MRM_C5 : Format<69>; 59def MRM_C6 : Format<70>; def MRM_C7 : Format<71>; def MRM_C8 : Format<72>; 60def MRM_C9 : Format<73>; def MRM_CA : Format<74>; def MRM_CB : Format<75>; 61def MRM_CC : Format<76>; def MRM_CD : Format<77>; def MRM_CE : Format<78>; 62def MRM_CF : Format<79>; def MRM_D0 : Format<80>; def MRM_D1 : Format<81>; 63def MRM_D2 : Format<82>; def MRM_D3 : Format<83>; def MRM_D4 : Format<84>; 64def MRM_D5 : Format<85>; def MRM_D6 : Format<86>; def MRM_D7 : Format<87>; 65def MRM_D8 : Format<88>; def MRM_D9 : Format<89>; def MRM_DA : Format<90>; 66def MRM_DB : Format<91>; def MRM_DC : Format<92>; def MRM_DD : Format<93>; 67def MRM_DE : Format<94>; def MRM_DF : Format<95>; def MRM_E0 : Format<96>; 68def MRM_E1 : Format<97>; def MRM_E2 : Format<98>; def MRM_E3 : Format<99>; 69def MRM_E4 : Format<100>; def MRM_E5 : Format<101>; def MRM_E6 : Format<102>; 70def MRM_E7 : Format<103>; def MRM_E8 : Format<104>; def MRM_E9 : Format<105>; 71def MRM_EA : Format<106>; def MRM_EB : Format<107>; def MRM_EC : Format<108>; 72def MRM_ED : Format<109>; def MRM_EE : Format<110>; def MRM_EF : Format<111>; 73def MRM_F0 : Format<112>; def MRM_F1 : Format<113>; def MRM_F2 : Format<114>; 74def MRM_F3 : Format<115>; def MRM_F4 : Format<116>; def MRM_F5 : Format<117>; 75def MRM_F6 : Format<118>; def MRM_F7 : Format<119>; def MRM_F8 : Format<120>; 76def MRM_F9 : Format<121>; def MRM_FA : Format<122>; def MRM_FB : Format<123>; 77def MRM_FC : Format<124>; def MRM_FD : Format<125>; def MRM_FE : Format<126>; 78def MRM_FF : Format<127>; 79 80// ImmType - This specifies the immediate type used by an instruction. This is 81// part of the ad-hoc solution used to emit machine instruction encodings by our 82// machine code emitter. 83class ImmType<bits<4> val> { 84 bits<4> Value = val; 85} 86def NoImm : ImmType<0>; 87def Imm8 : ImmType<1>; 88def Imm8PCRel : ImmType<2>; 89def Imm8Reg : ImmType<3>; // Register encoded in [7:4]. 90def Imm16 : ImmType<4>; 91def Imm16PCRel : ImmType<5>; 92def Imm32 : ImmType<6>; 93def Imm32PCRel : ImmType<7>; 94def Imm32S : ImmType<8>; 95def Imm64 : ImmType<9>; 96 97// FPFormat - This specifies what form this FP instruction has. This is used by 98// the Floating-Point stackifier pass. 99class FPFormat<bits<3> val> { 100 bits<3> Value = val; 101} 102def NotFP : FPFormat<0>; 103def ZeroArgFP : FPFormat<1>; 104def OneArgFP : FPFormat<2>; 105def OneArgFPRW : FPFormat<3>; 106def TwoArgFP : FPFormat<4>; 107def CompareFP : FPFormat<5>; 108def CondMovFP : FPFormat<6>; 109def SpecialFP : FPFormat<7>; 110 111// Class specifying the SSE execution domain, used by the SSEDomainFix pass. 112// Keep in sync with tables in X86InstrInfo.cpp. 113class Domain<bits<2> val> { 114 bits<2> Value = val; 115} 116def GenericDomain : Domain<0>; 117def SSEPackedSingle : Domain<1>; 118def SSEPackedDouble : Domain<2>; 119def SSEPackedInt : Domain<3>; 120 121// Class specifying the vector form of the decompressed 122// displacement of 8-bit. 123class CD8VForm<bits<3> val> { 124 bits<3> Value = val; 125} 126def CD8VF : CD8VForm<0>; // v := VL 127def CD8VH : CD8VForm<1>; // v := VL/2 128def CD8VQ : CD8VForm<2>; // v := VL/4 129def CD8VO : CD8VForm<3>; // v := VL/8 130// The tuple (subvector) forms. 131def CD8VT1 : CD8VForm<4>; // v := 1 132def CD8VT2 : CD8VForm<5>; // v := 2 133def CD8VT4 : CD8VForm<6>; // v := 4 134def CD8VT8 : CD8VForm<7>; // v := 8 135 136// Class specifying the prefix used an opcode extension. 137class Prefix<bits<3> val> { 138 bits<3> Value = val; 139} 140def NoPrfx : Prefix<0>; 141def PD : Prefix<1>; 142def XS : Prefix<2>; 143def XD : Prefix<3>; 144def PS : Prefix<4>; // Similar to NoPrfx, but disassembler uses this to know 145 // that other instructions with this opcode use PD/XS/XD 146 // and if any of those is not supported they shouldn't 147 // decode to this instruction. e.g. ANDSS/ANDSD don't 148 // exist, but the 0xf2/0xf3 encoding shouldn't 149 // disable to ANDPS. 150 151// Class specifying the opcode map. 152class Map<bits<4> val> { 153 bits<4> Value = val; 154} 155def OB : Map<0>; 156def TB : Map<1>; 157def T8 : Map<2>; 158def TA : Map<3>; 159def XOP8 : Map<4>; 160def XOP9 : Map<5>; 161def XOPA : Map<6>; 162def ThreeDNow : Map<7>; 163def T_MAP5 : Map<8>; 164def T_MAP6 : Map<9>; 165 166// Class specifying the encoding 167class Encoding<bits<2> val> { 168 bits<2> Value = val; 169} 170def EncNormal : Encoding<0>; 171def EncVEX : Encoding<1>; 172def EncXOP : Encoding<2>; 173def EncEVEX : Encoding<3>; 174 175// Operand size for encodings that change based on mode. 176class OperandSize<bits<2> val> { 177 bits<2> Value = val; 178} 179def OpSizeFixed : OperandSize<0>; // Never needs a 0x66 prefix. 180def OpSize16 : OperandSize<1>; // Needs 0x66 prefix in 32-bit mode. 181def OpSize32 : OperandSize<2>; // Needs 0x66 prefix in 16-bit mode. 182 183// Address size for encodings that change based on mode. 184class AddressSize<bits<2> val> { 185 bits<2> Value = val; 186} 187def AdSizeX : AddressSize<0>; // Address size determined using addr operand. 188def AdSize16 : AddressSize<1>; // Encodes a 16-bit address. 189def AdSize32 : AddressSize<2>; // Encodes a 32-bit address. 190def AdSize64 : AddressSize<3>; // Encodes a 64-bit address. 191 192// Prefix byte classes which are used to indicate to the ad-hoc machine code 193// emitter that various prefix bytes are required. 194class OpSize16 { OperandSize OpSize = OpSize16; } 195class OpSize32 { OperandSize OpSize = OpSize32; } 196class AdSize16 { AddressSize AdSize = AdSize16; } 197class AdSize32 { AddressSize AdSize = AdSize32; } 198class AdSize64 { AddressSize AdSize = AdSize64; } 199class REX_W { bit hasREX_W = 1; } 200class LOCK { bit hasLockPrefix = 1; } 201class REP { bit hasREPPrefix = 1; } 202class TB { Map OpMap = TB; } 203class T8 { Map OpMap = T8; } 204class TA { Map OpMap = TA; } 205class XOP8 { Map OpMap = XOP8; Prefix OpPrefix = PS; } 206class XOP9 { Map OpMap = XOP9; Prefix OpPrefix = PS; } 207class XOPA { Map OpMap = XOPA; Prefix OpPrefix = PS; } 208class ThreeDNow { Map OpMap = ThreeDNow; } 209class T_MAP5 { Map OpMap = T_MAP5; } 210class T_MAP5PS : T_MAP5 { Prefix OpPrefix = PS; } // none 211class T_MAP5PD : T_MAP5 { Prefix OpPrefix = PD; } // 0x66 212class T_MAP5XS : T_MAP5 { Prefix OpPrefix = XS; } // 0xF3 213class T_MAP5XD : T_MAP5 { Prefix OpPrefix = XD; } // 0xF2 214class T_MAP6 { Map OpMap = T_MAP6; } 215class T_MAP6PS : T_MAP6 { Prefix OpPrefix = PS; } 216class T_MAP6PD : T_MAP6 { Prefix OpPrefix = PD; } 217class T_MAP6XS : T_MAP6 { Prefix OpPrefix = XS; } 218class T_MAP6XD : T_MAP6 { Prefix OpPrefix = XD; } 219class OBXS { Prefix OpPrefix = XS; } 220class PS : TB { Prefix OpPrefix = PS; } 221class PD : TB { Prefix OpPrefix = PD; } 222class XD : TB { Prefix OpPrefix = XD; } 223class XS : TB { Prefix OpPrefix = XS; } 224class T8PS : T8 { Prefix OpPrefix = PS; } 225class T8PD : T8 { Prefix OpPrefix = PD; } 226class T8XD : T8 { Prefix OpPrefix = XD; } 227class T8XS : T8 { Prefix OpPrefix = XS; } 228class TAPS : TA { Prefix OpPrefix = PS; } 229class TAPD : TA { Prefix OpPrefix = PD; } 230class TAXD : TA { Prefix OpPrefix = XD; } 231class TAXS : TA { Prefix OpPrefix = XS; } 232class VEX { Encoding OpEnc = EncVEX; } 233class VEX_W { bit HasVEX_W = 1; } 234class VEX_WIG { bit IgnoresVEX_W = 1; } 235// Special version of VEX_W that can be changed to VEX.W==0 for EVEX2VEX. 236class VEX_W1X { bit HasVEX_W = 1; bit EVEX_W1_VEX_W0 = 1; } 237class VEX_4V : VEX { bit hasVEX_4V = 1; } 238class VEX_L { bit hasVEX_L = 1; } 239class VEX_LIG { bit ignoresVEX_L = 1; } 240class EVEX { Encoding OpEnc = EncEVEX; } 241class EVEX_4V : EVEX { bit hasVEX_4V = 1; } 242class EVEX_K { bit hasEVEX_K = 1; } 243class EVEX_KZ : EVEX_K { bit hasEVEX_Z = 1; } 244class EVEX_B { bit hasEVEX_B = 1; } 245class EVEX_RC { bit hasEVEX_RC = 1; } 246class EVEX_V512 { bit hasEVEX_L2 = 1; bit hasVEX_L = 0; } 247class EVEX_V256 { bit hasEVEX_L2 = 0; bit hasVEX_L = 1; } 248class EVEX_V128 { bit hasEVEX_L2 = 0; bit hasVEX_L = 0; } 249class NOTRACK { bit hasNoTrackPrefix = 1; } 250class SIMD_EXC { list<Register> Uses = [MXCSR]; bit mayRaiseFPException = 1; } 251 252// Specify AVX512 8-bit compressed displacement encoding based on the vector 253// element size in bits (8, 16, 32, 64) and the CDisp8 form. 254class EVEX_CD8<int esize, CD8VForm form> { 255 int CD8_EltSize = !srl(esize, 3); 256 bits<3> CD8_Form = form.Value; 257} 258 259class XOP { Encoding OpEnc = EncXOP; } 260class XOP_4V : XOP { bit hasVEX_4V = 1; } 261 262// Specify the alternative register form instruction to replace the current 263// instruction in case it was picked during generation of memory folding tables 264class FoldGenData<string _RegisterForm> { 265 string FoldGenRegForm = _RegisterForm; 266} 267 268// Provide a specific instruction to be used by the EVEX2VEX conversion. 269class EVEX2VEXOverride<string VEXInstrName> { 270 string EVEX2VEXOverride = VEXInstrName; 271} 272 273// Mark the instruction as "illegal to memory fold/unfold" 274class NotMemoryFoldable { bit isMemoryFoldable = 0; } 275 276// Prevent EVEX->VEX conversion from considering this instruction. 277class NotEVEX2VEXConvertible { bit notEVEX2VEXConvertible = 1; } 278 279// Force the instruction to use VEX encoding. 280class ExplicitVEXPrefix { bit ExplicitVEXPrefix = 1; } 281 282class X86Inst<bits<8> opcod, Format f, ImmType i, dag outs, dag ins, 283 string AsmStr, Domain d = GenericDomain> 284 : Instruction { 285 let Namespace = "X86"; 286 287 bits<8> Opcode = opcod; 288 Format Form = f; 289 bits<7> FormBits = Form.Value; 290 ImmType ImmT = i; 291 292 dag OutOperandList = outs; 293 dag InOperandList = ins; 294 string AsmString = AsmStr; 295 296 // If this is a pseudo instruction, mark it isCodeGenOnly. 297 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo"); 298 299 let HasPositionOrder = 1; 300 301 // 302 // Attributes specific to X86 instructions... 303 // 304 bit ForceDisassemble = 0; // Force instruction to disassemble even though it's 305 // isCodeGenonly. Needed to hide an ambiguous 306 // AsmString from the parser, but still disassemble. 307 308 OperandSize OpSize = OpSizeFixed; // Does this instruction's encoding change 309 // based on operand size of the mode? 310 bits<2> OpSizeBits = OpSize.Value; 311 AddressSize AdSize = AdSizeX; // Does this instruction's encoding change 312 // based on address size of the mode? 313 bits<2> AdSizeBits = AdSize.Value; 314 315 Prefix OpPrefix = NoPrfx; // Which prefix byte does this inst have? 316 bits<3> OpPrefixBits = OpPrefix.Value; 317 Map OpMap = OB; // Which opcode map does this inst have? 318 bits<4> OpMapBits = OpMap.Value; 319 bit hasREX_W = 0; // Does this inst require the REX.W prefix? 320 FPFormat FPForm = NotFP; // What flavor of FP instruction is this? 321 bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix? 322 Domain ExeDomain = d; 323 bit hasREPPrefix = 0; // Does this inst have a REP prefix? 324 Encoding OpEnc = EncNormal; // Encoding used by this instruction 325 bits<2> OpEncBits = OpEnc.Value; 326 bit HasVEX_W = 0; // Does this inst set the VEX_W field? 327 bit IgnoresVEX_W = 0; // Does this inst ignore VEX_W field? 328 bit EVEX_W1_VEX_W0 = 0; // This EVEX inst with VEX.W==1 can become a VEX 329 // instruction with VEX.W == 0. 330 bit hasVEX_4V = 0; // Does this inst require the VEX.VVVV field? 331 bit hasVEX_L = 0; // Does this inst use large (256-bit) registers? 332 bit ignoresVEX_L = 0; // Does this instruction ignore the L-bit 333 bit hasEVEX_K = 0; // Does this inst require masking? 334 bit hasEVEX_Z = 0; // Does this inst set the EVEX_Z field? 335 bit hasEVEX_L2 = 0; // Does this inst set the EVEX_L2 field? 336 bit hasEVEX_B = 0; // Does this inst set the EVEX_B field? 337 bits<3> CD8_Form = 0; // Compressed disp8 form - vector-width. 338 // Declare it int rather than bits<4> so that all bits are defined when 339 // assigning to bits<7>. 340 int CD8_EltSize = 0; // Compressed disp8 form - element-size in bytes. 341 bit hasEVEX_RC = 0; // Explicitly specified rounding control in FP instruction. 342 bit hasNoTrackPrefix = 0; // Does this inst has 0x3E (NoTrack) prefix? 343 344 // Vector size in bytes. 345 bits<7> VectSize = !if(hasEVEX_L2, 64, !if(hasVEX_L, 32, 16)); 346 347 // The scaling factor for AVX512's compressed displacement is either 348 // - the size of a power-of-two number of elements or 349 // - the size of a single element for broadcasts or 350 // - the total vector size divided by a power-of-two number. 351 // Possible values are: 0 (non-AVX512 inst), 1, 2, 4, 8, 16, 32 and 64. 352 bits<7> CD8_Scale = !if (!eq (OpEnc.Value, EncEVEX.Value), 353 !if (CD8_Form{2}, 354 !shl(CD8_EltSize, CD8_Form{1-0}), 355 !if (hasEVEX_B, 356 CD8_EltSize, 357 !srl(VectSize, CD8_Form{1-0}))), 0); 358 359 // Used in the memory folding generation (TableGen backend) to point to an alternative 360 // instruction to replace the current one in case it got picked during generation. 361 string FoldGenRegForm = ?; 362 363 // Used to prevent an explicit EVEX2VEX override for this instruction. 364 string EVEX2VEXOverride = ?; 365 366 bit isMemoryFoldable = 1; // Is it allowed to memory fold/unfold this instruction? 367 bit notEVEX2VEXConvertible = 0; // Prevent EVEX->VEX conversion. 368 bit ExplicitVEXPrefix = 0; // Force the instruction to use VEX encoding. 369 // Force to check predicate before compress EVEX to VEX encoding. 370 bit checkVEXPredicate = 0; 371 // TSFlags layout should be kept in sync with X86BaseInfo.h. 372 let TSFlags{6-0} = FormBits; 373 let TSFlags{8-7} = OpSizeBits; 374 let TSFlags{10-9} = AdSizeBits; 375 // No need for 3rd bit, we don't need to distinguish NoPrfx from PS. 376 let TSFlags{12-11} = OpPrefixBits{1-0}; 377 let TSFlags{16-13} = OpMapBits; 378 let TSFlags{17} = hasREX_W; 379 let TSFlags{21-18} = ImmT.Value; 380 let TSFlags{24-22} = FPForm.Value; 381 let TSFlags{25} = hasLockPrefix; 382 let TSFlags{26} = hasREPPrefix; 383 let TSFlags{28-27} = ExeDomain.Value; 384 let TSFlags{30-29} = OpEncBits; 385 let TSFlags{38-31} = Opcode; 386 // Currently no need for second bit in TSFlags - W Ignore is equivalent to 0. 387 let TSFlags{39} = HasVEX_W; 388 let TSFlags{40} = hasVEX_4V; 389 let TSFlags{41} = hasVEX_L; 390 let TSFlags{42} = hasEVEX_K; 391 let TSFlags{43} = hasEVEX_Z; 392 let TSFlags{44} = hasEVEX_L2; 393 let TSFlags{45} = hasEVEX_B; 394 // If we run out of TSFlags bits, it's possible to encode this in 3 bits. 395 let TSFlags{52-46} = CD8_Scale; 396 let TSFlags{53} = hasEVEX_RC; 397 let TSFlags{54} = hasNoTrackPrefix; 398 let TSFlags{55} = ExplicitVEXPrefix; 399} 400 401class PseudoI<dag oops, dag iops, list<dag> pattern> 402 : X86Inst<0, Pseudo, NoImm, oops, iops, ""> { 403 let Pattern = pattern; 404} 405 406class I<bits<8> o, Format f, dag outs, dag ins, string asm, 407 list<dag> pattern, Domain d = GenericDomain> 408 : X86Inst<o, f, NoImm, outs, ins, asm, d> { 409 let Pattern = pattern; 410 let CodeSize = 3; 411} 412class Ii8<bits<8> o, Format f, dag outs, dag ins, string asm, 413 list<dag> pattern, Domain d = GenericDomain> 414 : X86Inst<o, f, Imm8, outs, ins, asm, d> { 415 let Pattern = pattern; 416 let CodeSize = 3; 417} 418class Ii8Reg<bits<8> o, Format f, dag outs, dag ins, string asm, 419 list<dag> pattern, Domain d = GenericDomain> 420 : X86Inst<o, f, Imm8Reg, outs, ins, asm, d> { 421 let Pattern = pattern; 422 let CodeSize = 3; 423} 424class Ii8PCRel<bits<8> o, Format f, dag outs, dag ins, string asm, 425 list<dag> pattern> 426 : X86Inst<o, f, Imm8PCRel, outs, ins, asm> { 427 let Pattern = pattern; 428 let CodeSize = 3; 429} 430class Ii16<bits<8> o, Format f, dag outs, dag ins, string asm, 431 list<dag> pattern> 432 : X86Inst<o, f, Imm16, outs, ins, asm> { 433 let Pattern = pattern; 434 let CodeSize = 3; 435} 436class Ii32<bits<8> o, Format f, dag outs, dag ins, string asm, 437 list<dag> pattern> 438 : X86Inst<o, f, Imm32, outs, ins, asm> { 439 let Pattern = pattern; 440 let CodeSize = 3; 441} 442class Ii32S<bits<8> o, Format f, dag outs, dag ins, string asm, 443 list<dag> pattern> 444 : X86Inst<o, f, Imm32S, outs, ins, asm> { 445 let Pattern = pattern; 446 let CodeSize = 3; 447} 448 449class Ii64<bits<8> o, Format f, dag outs, dag ins, string asm, 450 list<dag> pattern> 451 : X86Inst<o, f, Imm64, outs, ins, asm> { 452 let Pattern = pattern; 453 let CodeSize = 3; 454} 455 456class Ii16PCRel<bits<8> o, Format f, dag outs, dag ins, string asm, 457 list<dag> pattern> 458 : X86Inst<o, f, Imm16PCRel, outs, ins, asm> { 459 let Pattern = pattern; 460 let CodeSize = 3; 461} 462 463class Ii32PCRel<bits<8> o, Format f, dag outs, dag ins, string asm, 464 list<dag> pattern> 465 : X86Inst<o, f, Imm32PCRel, outs, ins, asm> { 466 let Pattern = pattern; 467 let CodeSize = 3; 468} 469 470// FPStack Instruction Templates: 471// FPI - Floating Point Instruction template. 472class FPI<bits<8> o, Format F, dag outs, dag ins, string asm> 473 : I<o, F, outs, ins, asm, []> { 474 let Defs = [FPSW]; 475} 476 477// FpI_ - Floating Point Pseudo Instruction template. Not Predicated. 478class FpI_<dag outs, dag ins, FPFormat fp, list<dag> pattern> 479 : PseudoI<outs, ins, pattern> { 480 let FPForm = fp; 481 let Defs = [FPSW]; 482} 483 484// Templates for instructions that use a 16- or 32-bit segmented address as 485// their only operand: lcall (FAR CALL) and ljmp (FAR JMP) 486// 487// Iseg16 - 16-bit segment selector, 16-bit offset 488// Iseg32 - 16-bit segment selector, 32-bit offset 489 490class Iseg16 <bits<8> o, Format f, dag outs, dag ins, string asm, 491 list<dag> pattern> 492 : X86Inst<o, f, Imm16, outs, ins, asm> { 493 let Pattern = pattern; 494 let CodeSize = 3; 495} 496 497class Iseg32 <bits<8> o, Format f, dag outs, dag ins, string asm, 498 list<dag> pattern> 499 : X86Inst<o, f, Imm32, outs, ins, asm> { 500 let Pattern = pattern; 501 let CodeSize = 3; 502} 503 504// SI - SSE 1 & 2 scalar instructions 505class SI<bits<8> o, Format F, dag outs, dag ins, string asm, 506 list<dag> pattern, Domain d = GenericDomain> 507 : I<o, F, outs, ins, asm, pattern, d> { 508 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512], 509 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX], 510 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1], 511 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2], 512 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2], 513 [UseSSE1]))))); 514 515 // AVX instructions have a 'v' prefix in the mnemonic 516 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm), 517 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm), 518 asm)); 519} 520 521// SI - SSE 1 & 2 scalar intrinsics - vex form available on AVX512 522class SI_Int<bits<8> o, Format F, dag outs, dag ins, string asm, 523 list<dag> pattern, Domain d = GenericDomain> 524 : I<o, F, outs, ins, asm, pattern, d> { 525 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512], 526 !if(!eq(OpEnc.Value, EncVEX.Value), [UseAVX], 527 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1], 528 !if(!eq(OpPrefix.Value, XD.Value), [UseSSE2], 529 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2], 530 [UseSSE1]))))); 531 532 // AVX instructions have a 'v' prefix in the mnemonic 533 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm), 534 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm), 535 asm)); 536} 537// SIi8 - SSE 1 & 2 scalar instructions - vex form available on AVX512 538class SIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 539 list<dag> pattern> 540 : Ii8<o, F, outs, ins, asm, pattern> { 541 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512], 542 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX], 543 !if(!eq(OpPrefix.Value, XS.Value), [UseSSE1], 544 [UseSSE2]))); 545 546 // AVX instructions have a 'v' prefix in the mnemonic 547 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm), 548 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm), 549 asm)); 550} 551 552// PI - SSE 1 & 2 packed instructions 553class PI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern, 554 Domain d> 555 : I<o, F, outs, ins, asm, pattern, d> { 556 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512], 557 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX], 558 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2], 559 [UseSSE1]))); 560 561 // AVX instructions have a 'v' prefix in the mnemonic 562 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm), 563 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm), 564 asm)); 565} 566 567// MMXPI - SSE 1 & 2 packed instructions with MMX operands 568class MMXPI<bits<8> o, Format F, dag outs, dag ins, string asm, list<dag> pattern, 569 Domain d> 570 : I<o, F, outs, ins, asm, pattern, d> { 571 let Predicates = !if(!eq(OpPrefix.Value, PD.Value), [HasMMX, HasSSE2], 572 [HasMMX, HasSSE1]); 573} 574 575// PIi8 - SSE 1 & 2 packed instructions with immediate 576class PIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 577 list<dag> pattern, Domain d> 578 : Ii8<o, F, outs, ins, asm, pattern, d> { 579 let Predicates = !if(!eq(OpEnc.Value, EncEVEX.Value), [HasAVX512], 580 !if(!eq(OpEnc.Value, EncVEX.Value), [HasAVX], 581 !if(!eq(OpPrefix.Value, PD.Value), [UseSSE2], 582 [UseSSE1]))); 583 584 // AVX instructions have a 'v' prefix in the mnemonic 585 let AsmString = !if(!eq(OpEnc.Value, EncEVEX.Value), !strconcat("v", asm), 586 !if(!eq(OpEnc.Value, EncVEX.Value), !strconcat("v", asm), 587 asm)); 588} 589 590// SSE1 Instruction Templates: 591// 592// SSI - SSE1 instructions with XS prefix. 593// PSI - SSE1 instructions with PS prefix. 594// PSIi8 - SSE1 instructions with ImmT == Imm8 and PS prefix. 595// VSSI - SSE1 instructions with XS prefix in AVX form. 596// VPSI - SSE1 instructions with PS prefix in AVX form, packed single. 597 598class SSI<bits<8> o, Format F, dag outs, dag ins, string asm, 599 list<dag> pattern> 600 : I<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE1]>; 601class SSIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 602 list<dag> pattern> 603 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE1]>; 604class PSI<bits<8> o, Format F, dag outs, dag ins, string asm, 605 list<dag> pattern> 606 : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, PS, 607 Requires<[UseSSE1]>; 608class PSIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 609 list<dag> pattern> 610 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedSingle>, PS, 611 Requires<[UseSSE1]>; 612class VSSI<bits<8> o, Format F, dag outs, dag ins, string asm, 613 list<dag> pattern> 614 : I<o, F, outs, ins, !strconcat("v", asm), pattern>, XS, 615 Requires<[HasAVX]>; 616class VPSI<bits<8> o, Format F, dag outs, dag ins, string asm, 617 list<dag> pattern> 618 : I<o, F, outs, ins, !strconcat("v", asm), pattern, SSEPackedSingle>, PS, 619 Requires<[HasAVX]>; 620 621// SSE2 Instruction Templates: 622// 623// SDI - SSE2 instructions with XD prefix. 624// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix. 625// S2SI - SSE2 instructions with XS prefix. 626// SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix. 627// PDI - SSE2 instructions with PD prefix, packed double domain. 628// PDIi8 - SSE2 instructions with ImmT == Imm8 and PD prefix. 629// VSDI - SSE2 scalar instructions with XD prefix in AVX form. 630// VPDI - SSE2 vector instructions with PD prefix in AVX form, 631// packed double domain. 632// VS2I - SSE2 scalar instructions with PD prefix in AVX form. 633// S2I - SSE2 scalar instructions with PD prefix. 634// MMXSDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix as well as 635// MMX operands. 636// MMXSSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix as well as 637// MMX operands. 638 639class SDI<bits<8> o, Format F, dag outs, dag ins, string asm, 640 list<dag> pattern> 641 : I<o, F, outs, ins, asm, pattern>, XD, Requires<[UseSSE2]>; 642class SDIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 643 list<dag> pattern> 644 : Ii8<o, F, outs, ins, asm, pattern>, XD, Requires<[UseSSE2]>; 645class S2SI<bits<8> o, Format F, dag outs, dag ins, string asm, 646 list<dag> pattern> 647 : I<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>; 648class S2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 649 list<dag> pattern> 650 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[UseSSE2]>; 651class PDI<bits<8> o, Format F, dag outs, dag ins, string asm, 652 list<dag> pattern> 653 : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, PD, 654 Requires<[UseSSE2]>; 655class PDIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 656 list<dag> pattern> 657 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedDouble>, PD, 658 Requires<[UseSSE2]>; 659class VSDI<bits<8> o, Format F, dag outs, dag ins, string asm, 660 list<dag> pattern> 661 : I<o, F, outs, ins, !strconcat("v", asm), pattern>, XD, 662 Requires<[UseAVX]>; 663class VS2SI<bits<8> o, Format F, dag outs, dag ins, string asm, 664 list<dag> pattern> 665 : I<o, F, outs, ins, !strconcat("v", asm), pattern>, XS, 666 Requires<[HasAVX]>; 667class VPDI<bits<8> o, Format F, dag outs, dag ins, string asm, 668 list<dag> pattern> 669 : I<o, F, outs, ins, !strconcat("v", asm), pattern, SSEPackedDouble>, 670 PD, Requires<[HasAVX]>; 671class VS2I<bits<8> o, Format F, dag outs, dag ins, string asm, 672 list<dag> pattern> 673 : I<o, F, outs, ins, !strconcat("v", asm), pattern>, PD, 674 Requires<[UseAVX]>; 675class S2I<bits<8> o, Format F, dag outs, dag ins, string asm, 676 list<dag> pattern> 677 : I<o, F, outs, ins, asm, pattern>, PD, Requires<[UseSSE2]>; 678class MMXSDIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 679 list<dag> pattern> 680 : Ii8<o, F, outs, ins, asm, pattern>, XD, Requires<[HasMMX, HasSSE2]>; 681class MMXS2SIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 682 list<dag> pattern> 683 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasMMX, HasSSE2]>; 684 685// SSE3 Instruction Templates: 686// 687// S3I - SSE3 instructions with PD prefixes. 688// S3SI - SSE3 instructions with XS prefix. 689// S3DI - SSE3 instructions with XD prefix. 690 691class S3SI<bits<8> o, Format F, dag outs, dag ins, string asm, 692 list<dag> pattern> 693 : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, XS, 694 Requires<[UseSSE3]>; 695class S3DI<bits<8> o, Format F, dag outs, dag ins, string asm, 696 list<dag> pattern> 697 : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, XD, 698 Requires<[UseSSE3]>; 699class S3I<bits<8> o, Format F, dag outs, dag ins, string asm, 700 list<dag> pattern> 701 : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, PD, 702 Requires<[UseSSE3]>; 703 704 705// SSSE3 Instruction Templates: 706// 707// SS38I - SSSE3 instructions with T8 prefix. 708// SS3AI - SSSE3 instructions with TA prefix. 709// MMXSS38I - SSSE3 instructions with T8 prefix and MMX operands. 710// MMXSS3AI - SSSE3 instructions with TA prefix and MMX operands. 711// 712// Note: SSSE3 instructions have 64-bit and 128-bit versions. The 64-bit version 713// uses the MMX registers. The 64-bit versions are grouped with the MMX 714// classes. They need to be enabled even if AVX is enabled. 715 716class SS38I<bits<8> o, Format F, dag outs, dag ins, string asm, 717 list<dag> pattern> 718 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD, 719 Requires<[UseSSSE3]>; 720class SS3AI<bits<8> o, Format F, dag outs, dag ins, string asm, 721 list<dag> pattern> 722 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD, 723 Requires<[UseSSSE3]>; 724class MMXSS38I<bits<8> o, Format F, dag outs, dag ins, string asm, 725 list<dag> pattern> 726 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PS, 727 Requires<[HasMMX, HasSSSE3]>; 728class MMXSS3AI<bits<8> o, Format F, dag outs, dag ins, string asm, 729 list<dag> pattern> 730 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPS, 731 Requires<[HasMMX, HasSSSE3]>; 732 733// SSE4.1 Instruction Templates: 734// 735// SS48I - SSE 4.1 instructions with T8 prefix. 736// SS41AIi8 - SSE 4.1 instructions with TA prefix and ImmT == Imm8. 737// 738class SS48I<bits<8> o, Format F, dag outs, dag ins, string asm, 739 list<dag> pattern> 740 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD, 741 Requires<[UseSSE41]>; 742class SS4AIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 743 list<dag> pattern> 744 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD, 745 Requires<[UseSSE41]>; 746 747// SSE4.2 Instruction Templates: 748// 749// SS428I - SSE 4.2 instructions with T8 prefix. 750class SS428I<bits<8> o, Format F, dag outs, dag ins, string asm, 751 list<dag> pattern> 752 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD, 753 Requires<[UseSSE42]>; 754 755// SS42AI = SSE 4.2 instructions with TA prefix 756class SS42AI<bits<8> o, Format F, dag outs, dag ins, string asm, 757 list<dag> pattern> 758 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD, 759 Requires<[UseSSE42]>; 760 761// CRC32I - SSE 4.2 CRC32 instructions. 762// NOTE: 'HasCRC32' is used as CRC32 instructions are GPR only and not directly 763// controlled by the SSE42 flag. 764class CRC32I<bits<8> o, Format F, dag outs, dag ins, string asm, 765 list<dag> pattern> 766 : I<o, F, outs, ins, asm, pattern>, T8XD, Requires<[HasCRC32]>; 767 768// AVX Instruction Templates: 769// Instructions introduced in AVX (no SSE equivalent forms) 770// 771// AVX8I - AVX instructions with T8PD prefix. 772// AVXAIi8 - AVX instructions with TAPD prefix and ImmT = Imm8. 773class AVX8I<bits<8> o, Format F, dag outs, dag ins, string asm, 774 list<dag> pattern> 775 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD, 776 Requires<[HasAVX]>; 777class AVXAIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 778 list<dag> pattern> 779 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD, 780 Requires<[HasAVX]>; 781 782// AVX2 Instruction Templates: 783// Instructions introduced in AVX2 (no SSE equivalent forms) 784// 785// AVX28I - AVX2 instructions with T8PD prefix. 786// AVX2AIi8 - AVX2 instructions with TAPD prefix and ImmT = Imm8. 787class AVX28I<bits<8> o, Format F, dag outs, dag ins, string asm, 788 list<dag> pattern> 789 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD, 790 Requires<[HasAVX2]>; 791class AVX2AIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 792 list<dag> pattern> 793 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD, 794 Requires<[HasAVX2]>; 795 796 797// AVX-512 Instruction Templates: 798// Instructions introduced in AVX-512 (no SSE equivalent forms) 799// 800// AVX5128I - AVX-512 instructions with T8PD prefix. 801// AVX512AIi8 - AVX-512 instructions with TAPD prefix and ImmT = Imm8. 802// AVX512PDI - AVX-512 instructions with PD, double packed. 803// AVX512PSI - AVX-512 instructions with PS, single packed. 804// AVX512XS8I - AVX-512 instructions with T8 and XS prefixes. 805// AVX512XSI - AVX-512 instructions with XS prefix, generic domain. 806// AVX512BI - AVX-512 instructions with PD, int packed domain. 807// AVX512SI - AVX-512 scalar instructions with PD prefix. 808 809class AVX5128I<bits<8> o, Format F, dag outs, dag ins, string asm, 810 list<dag> pattern> 811 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD, 812 Requires<[HasAVX512]>; 813class AVX5128IBase : T8PD { 814 Domain ExeDomain = SSEPackedInt; 815} 816class AVX512XS8I<bits<8> o, Format F, dag outs, dag ins, string asm, 817 list<dag> pattern> 818 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8XS, 819 Requires<[HasAVX512]>; 820class AVX512XSI<bits<8> o, Format F, dag outs, dag ins, string asm, 821 list<dag> pattern> 822 : I<o, F, outs, ins, asm, pattern>, XS, 823 Requires<[HasAVX512]>; 824class AVX512XDI<bits<8> o, Format F, dag outs, dag ins, string asm, 825 list<dag> pattern> 826 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, XD, 827 Requires<[HasAVX512]>; 828class AVX512BI<bits<8> o, Format F, dag outs, dag ins, string asm, 829 list<dag> pattern> 830 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, PD, 831 Requires<[HasAVX512]>; 832class AVX512BIBase : PD { 833 Domain ExeDomain = SSEPackedInt; 834} 835class AVX512BIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 836 list<dag> pattern> 837 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, PD, 838 Requires<[HasAVX512]>; 839class AVX512BIi8Base : PD { 840 Domain ExeDomain = SSEPackedInt; 841 ImmType ImmT = Imm8; 842} 843class AVX512XSIi8Base : XS { 844 Domain ExeDomain = SSEPackedInt; 845 ImmType ImmT = Imm8; 846} 847class AVX512XDIi8Base : XD { 848 Domain ExeDomain = SSEPackedInt; 849 ImmType ImmT = Imm8; 850} 851class AVX512PSIi8Base : PS { 852 Domain ExeDomain = SSEPackedSingle; 853 ImmType ImmT = Imm8; 854} 855class AVX512PDIi8Base : PD { 856 Domain ExeDomain = SSEPackedDouble; 857 ImmType ImmT = Imm8; 858} 859class AVX512AIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 860 list<dag> pattern> 861 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD, 862 Requires<[HasAVX512]>; 863class AVX512AIi8Base : TAPD { 864 ImmType ImmT = Imm8; 865} 866class AVX512Ii8<bits<8> o, Format F, dag outs, dag ins, string asm, 867 list<dag> pattern> 868 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, 869 Requires<[HasAVX512]>; 870class AVX512PDI<bits<8> o, Format F, dag outs, dag ins, string asm, 871 list<dag> pattern> 872 : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, PD, 873 Requires<[HasAVX512]>; 874class AVX512PSI<bits<8> o, Format F, dag outs, dag ins, string asm, 875 list<dag> pattern> 876 : I<o, F, outs, ins, asm, pattern, SSEPackedSingle>, PS, 877 Requires<[HasAVX512]>; 878class AVX512PIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 879 list<dag> pattern, Domain d> 880 : Ii8<o, F, outs, ins, asm, pattern, d>, Requires<[HasAVX512]>; 881class AVX512PI<bits<8> o, Format F, dag outs, dag ins, string asm, 882 list<dag> pattern, Domain d> 883 : I<o, F, outs, ins, asm, pattern, d>, Requires<[HasAVX512]>; 884class AVX512FMA3S<bits<8> o, Format F, dag outs, dag ins, string asm, 885 list<dag>pattern> 886 : I<o, F, outs, ins, asm, pattern>, T8PD, 887 EVEX_4V, Requires<[HasAVX512]>; 888 889class AVX512<bits<8> o, Format F, dag outs, dag ins, string asm, 890 list<dag>pattern> 891 : I<o, F, outs, ins, asm, pattern>, Requires<[HasAVX512]>; 892 893// AES Instruction Templates: 894// 895// AES8I 896// These use the same encoding as the SSE4.2 T8 and TA encodings. 897class AES8I<bits<8> o, Format F, dag outs, dag ins, string asm, 898 list<dag>pattern> 899 : I<o, F, outs, ins, asm, pattern, SSEPackedInt>, T8PD, 900 Requires<[NoAVX, HasAES]>; 901 902class AESAI<bits<8> o, Format F, dag outs, dag ins, string asm, 903 list<dag> pattern> 904 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD, 905 Requires<[NoAVX, HasAES]>; 906 907// PCLMUL Instruction Templates 908class PCLMULIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 909 list<dag>pattern> 910 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD; 911 912// FMA3 Instruction Templates 913class FMA3<bits<8> o, Format F, dag outs, dag ins, string asm, 914 list<dag>pattern> 915 : I<o, F, outs, ins, asm, pattern>, T8PD, 916 VEX_4V, FMASC, Requires<[HasFMA, NoFMA4, NoVLX]>; 917class FMA3S<bits<8> o, Format F, dag outs, dag ins, string asm, 918 list<dag>pattern> 919 : I<o, F, outs, ins, asm, pattern>, T8PD, 920 VEX_4V, FMASC, Requires<[HasFMA, NoFMA4, NoAVX512]>; 921class FMA3S_Int<bits<8> o, Format F, dag outs, dag ins, string asm, 922 list<dag>pattern> 923 : I<o, F, outs, ins, asm, pattern>, T8PD, 924 VEX_4V, FMASC, Requires<[HasFMA, NoAVX512]>; 925 926// FMA4 Instruction Templates 927class FMA4<bits<8> o, Format F, dag outs, dag ins, string asm, 928 list<dag>pattern> 929 : Ii8Reg<o, F, outs, ins, asm, pattern>, TAPD, 930 VEX_4V, FMASC, Requires<[HasFMA4, NoVLX]>; 931class FMA4S<bits<8> o, Format F, dag outs, dag ins, string asm, 932 list<dag>pattern> 933 : Ii8Reg<o, F, outs, ins, asm, pattern>, TAPD, 934 VEX_4V, FMASC, Requires<[HasFMA4, NoAVX512]>; 935class FMA4S_Int<bits<8> o, Format F, dag outs, dag ins, string asm, 936 list<dag>pattern> 937 : Ii8Reg<o, F, outs, ins, asm, pattern>, TAPD, 938 VEX_4V, FMASC, Requires<[HasFMA4]>; 939 940// XOP 2, 3 and 4 Operand Instruction Template 941class IXOP<bits<8> o, Format F, dag outs, dag ins, string asm, 942 list<dag> pattern> 943 : I<o, F, outs, ins, asm, pattern, SSEPackedDouble>, 944 XOP9, Requires<[HasXOP]>; 945 946// XOP 2 and 3 Operand Instruction Templates with imm byte 947class IXOPi8<bits<8> o, Format F, dag outs, dag ins, string asm, 948 list<dag> pattern> 949 : Ii8<o, F, outs, ins, asm, pattern, SSEPackedDouble>, 950 XOP8, Requires<[HasXOP]>; 951// XOP 4 Operand Instruction Templates with imm byte 952class IXOPi8Reg<bits<8> o, Format F, dag outs, dag ins, string asm, 953 list<dag> pattern> 954 : Ii8Reg<o, F, outs, ins, asm, pattern, SSEPackedDouble>, 955 XOP8, Requires<[HasXOP]>; 956 957// XOP 5 operand instruction (VEX encoding!) 958class IXOP5<bits<8> o, Format F, dag outs, dag ins, string asm, 959 list<dag>pattern> 960 : Ii8Reg<o, F, outs, ins, asm, pattern, SSEPackedInt>, TAPD, 961 VEX_4V, Requires<[HasXOP]>; 962 963// X86-64 Instruction templates... 964// 965 966class RI<bits<8> o, Format F, dag outs, dag ins, string asm, 967 list<dag> pattern> 968 : I<o, F, outs, ins, asm, pattern>, REX_W; 969class RIi8 <bits<8> o, Format F, dag outs, dag ins, string asm, 970 list<dag> pattern> 971 : Ii8<o, F, outs, ins, asm, pattern>, REX_W; 972class RIi16 <bits<8> o, Format F, dag outs, dag ins, string asm, 973 list<dag> pattern> 974 : Ii16<o, F, outs, ins, asm, pattern>, REX_W; 975class RIi32 <bits<8> o, Format F, dag outs, dag ins, string asm, 976 list<dag> pattern> 977 : Ii32<o, F, outs, ins, asm, pattern>, REX_W; 978class RIi32S <bits<8> o, Format F, dag outs, dag ins, string asm, 979 list<dag> pattern> 980 : Ii32S<o, F, outs, ins, asm, pattern>, REX_W; 981class RIi64<bits<8> o, Format F, dag outs, dag ins, string asm, 982 list<dag> pattern> 983 : Ii64<o, F, outs, ins, asm, pattern>, REX_W; 984 985class RS2I<bits<8> o, Format F, dag outs, dag ins, string asm, 986 list<dag> pattern> 987 : S2I<o, F, outs, ins, asm, pattern>, REX_W; 988class VRS2I<bits<8> o, Format F, dag outs, dag ins, string asm, 989 list<dag> pattern> 990 : VS2I<o, F, outs, ins, asm, pattern>, VEX_W; 991 992// MMX Instruction templates 993// 994 995// MMXI - MMX instructions with TB prefix. 996// MMXI32 - MMX instructions with TB prefix valid only in 32 bit mode. 997// MMXI64 - MMX instructions with TB prefix valid only in 64 bit mode. 998// MMX2I - MMX / SSE2 instructions with PD prefix. 999// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix. 1000// MMXIi8 - MMX instructions with ImmT == Imm8 and PS prefix. 1001// MMXID - MMX instructions with XD prefix. 1002// MMXIS - MMX instructions with XS prefix. 1003class MMXI<bits<8> o, Format F, dag outs, dag ins, string asm, 1004 list<dag> pattern> 1005 : I<o, F, outs, ins, asm, pattern>, PS, Requires<[HasMMX]>; 1006class MMXI32<bits<8> o, Format F, dag outs, dag ins, string asm, 1007 list<dag> pattern> 1008 : I<o, F, outs, ins, asm, pattern>, PS, Requires<[HasMMX,Not64BitMode]>; 1009class MMXI64<bits<8> o, Format F, dag outs, dag ins, string asm, 1010 list<dag> pattern> 1011 : I<o, F, outs, ins, asm, pattern>, PS, Requires<[HasMMX,In64BitMode]>; 1012class MMXRI<bits<8> o, Format F, dag outs, dag ins, string asm, 1013 list<dag> pattern> 1014 : I<o, F, outs, ins, asm, pattern>, PS, REX_W, Requires<[HasMMX]>; 1015class MMX2I<bits<8> o, Format F, dag outs, dag ins, string asm, 1016 list<dag> pattern> 1017 : I<o, F, outs, ins, asm, pattern>, PD, Requires<[HasMMX]>; 1018class MMXIi8<bits<8> o, Format F, dag outs, dag ins, string asm, 1019 list<dag> pattern> 1020 : Ii8<o, F, outs, ins, asm, pattern>, PS, Requires<[HasMMX]>; 1021class MMXID<bits<8> o, Format F, dag outs, dag ins, string asm, 1022 list<dag> pattern> 1023 : Ii8<o, F, outs, ins, asm, pattern>, XD, Requires<[HasMMX]>; 1024class MMXIS<bits<8> o, Format F, dag outs, dag ins, string asm, 1025 list<dag> pattern> 1026 : Ii8<o, F, outs, ins, asm, pattern>, XS, Requires<[HasMMX]>; 1027