diff --git a/llvm/lib/Target/SystemZ/SystemZInstrFormats.td b/llvm/lib/Target/SystemZ/SystemZInstrFormats.td --- a/llvm/lib/Target/SystemZ/SystemZInstrFormats.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrFormats.td @@ -1921,9 +1921,13 @@ // Defines a class that makes it easier to define // a MnemonicAlias when CondVariant's are involved. -class MnemonicCondBranchAlias - : MnemonicAlias; +multiclass MnemonicCondBranchAlias { + if !or(!eq(V.asmvariant, ""), !eq(V.asmvariant, asmvariant)) then + def "" : MnemonicAlias; +} //===----------------------------------------------------------------------===// // Instruction definitions with semantics diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.td b/llvm/lib/Target/SystemZ/SystemZInstrInfo.td --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.td @@ -81,7 +81,7 @@ foreach V = [ "E", "NE", "H", "NH", "L", "NL", "HE", "NHE", "LE", "NLE", "Z", "NZ", "P", "NP", "M", "NM", "LH", "NLH", "O", "NO" ] in { def JAsm#V : FixedCondBranchRI , "j#", 0xA74>; - def JGAsm#V : FixedCondBranchRIL, "jg#", 0xC04>; + def JGAsm#V : FixedCondBranchRIL, "j{g|l}#", 0xC04>; let isIndirectBranch = 1 in { def BAsm#V : FixedCondBranchRX , "b#", 0x47>; def BRAsm#V : FixedCondBranchRR , "b#r", 0x07>; @@ -95,7 +95,7 @@ // conditional branches with the condition mask set to "always". let isBranch = 1, isTerminator = 1, isBarrier = 1 in { def J : FixedCondBranchRI ; - def JG : FixedCondBranchRIL; + def JG : FixedCondBranchRIL; let isIndirectBranch = 1 in { def B : FixedCondBranchRX; def BR : FixedCondBranchRR; @@ -117,7 +117,8 @@ def JNOP : InstAlias<"jnop\t$RI2", (BRCAsm 0, brtarget16:$RI2), 0>; // An alias of BRCL 0, label -def JGNOP : InstAlias<"jgnop\t$RI2", (BRCLAsm 0, brtarget32:$RI2), 0>; +// jgnop on att ; jlnop on hlasm +def JGNOP : InstAlias<"{jgnop|jlnop}\t$RI2", (BRCLAsm 0, brtarget32:$RI2), 0>; // Fused compare-and-branch instructions. // @@ -2375,10 +2376,12 @@ def JXLEG : MnemonicAlias<"jxleg", "brxlg">; def BRU : MnemonicAlias<"bru", "j">; -def BRUL : MnemonicAlias<"brul", "jg">; +def BRUL : MnemonicAlias<"brul", "jg", "att">; +def BRUL_HLASM : MnemonicAlias<"brul", "jlu", "hlasm">; foreach V = [ "E", "NE", "H", "NH", "L", "NL", "HE", "NHE", "LE", "NLE", "Z", "NZ", "P", "NP", "M", "NM", "LH", "NLH", "O", "NO" ] in { - def BRUAsm#V : MnemonicCondBranchAlias , "br#", "j#">; - def BRULAsm#V : MnemonicCondBranchAlias , "br#l", "jg#">; + defm BRUAsm#V : MnemonicCondBranchAlias , "br#", "j#">; + defm BRULAsm#V : MnemonicCondBranchAlias , "br#l", "jg#", "att">; + defm BRUL_HLASMAsm#V : MnemonicCondBranchAlias , "br#l", "jl#", "hlasm">; } diff --git a/llvm/test/MC/SystemZ/insn-bad.s b/llvm/test/MC/SystemZ/insn-bad.s --- a/llvm/test/MC/SystemZ/insn-bad.s +++ b/llvm/test/MC/SystemZ/insn-bad.s @@ -561,6 +561,65 @@ jnop 1 jnop 0x10000 +#CHECK: error: invalid instruction +#CHECK: jlu label +#CHECK: error: invalid instruction +#CHECK: jlne label +#CHECK: error: invalid instruction +#CHECK: jlnh label +#CHECK: error: invalid instruction +#CHECK: jll label +#CHECK: error: invalid instruction +#CHECK: jlnl label +#CHECK: error: invalid instruction +#CHECK: jlhe label +#CHECK: error: invalid instruction +#CHECK: jlnhe label +#CHECK: error: invalid instruction +#CHECK: jlle label +#CHECK: error: invalid instruction +#CHECK: jlnle label +#CHECK: error: invalid instruction +#CHECK: jlz label +#CHECK: error: invalid instruction +#CHECK: jlnz label +#CHECK: error: invalid instruction +#CHECK: jlp label +#CHECK: error: invalid instruction +#CHECK: jlnp label +#CHECK: error: invalid instruction +#CHECK: jlm label +#CHECK: error: invalid instruction +#CHECK: jlnm label +#CHECK: error: invalid instruction +#CHECK: jllh label +#CHECK: error: invalid instruction +#CHECK: jllnlh label +#CHECK: error: invalid instruction +#CHECK: jlo label +#CHECK: error: invalid instruction +#CHECK: jlno label + + jlu label + jlne label + jlnh label + jll label + jlnl label + jlhe label + jlnhe label + jlle label + jlnle label + jlz label + jlnz label + jlp label + jlnp label + jlm label + jlnm label + jllh label + jllnlh label + jlo label + jlno label + #CHECK: error: invalid operand #CHECK: brc foo, bar #CHECK: error: invalid operand @@ -598,6 +657,11 @@ jgnop 1 jgnop 0x100000000 + +#CHECK: error: invalid instruction +#CHECK: jlnop label + jlnop label + #CHECK: error: invalid operand #CHECK: brcl foo, bar #CHECK: error: invalid operand