681 changes: 596 additions & 85 deletions llvm/lib/Target/SystemZ/SystemZInstrFormats.td

Large diffs are not rendered by default.

625 changes: 259 additions & 366 deletions llvm/lib/Target/SystemZ/SystemZInstrInfo.td

Large diffs are not rendered by default.

95 changes: 40 additions & 55 deletions llvm/lib/Target/SystemZ/SystemZScheduleZ13.td
Original file line number Diff line number Diff line change
Expand Up @@ -107,51 +107,47 @@ def : WriteRes<VBU, [Z13_VBUnit]>; // Virtual Branching Unit
def : InstRW<[FXa], (instregex "ADJDYNALLOC$")>; // Pseudo -> LA / LAY

//===----------------------------------------------------------------------===//
// Control flow instructions
// Branch instructions
//===----------------------------------------------------------------------===//

// Return
def : InstRW<[FXb, EndGroup], (instregex "Return$")>;
def : InstRW<[FXb], (instregex "CondReturn$")>;

// Compare and branch
def : InstRW<[FXb], (instregex "(Asm.*)?C(I|R)J$")>;
def : InstRW<[FXb], (instregex "(Asm.*)?CG(I|R)J$")>;
def : InstRW<[FXb], (instregex "(Asm.*)?CL(I|R)J$")>;
def : InstRW<[FXb], (instregex "(Asm.*)?CLG(I|R)J$")>;
def : InstRW<[FXb], (instregex "(Asm.*)?CG(R|I)J$")>;
def : InstRW<[FXb], (instregex "CLR$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "(Asm.*)?CIB(Call|Return)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "(Asm.*)?CLIB(Call|Return)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "(Asm.*)?CLGIB(Call|Return)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "(Asm.*)?CGIB(Call|Return)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "(Asm.*)?CGRB(Call|Return)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "(Asm.*)?CLGRB(Call|Return)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "CLR(Call|Return)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "(Asm.*)?CLRB(Call|Return)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "(Asm.*)?CRB(Call|Return)?$")>;

// Branch
def : InstRW<[FXb], (instregex "(Asm.*)?BR$")>;
def : InstRW<[FXb], (instregex "(Asm)?BC(R)?$")>;
def : InstRW<[VBU], (instregex "(Asm)?BRC(L)?$")>;
def : InstRW<[VBU], (instregex "(Call)?BRC(L)?(Asm.*)?$")>;
def : InstRW<[VBU], (instregex "(Call)?J(G)?(Asm.*)?$")>;
def : InstRW<[FXb], (instregex "(Call)?BC(R)?(Asm.*)?$")>;
def : InstRW<[FXb], (instregex "(Call)?B(R)?(Asm.*)?$")>;
def : InstRW<[FXa, EndGroup], (instregex "BRCT(G)?$")>;
def : InstRW<[VBU], (instregex "(Asm.*)?JG$")>;
def : InstRW<[VBU], (instregex "J$")>;
// (Need to avoid conflict with "(Asm.*)?CG(I|R)J$")
def : InstRW<[VBU], (instregex "Asm(EAlt|E|HAlt|HE|H|LAlt|LE|LH|L|NEAlt|NE)J$")>;
def : InstRW<[VBU], (instregex "Asm(NHAlt|NHE|NH|NLAlt|NLE|NLH|NL|NO|O)J$")>;
def : InstRW<[FXa, FXa, FXb, FXb, Lat4, GroupAlone], (instregex "BRX(H|LE)$")>;

// Compare and branch
def : InstRW<[FXb], (instregex "C(L)?(G)?(I|R)J(Asm.*)?$")>;
def : InstRW<[FXb, FXb, Lat2, GroupAlone],
(instregex "C(L)?(G)?(I|R)B(Call|Return|Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Trap instructions
//===----------------------------------------------------------------------===//

// Trap
def : InstRW<[VBU], (instregex "(Cond)?Trap$")>;

// Compare and trap
def : InstRW<[FXb], (instregex "(Asm.*)?C(G)?IT$")>;
def : InstRW<[FXb], (instregex "(Asm.*)?C(G)?RT$")>;
def : InstRW<[FXb], (instregex "(Asm.*)?CLG(I|R)T$")>;
def : InstRW<[FXb], (instregex "(Asm.*)?CLFIT$")>;
def : InstRW<[FXb], (instregex "(Asm.*)?CLRT$")>;
def : InstRW<[FXb], (instregex "C(G)?(I|R)T(Asm.*)?$")>;
def : InstRW<[FXb], (instregex "CL(G)?RT(Asm.*)?$")>;
def : InstRW<[FXb], (instregex "CL(F|G)IT(Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Call and return instructions
//===----------------------------------------------------------------------===//

// Call
def : InstRW<[VBU, FXa, FXa, Lat3, GroupAlone], (instregex "(Call)?BRAS$")>;
def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "(Call)?BRASL$")>;
def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "(Call)?BAS(R)?$")>;
def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "TLS_(G|L)DCALL$")>;

// Return
def : InstRW<[FXb, EndGroup], (instregex "Return$")>;
def : InstRW<[FXb], (instregex "CondReturn$")>;

//===----------------------------------------------------------------------===//
// Select instructions
Expand All @@ -168,18 +164,6 @@ def : InstRW<[FXa], (instregex "CondStore64(Inv)?$")>;
def : InstRW<[FXa], (instregex "CondStore8(Inv)?$")>;
def : InstRW<[FXa], (instregex "CondStore8Mux(Inv)?$")>;

//===----------------------------------------------------------------------===//
// Call instructions
//===----------------------------------------------------------------------===//

def : InstRW<[VBU, FXa, FXa, Lat3, GroupAlone], (instregex "BRAS$")>;
def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "(Call)?BASR$")>;
def : InstRW<[FXb], (instregex "CallB(C)?R$")>;
def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "(Call)?BRASL$")>;
def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "TLS_(G|L)DCALL$")>;
def : InstRW<[VBU], (instregex "CallBRCL$")>;
def : InstRW<[VBU], (instregex "CallJG$")>;

//===----------------------------------------------------------------------===//
// Move instructions
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -214,22 +198,23 @@ def : InstRW<[FXa], (instregex "LR(Mux)?$")>;
def : InstRW<[FXa, LSU, Lat5], (instregex "LT(G)?$")>;
def : InstRW<[FXa], (instregex "LT(G)?R$")>;

// Load on condition
def : InstRW<[FXa, LSU, Lat6], (instregex "(Asm.*)?LOC(G)?$")>;
def : InstRW<[FXa, Lat2], (instregex "(Asm.*)?LOC(G)?R$")>;
def : InstRW<[FXa, Lat2], (instregex "(Asm.*)?LOC(G)?HI$")>;

// Stores
def : InstRW<[FXb, LSU, Lat5], (instregex "STG(RL)?$")>;
def : InstRW<[FXb, LSU, Lat5], (instregex "ST128$")>;
def : InstRW<[FXb, LSU, Lat5], (instregex "ST(Y|FH|RL|Mux)?$")>;

// Store on condition
def : InstRW<[FXb, LSU, Lat5], (instregex "(Asm.*)?STOC(G)?$")>;

// String moves.
def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVST$")>;

//===----------------------------------------------------------------------===//
// Conditional move instructions
//===----------------------------------------------------------------------===//

def : InstRW<[FXa, Lat2], (instregex "LOC(G)?R(Asm.*)?$")>;
def : InstRW<[FXa, Lat2], (instregex "LOC(G)?HI(Asm.*)?$")>;
def : InstRW<[FXa, LSU, Lat6], (instregex "LOC(G)?(Asm.*)?$")>;
def : InstRW<[FXb, LSU, Lat5], (instregex "STOC(G)?(Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Sign extensions
//===----------------------------------------------------------------------===//
Expand Down
94 changes: 41 additions & 53 deletions llvm/lib/Target/SystemZ/SystemZScheduleZ196.td
Original file line number Diff line number Diff line change
Expand Up @@ -82,50 +82,48 @@ def : WriteRes<FPU2, [Z196_FPUnit, Z196_FPUnit]> { let Latency = 9; }
def : InstRW<[FXU], (instregex "ADJDYNALLOC$")>; // Pseudo -> LA / LAY

//===----------------------------------------------------------------------===//
// Control flow instructions
// Branch instructions
//===----------------------------------------------------------------------===//

// Return
def : InstRW<[LSU_lat1, EndGroup], (instregex "Return$")>;
def : InstRW<[LSU_lat1, EndGroup], (instregex "CondReturn$")>;

// Compare and branch
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?C(I|R)J$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CG(I|R)J$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CL(I|R)J$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLG(I|R)J$")>;
def : InstRW<[FXU], (instregex "CLR$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CIB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLIB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLGIB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CGIB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CGRB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLGRB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "CLR(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLRB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CRB(Call|Return)?$")>;

// Branch
def : InstRW<[LSU, EndGroup], (instregex "(Asm.*)?BR$")>;
def : InstRW<[LSU, EndGroup], (instregex "(Asm)?BC(R)?$")>;
def : InstRW<[LSU, EndGroup], (instregex "(Asm)?BRC(L)?$")>;
def : InstRW<[LSU, EndGroup], (instregex "(Call)?BRC(L)?(Asm.*)?$")>;
def : InstRW<[LSU, EndGroup], (instregex "(Call)?J(G)?(Asm.*)?$")>;
def : InstRW<[LSU, EndGroup], (instregex "(Call)?BC(R)?(Asm.*)?$")>;
def : InstRW<[LSU, EndGroup], (instregex "(Call)?B(R)?(Asm.*)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "BRCT(G)?$")>;
def : InstRW<[LSU, EndGroup], (instregex "(Asm.*)?JG$")>;
def : InstRW<[LSU, EndGroup], (instregex "J$")>;
// (Need to avoid conflict with "(Asm.*)?CG(I|R)J$")
def : InstRW<[LSU, EndGroup], (instregex "Asm(EAlt|E|HAlt|HE|H|LAlt|LE|LH|L|NEAlt|NE)J$")>;
def : InstRW<[LSU, EndGroup], (instregex "Asm(NHAlt|NHE|NH|NLAlt|NLE|NLH|NL|NO|O)J$")>;
def : InstRW<[FXU, FXU, FXU, LSU, Lat7, GroupAlone], (instregex "BRX(H|LE)$")>;

// Compare and branch
def : InstRW<[FXU, LSU, Lat5, GroupAlone],
(instregex "C(L)?(G)?(I|R)J(Asm.*)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone],
(instregex "C(L)?(G)?(I|R)B(Call|Return|Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Trap instructions
//===----------------------------------------------------------------------===//

// Trap
def : InstRW<[LSU, EndGroup], (instregex "(Cond)?Trap$")>;

// Compare and trap
def : InstRW<[FXU], (instregex "(Asm.*)?C(G)?IT$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?C(G)?RT$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CLG(I|R)T$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CLFIT$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CLRT$")>;
def : InstRW<[FXU], (instregex "C(G)?(I|R)T(Asm.*)?$")>;
def : InstRW<[FXU], (instregex "CL(G)?RT(Asm.*)?$")>;
def : InstRW<[FXU], (instregex "CL(F|G)IT(Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Call and return instructions
//===----------------------------------------------------------------------===//

// Call
def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "(Call)?BRAS$")>;
def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "(Call)?BRASL$")>;
def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "(Call)?BAS(R)?$")>;
def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "TLS_(G|L)DCALL$")>;

// Return
def : InstRW<[LSU_lat1, EndGroup], (instregex "Return$")>;
def : InstRW<[LSU_lat1, EndGroup], (instregex "CondReturn$")>;

//===----------------------------------------------------------------------===//
// Select instructions
Expand All @@ -142,18 +140,6 @@ def : InstRW<[FXU], (instregex "CondStore64(Inv)?$")>;
def : InstRW<[FXU], (instregex "CondStore8(Inv)?$")>;
def : InstRW<[FXU], (instregex "CondStore8Mux(Inv)?$")>;

//===----------------------------------------------------------------------===//
// Call instructions
//===----------------------------------------------------------------------===//

def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "BRAS$")>;
def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "(Call)?BASR$")>;
def : InstRW<[LSU, EndGroup], (instregex "CallB(C)?R$")>;
def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "(Call)?BRASL$")>;
def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "TLS_(G|L)DCALL$")>;
def : InstRW<[LSU, EndGroup], (instregex "CallBRCL$")>;
def : InstRW<[LSU, EndGroup], (instregex "CallJG$")>;

//===----------------------------------------------------------------------===//
// Move instructions
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -188,21 +174,23 @@ def : InstRW<[FXU], (instregex "LR(Mux)?$")>;
def : InstRW<[FXU, LSU, Lat5], (instregex "LT(G)?$")>;
def : InstRW<[FXU], (instregex "LT(G)?R$")>;

// Load on condition
def : InstRW<[FXU, LSU, Lat6, EndGroup], (instregex "(Asm.*)?LOC(G)?$")>;
def : InstRW<[FXU, Lat2, EndGroup], (instregex "(Asm.*)?LOC(G)?R$")>;

// Stores
def : InstRW<[FXU, LSU, Lat5], (instregex "STG(RL)?$")>;
def : InstRW<[FXU, LSU, Lat5], (instregex "ST128$")>;
def : InstRW<[FXU, LSU, Lat5], (instregex "ST(Y|FH|RL|Mux)?$")>;

// Store on condition
def : InstRW<[FXU, LSU, Lat5, EndGroup], (instregex "(Asm.*)?STOC(G)?$")>;

// String moves.
def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVST$")>;

//===----------------------------------------------------------------------===//
// Conditional move instructions
//===----------------------------------------------------------------------===//

def : InstRW<[FXU, Lat2, EndGroup], (instregex "LOC(G)?R(Asm.*)?$")>;
def : InstRW<[FXU, Lat2, EndGroup], (instregex "LOC(G)?HI(Asm.*)?$")>;
def : InstRW<[FXU, LSU, Lat6, EndGroup], (instregex "LOC(G)?(Asm.*)?$")>;
def : InstRW<[FXU, LSU, Lat5, EndGroup], (instregex "STOC(G)?(Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Sign extensions
//===----------------------------------------------------------------------===//
Expand Down
94 changes: 40 additions & 54 deletions llvm/lib/Target/SystemZ/SystemZScheduleZEC12.td
Original file line number Diff line number Diff line change
Expand Up @@ -84,51 +84,47 @@ def : WriteRes<VBU, [ZEC12_VBUnit]>; // Virtual Branching Unit
def : InstRW<[FXU], (instregex "ADJDYNALLOC$")>; // Pseudo -> LA / LAY

//===----------------------------------------------------------------------===//
// Control flow instructions
// Branch instructions
//===----------------------------------------------------------------------===//

// Return
def : InstRW<[LSU_lat1, EndGroup], (instregex "Return$")>;
def : InstRW<[LSU_lat1], (instregex "CondReturn$")>;

// Compare and branch
def : InstRW<[FXU], (instregex "(Asm.*)?C(I|R)J$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CG(I|R)J$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CL(I|R)J$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CLG(I|R)J$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CG(R|I)J$")>;
def : InstRW<[FXU], (instregex "CLR$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CIB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLIB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLGIB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CGIB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CGRB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLGRB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "CLR(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CLRB(Call|Return)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "(Asm.*)?CRB(Call|Return)?$")>;

// Branch
def : InstRW<[LSU, Lat4], (instregex "(Asm.*)?BR$")>;
def : InstRW<[LSU, Lat4], (instregex "(Asm)?BC(R)?$")>;
def : InstRW<[VBU], (instregex "(Asm)?BRC(L)?$")>;
def : InstRW<[VBU], (instregex "(Call)?BRC(L)?(Asm.*)?$")>;
def : InstRW<[VBU], (instregex "(Call)?J(G)?(Asm.*)?$")>;
def : InstRW<[LSU, Lat4], (instregex "(Call)?BC(R)?(Asm.*)?$")>;
def : InstRW<[LSU, Lat4], (instregex "(Call)?B(R)?(Asm.*)?$")>;
def : InstRW<[FXU, EndGroup], (instregex "BRCT(G)?$")>;
def : InstRW<[VBU], (instregex "(Asm.*)?JG$")>;
def : InstRW<[VBU], (instregex "J$")>;
// (Need to avoid conflict with "(Asm.*)?CG(I|R)J$")
def : InstRW<[VBU], (instregex "Asm(EAlt|E|HAlt|HE|H|LAlt|LE|LH|L|NEAlt|NE)J$")>;
def : InstRW<[VBU], (instregex "Asm(NHAlt|NHE|NH|NLAlt|NLE|NLH|NL|NO|O)J$")>;
def : InstRW<[FXU, FXU, FXU, LSU, Lat7, GroupAlone], (instregex "BRX(H|LE)$")>;

// Compare and branch
def : InstRW<[FXU], (instregex "C(L)?(G)?(I|R)J(Asm.*)?$")>;
def : InstRW<[FXU, LSU, Lat5, GroupAlone],
(instregex "C(L)?(G)?(I|R)B(Call|Return|Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Trap instructions
//===----------------------------------------------------------------------===//

// Trap
def : InstRW<[VBU], (instregex "(Cond)?Trap$")>;

// Compare and trap
def : InstRW<[FXU], (instregex "(Asm.*)?C(G)?IT$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?C(G)?RT$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CLG(I|R)T$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CLFIT$")>;
def : InstRW<[FXU], (instregex "(Asm.*)?CLRT$")>;
def : InstRW<[FXU], (instregex "C(G)?(I|R)T(Asm.*)?$")>;
def : InstRW<[FXU], (instregex "CL(G)?RT(Asm.*)?$")>;
def : InstRW<[FXU], (instregex "CL(F|G)IT(Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Call and return instructions
//===----------------------------------------------------------------------===//

// Call
def : InstRW<[VBU, FXU, FXU, Lat3, GroupAlone], (instregex "(Call)?BRAS$")>;
def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "(Call)?BRASL$")>;
def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "(Call)?BAS(R)?$")>;
def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "TLS_(G|L)DCALL$")>;

// Return
def : InstRW<[LSU_lat1, EndGroup], (instregex "Return$")>;
def : InstRW<[LSU_lat1], (instregex "CondReturn$")>;

//===----------------------------------------------------------------------===//
// Select instructions
Expand All @@ -145,18 +141,6 @@ def : InstRW<[FXU], (instregex "CondStore64(Inv)?$")>;
def : InstRW<[FXU], (instregex "CondStore8(Inv)?$")>;
def : InstRW<[FXU], (instregex "CondStore8Mux(Inv)?$")>;

//===----------------------------------------------------------------------===//
// Call instructions
//===----------------------------------------------------------------------===//

def : InstRW<[VBU, FXU, FXU, Lat3, GroupAlone], (instregex "BRAS$")>;
def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "(Call)?BASR$")>;
def : InstRW<[LSU, Lat4], (instregex "CallB(C)?R$")>;
def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "(Call)?BRASL$")>;
def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "TLS_(G|L)DCALL$")>;
def : InstRW<[VBU], (instregex "CallBRCL$")>;
def : InstRW<[VBU], (instregex "CallJG$")>;

//===----------------------------------------------------------------------===//
// Move instructions
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -191,21 +175,23 @@ def : InstRW<[FXU], (instregex "LR(Mux)?$")>;
def : InstRW<[FXU, LSU, Lat5], (instregex "LT(G)?$")>;
def : InstRW<[FXU], (instregex "LT(G)?R$")>;

// Load on condition
def : InstRW<[FXU, LSU, Lat6], (instregex "(Asm.*)?LOC(G)?$")>;
def : InstRW<[FXU, Lat2], (instregex "(Asm.*)?LOC(G)?R$")>;

// Stores
def : InstRW<[FXU, LSU, Lat5], (instregex "STG(RL)?$")>;
def : InstRW<[FXU, LSU, Lat5], (instregex "ST128$")>;
def : InstRW<[FXU, LSU, Lat5], (instregex "ST(Y|FH|RL|Mux)?$")>;

// Store on condition
def : InstRW<[FXU, LSU, Lat5], (instregex "(Asm.*)?STOC(G)?$")>;

// String moves.
def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVST$")>;

//===----------------------------------------------------------------------===//
// Conditional move instructions
//===----------------------------------------------------------------------===//

def : InstRW<[FXU, Lat2], (instregex "LOC(G)?R(Asm.*)?$")>;
def : InstRW<[FXU, Lat2], (instregex "LOC(G)?HI(Asm.*)?$")>;
def : InstRW<[FXU, LSU, Lat6], (instregex "LOC(G)?(Asm.*)?$")>;
def : InstRW<[FXU, LSU, Lat5], (instregex "STOC(G)?(Asm.*)?$")>;

//===----------------------------------------------------------------------===//
// Sign extensions
//===----------------------------------------------------------------------===//
Expand Down
96 changes: 96 additions & 0 deletions llvm/test/MC/Disassembler/SystemZ/insns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,24 @@
# CHECK: ay %r15, 0
0xe3 0xf0 0x00 0x00 0x00 0x5a

# CHECK: bas %r0, 0
0x4d 0x00 0x00 0x00

# CHECK: bas %r1, 4095
0x4d 0x10 0x0f 0xff

# CHECK: bas %r2, 0(%r1)
0x4d 0x20 0x10 0x00

# CHECK: bas %r3, 0(%r15)
0x4d 0x30 0xf0 0x00

# CHECK: bas %r14, 4095(%r1,%r15)
0x4d 0xe1 0xff 0xff

# CHECK: bas %r15, 4095(%r15,%r1)
0x4d 0xff 0x1f 0xff

# CHECK: basr %r0, %r1
0x0d 0x01

Expand All @@ -790,6 +808,84 @@
# CHECK: basr %r15, %r1
0x0d 0xf1

# CHECK: b 0
0x47 0xf0 0x00 0x00

# CHECK: b 4095
0x47 0xf0 0x0f 0xff

# CHECK: b 0(%r1)
0x47 0xf0 0x10 0x00

# CHECK: b 0(%r15)
0x47 0xf0 0xf0 0x00

# CHECK: b 4095(%r1,%r15)
0x47 0xf1 0xff 0xff

# CHECK: b 4095(%r15,%r1)
0x47 0xff 0x1f 0xff

# CHECK: bc 0, 0
0x47 0x00 0x00 0x00

# CHECK: bc 0, 4095
0x47 0x00 0x0f 0xff

# CHECK: bc 0, 0(%r1)
0x47 0x00 0x10 0x00

# CHECK: bc 0, 0(%r15)
0x47 0x00 0xf0 0x00

# CHECK: bc 0, 4095(%r1,%r15)
0x47 0x01 0xff 0xff

# CHECK: bc 0, 4095(%r15,%r1)
0x47 0x0f 0x1f 0xff

# CHECK: bo 0(%r13)
0x47 0x10 0xd0 0x00

# CHECK: bh 0(%r12)
0x47 0x20 0xc0 0x00

# CHECK: bnle 0(%r11)
0x47 0x30 0xb0 0x00

# CHECK: bl 0(%r10)
0x47 0x40 0xa0 0x00

# CHECK: bnhe 0(%r9)
0x47 0x50 0x90 0x00

# CHECK: blh 0(%r8)
0x47 0x60 0x80 0x00

# CHECK: bne 0(%r7)
0x47 0x70 0x70 0x00

# CHECK: be 0(%r6)
0x47 0x80 0x60 0x00

# CHECK: bnlh 0(%r5)
0x47 0x90 0x50 0x00

# CHECK: bhe 0(%r4)
0x47 0xa0 0x40 0x00

# CHECK: bnl 0(%r3)
0x47 0xb0 0x30 0x00

# CHECK: ble 0(%r2)
0x47 0xc0 0x20 0x00

# CHECK: bnh 0(%r1)
0x47 0xd0 0x10 0x00

# CHECK: bno 0
0x47 0xe0 0x00 0x00

# CHECK: bcr 0, %r14
0x07 0x0e

Expand Down
22 changes: 22 additions & 0 deletions llvm/test/MC/SystemZ/insn-bad.s
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,28 @@
ay %r0, -524289
ay %r0, 524288

#CHECK: error: invalid operand
#CHECK: bas %r0, -1
#CHECK: error: invalid operand
#CHECK: bas %r0, 4096

bas %r0, -1
bas %r0, 4096

#CHECK: error: invalid operand
#CHECK: bc -1, 0(%r1)
#CHECK: error: invalid operand
#CHECK: bc 16, 0(%r1)
#CHECK: error: invalid operand
#CHECK: bc 0, -1
#CHECK: error: invalid operand
#CHECK: bc 0, 4096

bc -1, 0(%r1)
bc 16, 0(%r1)
bc 0, -1
bc 0, 4096

#CHECK: error: invalid operand
#CHECK: bcr -1, %r1
#CHECK: error: invalid operand
Expand Down
128 changes: 128 additions & 0 deletions llvm/test/MC/SystemZ/insn-good.s
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,20 @@
ay %r0, 524287(%r15,%r1)
ay %r15, 0

#CHECK: bas %r0, 0 # encoding: [0x4d,0x00,0x00,0x00]
#CHECK: bas %r1, 4095 # encoding: [0x4d,0x10,0x0f,0xff]
#CHECK: bas %r2, 0(%r1) # encoding: [0x4d,0x20,0x10,0x00]
#CHECK: bas %r3, 0(%r15) # encoding: [0x4d,0x30,0xf0,0x00]
#CHECK: bas %r14, 4095(%r1,%r15) # encoding: [0x4d,0xe1,0xff,0xff]
#CHECK: bas %r15, 4095(%r15,%r1) # encoding: [0x4d,0xff,0x1f,0xff]

bas %r0, 0
bas %r1, 4095
bas %r2, 0(%r1)
bas %r3, 0(%r15)
bas %r14, 4095(%r1,%r15)
bas %r15, 4095(%r15,%r1)

#CHECK: basr %r0, %r1 # encoding: [0x0d,0x01]
#CHECK: basr %r0, %r15 # encoding: [0x0d,0x0f]
#CHECK: basr %r14, %r9 # encoding: [0x0d,0xe9]
Expand All @@ -527,6 +541,120 @@
basr %r14,%r9
basr %r15,%r1

#CHECK: b 0 # encoding: [0x47,0xf0,0x00,0x00]
#CHECK: b 4095 # encoding: [0x47,0xf0,0x0f,0xff]
#CHECK: b 0(%r1) # encoding: [0x47,0xf0,0x10,0x00]
#CHECK: b 0(%r15) # encoding: [0x47,0xf0,0xf0,0x00]
#CHECK: b 4095(%r1,%r15) # encoding: [0x47,0xf1,0xff,0xff]
#CHECK: b 4095(%r15,%r1) # encoding: [0x47,0xff,0x1f,0xff]

b 0
b 4095
b 0(%r1)
b 0(%r15)
b 4095(%r1,%r15)
b 4095(%r15,%r1)

#CHECK: bc 0, 0 # encoding: [0x47,0x00,0x00,0x00]
#CHECK: bc 0, 4095 # encoding: [0x47,0x00,0x0f,0xff]
#CHECK: bc 0, 0(%r1) # encoding: [0x47,0x00,0x10,0x00]
#CHECK: bc 0, 0(%r15) # encoding: [0x47,0x00,0xf0,0x00]
#CHECK: bc 0, 4095(%r1,%r15) # encoding: [0x47,0x01,0xff,0xff]
#CHECK: bc 0, 4095(%r15,%r1) # encoding: [0x47,0x0f,0x1f,0xff]
#CHECK: bc 15, 0 # encoding: [0x47,0xf0,0x00,0x00]

bc 0, 0
bc 0, 4095
bc 0, 0(%r1)
bc 0, 0(%r15)
bc 0, 4095(%r1,%r15)
bc 0, 4095(%r15,%r1)
bc 15, 0

#CHECK: bc 1, 0(%r7) # encoding: [0x47,0x10,0x70,0x00]
#CHECK: bo 0(%r15) # encoding: [0x47,0x10,0xf0,0x00]

bc 1, 0(%r7)
bo 0(%r15)

#CHECK: bc 2, 0(%r7) # encoding: [0x47,0x20,0x70,0x00]
#CHECK: bh 0(%r15) # encoding: [0x47,0x20,0xf0,0x00]

bc 2, 0(%r7)
bh 0(%r15)

#CHECK: bc 3, 0(%r7) # encoding: [0x47,0x30,0x70,0x00]
#CHECK: bnle 0(%r15) # encoding: [0x47,0x30,0xf0,0x00]

bc 3, 0(%r7)
bnle 0(%r15)

#CHECK: bc 4, 0(%r7) # encoding: [0x47,0x40,0x70,0x00]
#CHECK: bl 0(%r15) # encoding: [0x47,0x40,0xf0,0x00]

bc 4, 0(%r7)
bl 0(%r15)

#CHECK: bc 5, 0(%r7) # encoding: [0x47,0x50,0x70,0x00]
#CHECK: bnhe 0(%r15) # encoding: [0x47,0x50,0xf0,0x00]

bc 5, 0(%r7)
bnhe 0(%r15)

#CHECK: bc 6, 0(%r7) # encoding: [0x47,0x60,0x70,0x00]
#CHECK: blh 0(%r15) # encoding: [0x47,0x60,0xf0,0x00]

bc 6, 0(%r7)
blh 0(%r15)

#CHECK: bc 7, 0(%r7) # encoding: [0x47,0x70,0x70,0x00]
#CHECK: bne 0(%r15) # encoding: [0x47,0x70,0xf0,0x00]

bc 7, 0(%r7)
bne 0(%r15)

#CHECK: bc 8, 0(%r7) # encoding: [0x47,0x80,0x70,0x00]
#CHECK: be 0(%r15) # encoding: [0x47,0x80,0xf0,0x00]

bc 8, 0(%r7)
be 0(%r15)

#CHECK: bc 9, 0(%r7) # encoding: [0x47,0x90,0x70,0x00]
#CHECK: bnlh 0(%r15) # encoding: [0x47,0x90,0xf0,0x00]

bc 9, 0(%r7)
bnlh 0(%r15)

#CHECK: bc 10, 0(%r7) # encoding: [0x47,0xa0,0x70,0x00]
#CHECK: bhe 0(%r15) # encoding: [0x47,0xa0,0xf0,0x00]

bc 10, 0(%r7)
bhe 0(%r15)

#CHECK: bc 11, 0(%r7) # encoding: [0x47,0xb0,0x70,0x00]
#CHECK: bnl 0(%r15) # encoding: [0x47,0xb0,0xf0,0x00]

bc 11, 0(%r7)
bnl 0(%r15)

#CHECK: bc 12, 0(%r7) # encoding: [0x47,0xc0,0x70,0x00]
#CHECK: ble 0(%r15) # encoding: [0x47,0xc0,0xf0,0x00]

bc 12, 0(%r7)
ble 0(%r15)

#CHECK: bc 13, 0(%r7) # encoding: [0x47,0xd0,0x70,0x00]
#CHECK: bnh 0(%r15) # encoding: [0x47,0xd0,0xf0,0x00]

bc 13, 0(%r7)
bnh 0(%r15)

#CHECK: bc 14, 0(%r7) # encoding: [0x47,0xe0,0x70,0x00]
#CHECK: bno 0(%r15) # encoding: [0x47,0xe0,0xf0,0x00]

bc 14, 0(%r7)
bno 0(%r15)

#CHECK: bcr 0, %r0 # encoding: [0x07,0x00]
#CHECK: bcr 0, %r15 # encoding: [0x07,0x0f]

Expand Down