diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td --- a/llvm/lib/Target/AMDGPU/SOPInstructions.td +++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td @@ -39,7 +39,7 @@ class SOP1_Pseudo pattern=[]> : - SOP_Pseudo { + SOP_Pseudo { let mayLoad = 0; let mayStore = 0; @@ -56,7 +56,7 @@ class SOP1_Real op, SOP1_Pseudo ps, string real_name = ps.Mnemonic> : InstSI , + real_name # ps.AsmOperands>, Enc32 { let SALU = 1; @@ -418,7 +418,7 @@ class SOP2_Pseudo pattern=[]> : - SOP_Pseudo { + SOP_Pseudo { let mayLoad = 0; let mayStore = 0; @@ -440,7 +440,7 @@ class SOP2_Real op, SOP_Pseudo ps, string real_name = ps.Mnemonic> : InstSI , + real_name # ps.AsmOperands>, Enc32 { let SALU = 1; let SOP2 = 1; @@ -735,14 +735,14 @@ let SchedRW = [WriteSALU]; let UseNamedOperandTable = 1; string Mnemonic = opName; - string AsmOperands = asmOps; + string AsmOperands = " " # asmOps; bits<1> has_sdst = 1; } class SOPK_Real : InstSI { + ps.Mnemonic # ps.AsmOperands> { let SALU = 1; let SOPK = 1; let isPseudo = 0; @@ -816,7 +816,7 @@ !if(isSignExt, (ins SReg_32:$sdst, s16imm:$simm16), (ins SReg_32:$sdst, u16imm:$simm16)), - "$sdst, $simm16", []>, + "$sdst, $simm16">, SOPKInstTable<1, base_op>{ let Defs = [SCC]; } @@ -987,7 +987,7 @@ class SOPC_Pseudo pattern=[]> : - SOP_Pseudo { + SOP_Pseudo { let mayLoad = 0; let mayStore = 0; let hasSideEffects = 0; @@ -998,9 +998,9 @@ let UseNamedOperandTable = 1; } -class SOPC_Real op, SOPC_Pseudo ps, string real_name = ps.Mnemonic> : +class SOPC_Real op, SOPC_Pseudo ps> : InstSI , + ps.Mnemonic # ps.AsmOperands>, Enc32 { let SALU = 1; let SOPC = 1; @@ -1109,8 +1109,10 @@ //===----------------------------------------------------------------------===// class SOPP_Pseudo pattern=[], string keyName = opName> : - SOP_Pseudo { + string asmOps = "", list pattern=[], + string sep = !if(!empty(asmOps), "", " "), + string keyName = opName> : + SOP_Pseudo { let isPseudo = 1; let isCodeGenOnly = 1; let mayLoad = 0; @@ -1131,10 +1133,9 @@ string KeyName = keyName # gfxip; } -//spaces inserted in realname on instantiation of this record to allow s_endpgm to omit whitespace class SOPP_Real : InstSI { + real_name # ps.AsmOperands> { let SALU = 1; let SOPP = 1; let isPseudo = 0; @@ -1174,13 +1175,13 @@ multiclass SOPP_With_Relaxation pattern=[]> { def "" : SOPP_Pseudo ; - def _pad_s_nop : SOPP_Pseudo ; + def _pad_s_nop : SOPP_Pseudo ; } def S_NOP : SOPP_Pseudo<"s_nop" , (ins i16imm:$simm16), "$simm16">; let isTerminator = 1 in { -def S_ENDPGM : SOPP_Pseudo<"s_endpgm", (ins EndpgmImm:$simm16), "$simm16"> { +def S_ENDPGM : SOPP_Pseudo<"s_endpgm", (ins EndpgmImm:$simm16), "$simm16", [], ""> { let isBarrier = 1; let isReturn = 1; let hasSideEffects = 1; @@ -1367,7 +1368,7 @@ def S_CLAUSE : SOPP_Pseudo<"s_clause", (ins s16imm:$simm16), "$simm16">; def S_WAIT_IDLE : - SOPP_Pseudo <"s_wait_idle", (ins), ""> { + SOPP_Pseudo <"s_wait_idle", (ins)> { let simm16 = 0; let fixed_imm = 1; } @@ -1939,20 +1940,20 @@ // SOPP - GFX11 //===----------------------------------------------------------------------===// -multiclass SOPP_Real_32_gfx11 op, string real_name = !cast(NAME).Mnemonic # " "> { - def _gfx11 : SOPP_Real_32(NAME), real_name>, +multiclass SOPP_Real_32_gfx11 op> { + def _gfx11 : SOPP_Real_32(NAME), !cast(NAME).Mnemonic>, Select_gfx11(NAME).Mnemonic>, SOPPRelaxTable<0, !cast(NAME).KeyName, "_gfx11">; } -multiclass SOPP_Real_64_gfx11 op, string real_name = !cast(NAME).Mnemonic # " "> { - def _gfx11 : SOPP_Real_64(NAME), real_name>, +multiclass SOPP_Real_64_gfx11 op> { + def _gfx11 : SOPP_Real_64(NAME), !cast(NAME).Mnemonic>, Select_gfx11(NAME).Mnemonic>, SOPPRelaxTable<1, !cast(NAME).KeyName, "_gfx11">; } multiclass SOPP_Real_32_Renamed_gfx11 op, SOPP_Pseudo backing_pseudo, string real_name> { - def _gfx11 : SOPP_Real_32, + def _gfx11 : SOPP_Real_32, Select_gfx11, MnemonicAlias, Requires<[isGFX11Plus]>; } @@ -1986,7 +1987,7 @@ defm S_CBRANCH_CDBGUSER : SOPP_Real_With_Relaxation_gfx11<0x028>; defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_Real_With_Relaxation_gfx11<0x029>; defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_Real_With_Relaxation_gfx11<0x02a>; -defm S_ENDPGM : SOPP_Real_32_gfx11<0x030, "s_endpgm">; +defm S_ENDPGM : SOPP_Real_32_gfx11<0x030>; defm S_ENDPGM_SAVED : SOPP_Real_32_gfx11<0x031>; defm S_WAKEUP : SOPP_Real_32_gfx11<0x034>; defm S_SETPRIO : SOPP_Real_32_gfx11<0x035>; @@ -2003,75 +2004,75 @@ // SOPP - GFX6, GFX7, GFX8, GFX9, GFX10 //===----------------------------------------------------------------------===// -multiclass SOPP_Real_32_gfx6_gfx7 op, string real_name = !cast(NAME).Mnemonic> { +multiclass SOPP_Real_32_gfx6_gfx7 op> { defvar ps = !cast(NAME); - def _gfx6_gfx7 : SOPP_Real_32, + def _gfx6_gfx7 : SOPP_Real_32(NAME).Mnemonic>, Select_gfx6_gfx7, SOPPRelaxTable<0, ps.KeyName, "_gfx6_gfx7">; } -multiclass SOPP_Real_32_gfx8_gfx9 op, string real_name = !cast(NAME).Mnemonic # " "> { +multiclass SOPP_Real_32_gfx8_gfx9 op> { defvar ps = !cast(NAME); - def _vi : SOPP_Real_32, + def _vi : SOPP_Real_32, Select_vi, SOPPRelaxTable<0, ps.KeyName, "_vi">; } -multiclass SOPP_Real_32_gfx10 op, string real_name = !cast(NAME).Mnemonic # " "> { +multiclass SOPP_Real_32_gfx10 op> { defvar ps = !cast(NAME); - def _gfx10 : SOPP_Real_32, + def _gfx10 : SOPP_Real_32, Select_gfx10, SOPPRelaxTable<0, ps.KeyName, "_gfx10">; } -multiclass SOPP_Real_32_gfx8_gfx9_gfx10 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_32_gfx8_gfx9, SOPP_Real_32_gfx10; +multiclass SOPP_Real_32_gfx8_gfx9_gfx10 op> : + SOPP_Real_32_gfx8_gfx9, SOPP_Real_32_gfx10; -multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_32_gfx6_gfx7, SOPP_Real_32_gfx8_gfx9; +multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9 op> : + SOPP_Real_32_gfx6_gfx7, SOPP_Real_32_gfx8_gfx9; -multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_32_gfx6_gfx7_gfx8_gfx9, SOPP_Real_32_gfx10; +multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10 op> : + SOPP_Real_32_gfx6_gfx7_gfx8_gfx9, SOPP_Real_32_gfx10; -multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10, SOPP_Real_32_gfx11; +multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11 op> : + SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10, SOPP_Real_32_gfx11; -multiclass SOPP_Real_32_gfx10_gfx11 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_32_gfx10, SOPP_Real_32_gfx11; +multiclass SOPP_Real_32_gfx10_gfx11 op> : + SOPP_Real_32_gfx10, SOPP_Real_32_gfx11; //64 bit encodings, for Relaxation -multiclass SOPP_Real_64_gfx6_gfx7 op, string real_name = !cast(NAME).Mnemonic # " "> { +multiclass SOPP_Real_64_gfx6_gfx7 op> { defvar ps = !cast(NAME); - def _gfx6_gfx7 : SOPP_Real_64, + def _gfx6_gfx7 : SOPP_Real_64, Select_gfx6_gfx7, SOPPRelaxTable<1, ps.KeyName, "_gfx6_gfx7">; } -multiclass SOPP_Real_64_gfx8_gfx9 op, string real_name = !cast(NAME).Mnemonic # " "> { +multiclass SOPP_Real_64_gfx8_gfx9 op> { defvar ps = !cast(NAME); - def _vi : SOPP_Real_64, + def _vi : SOPP_Real_64, Select_vi, SOPPRelaxTable<1, ps.KeyName, "_vi">; } -multiclass SOPP_Real_64_gfx10 op, string real_name = !cast(NAME).Mnemonic # " "> { +multiclass SOPP_Real_64_gfx10 op> { defvar ps = !cast(NAME); - def _gfx10 : SOPP_Real_64, + def _gfx10 : SOPP_Real_64, Select_gfx10, SOPPRelaxTable<1, ps.KeyName, "_gfx10">; } -multiclass SOPP_Real_64_gfx8_gfx9_gfx10 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_64_gfx8_gfx9, SOPP_Real_64_gfx10; +multiclass SOPP_Real_64_gfx8_gfx9_gfx10 op> : + SOPP_Real_64_gfx8_gfx9, SOPP_Real_64_gfx10; -multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_64_gfx6_gfx7, SOPP_Real_64_gfx8_gfx9; +multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9 op> : + SOPP_Real_64_gfx6_gfx7, SOPP_Real_64_gfx8_gfx9; -multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_64_gfx6_gfx7_gfx8_gfx9, SOPP_Real_64_gfx10; +multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10 op> : + SOPP_Real_64_gfx6_gfx7_gfx8_gfx9, SOPP_Real_64_gfx10; -multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11 op, string real_name = !cast(NAME).Mnemonic # " "> : - SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10, SOPP_Real_64_gfx11; +multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11 op> : + SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10, SOPP_Real_64_gfx11; //relaxation for insts with no operands not implemented multiclass SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10 op> { @@ -2080,7 +2081,7 @@ } defm S_NOP : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11<0x000>; -defm S_ENDPGM : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x001, "s_endpgm">; +defm S_ENDPGM : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x001>; defm S_WAKEUP : SOPP_Real_32_gfx8_gfx9_gfx10<0x003>; defm S_BARRIER : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00a>; defm S_WAITCNT : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00c>;