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