1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[SystemZ] Introduce distinction between the jg/jl family of mnemonics for GNU as vs HLASM

- This patch adds in the distinction between jg[*] and jl[*] pc-relative
  mnemonics based on the variant/dialect.
- Under the hlasm variant, we use the jl[*] family of mnemonics and under
  the att (GNU as) variant, we use the jg[*] family of mnemonics.
- jgnop which was added in https://reviews.llvm.org/D92185, is now restricted
  to att variant. jlnop is introduced and restricted to hlasm variant.
- The br[*]l additional mnemonics are mapped to either jl[*]/jg[*] based on
  the variant.

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D97581
This commit is contained in:
Anirudh Prasad 2021-03-01 16:31:29 -05:00 committed by Kai Nacke
parent 749b5b24c4
commit 7d6fa719d5
3 changed files with 80 additions and 9 deletions

View File

@ -1921,9 +1921,13 @@ class ICV<string name>
// Defines a class that makes it easier to define // Defines a class that makes it easier to define
// a MnemonicAlias when CondVariant's are involved. // a MnemonicAlias when CondVariant's are involved.
class MnemonicCondBranchAlias<CondVariant V, string from, string to> multiclass MnemonicCondBranchAlias<CondVariant V, string from, string to,
: MnemonicAlias<!subst("#", V.suffix, from), !subst("#", V.suffix, to), string asmvariant = V.asmvariant> {
V.asmvariant>; if !or(!eq(V.asmvariant, ""), !eq(V.asmvariant, asmvariant)) then
def "" : MnemonicAlias<!subst("#", V.suffix, from),
!subst("#", V.suffix, to),
asmvariant>;
}
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Instruction definitions with semantics // Instruction definitions with semantics

View File

@ -81,7 +81,7 @@ let isBranch = 1, isTerminator = 1, Uses = [CC] in {
foreach V = [ "E", "NE", "H", "NH", "L", "NL", "HE", "NHE", "LE", "NLE", foreach V = [ "E", "NE", "H", "NH", "L", "NL", "HE", "NHE", "LE", "NLE",
"Z", "NZ", "P", "NP", "M", "NM", "LH", "NLH", "O", "NO" ] in { "Z", "NZ", "P", "NP", "M", "NM", "LH", "NLH", "O", "NO" ] in {
def JAsm#V : FixedCondBranchRI <CV<V>, "j#", 0xA74>; def JAsm#V : FixedCondBranchRI <CV<V>, "j#", 0xA74>;
def JGAsm#V : FixedCondBranchRIL<CV<V>, "jg#", 0xC04>; def JGAsm#V : FixedCondBranchRIL<CV<V>, "j{g|l}#", 0xC04>;
let isIndirectBranch = 1 in { let isIndirectBranch = 1 in {
def BAsm#V : FixedCondBranchRX <CV<V>, "b#", 0x47>; def BAsm#V : FixedCondBranchRX <CV<V>, "b#", 0x47>;
def BRAsm#V : FixedCondBranchRR <CV<V>, "b#r", 0x07>; def BRAsm#V : FixedCondBranchRR <CV<V>, "b#r", 0x07>;
@ -95,7 +95,7 @@ let isBranch = 1, isTerminator = 1, Uses = [CC] in {
// conditional branches with the condition mask set to "always". // conditional branches with the condition mask set to "always".
let isBranch = 1, isTerminator = 1, isBarrier = 1 in { let isBranch = 1, isTerminator = 1, isBarrier = 1 in {
def J : FixedCondBranchRI <CondAlways, "j", 0xA74, br>; def J : FixedCondBranchRI <CondAlways, "j", 0xA74, br>;
def JG : FixedCondBranchRIL<CondAlways, "jg", 0xC04>; def JG : FixedCondBranchRIL<CondAlways, "j{g|lu}", 0xC04>;
let isIndirectBranch = 1 in { let isIndirectBranch = 1 in {
def B : FixedCondBranchRX<CondAlways, "b", 0x47>; def B : FixedCondBranchRX<CondAlways, "b", 0x47>;
def BR : FixedCondBranchRR<CondAlways, "br", 0x07, brind>; def BR : FixedCondBranchRR<CondAlways, "br", 0x07, brind>;
@ -117,7 +117,8 @@ def NOPR_bare : InstAlias<"nopr", (BCRAsm 0, R0D), 0>;
def JNOP : InstAlias<"jnop\t$RI2", (BRCAsm 0, brtarget16:$RI2), 0>; def JNOP : InstAlias<"jnop\t$RI2", (BRCAsm 0, brtarget16:$RI2), 0>;
// An alias of BRCL 0, label // 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. // Fused compare-and-branch instructions.
// //
@ -2375,10 +2376,12 @@ def JXHG : MnemonicAlias<"jxhg", "brxhg">;
def JXLEG : MnemonicAlias<"jxleg", "brxlg">; def JXLEG : MnemonicAlias<"jxleg", "brxlg">;
def BRU : MnemonicAlias<"bru", "j">; 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", foreach V = [ "E", "NE", "H", "NH", "L", "NL", "HE", "NHE", "LE", "NLE",
"Z", "NZ", "P", "NP", "M", "NM", "LH", "NLH", "O", "NO" ] in { "Z", "NZ", "P", "NP", "M", "NM", "LH", "NLH", "O", "NO" ] in {
def BRUAsm#V : MnemonicCondBranchAlias <CV<V>, "br#", "j#">; defm BRUAsm#V : MnemonicCondBranchAlias <CV<V>, "br#", "j#">;
def BRULAsm#V : MnemonicCondBranchAlias <CV<V>, "br#l", "jg#">; defm BRULAsm#V : MnemonicCondBranchAlias <CV<V>, "br#l", "jg#", "att">;
defm BRUL_HLASMAsm#V : MnemonicCondBranchAlias <CV<V>, "br#l", "jl#", "hlasm">;
} }

View File

@ -561,6 +561,65 @@
jnop 1 jnop 1
jnop 0x10000 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: error: invalid operand
#CHECK: brc foo, bar #CHECK: brc foo, bar
#CHECK: error: invalid operand #CHECK: error: invalid operand
@ -598,6 +657,11 @@
jgnop 1 jgnop 1
jgnop 0x100000000 jgnop 0x100000000
#CHECK: error: invalid instruction
#CHECK: jlnop label
jlnop label
#CHECK: error: invalid operand #CHECK: error: invalid operand
#CHECK: brcl foo, bar #CHECK: brcl foo, bar
#CHECK: error: invalid operand #CHECK: error: invalid operand