mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Implement all comparisons
llvm-svn: 76017
This commit is contained in:
parent
488f8c2fd1
commit
643215b0d7
@ -26,12 +26,20 @@ namespace llvm {
|
||||
// SystemZ specific condition code. These correspond to SYSTEMZ_*_COND in
|
||||
// SystemZInstrInfo.td. They must be kept in synch.
|
||||
enum CondCodes {
|
||||
E = 0,
|
||||
NE = 1,
|
||||
H = 2,
|
||||
L = 3,
|
||||
HE = 4,
|
||||
LE = 5
|
||||
O = 0,
|
||||
H = 1,
|
||||
NLE = 2,
|
||||
L = 3,
|
||||
NHE = 4,
|
||||
LH = 5,
|
||||
NE = 6,
|
||||
E = 7,
|
||||
NLH = 8,
|
||||
HE = 9,
|
||||
NL = 10,
|
||||
LE = 11,
|
||||
NH = 12,
|
||||
NO = 13
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -484,8 +484,6 @@ SDValue SystemZTargetLowering::LowerRET(SDValue Op, SelectionDAG &DAG) {
|
||||
SDValue SystemZTargetLowering::EmitCmp(SDValue LHS, SDValue RHS,
|
||||
ISD::CondCode CC, SDValue &SystemZCC,
|
||||
SelectionDAG &DAG) {
|
||||
assert(!LHS.getValueType().isFloatingPoint() && "We don't handle FP yet");
|
||||
|
||||
// FIXME: Emit a test if RHS is zero
|
||||
|
||||
bool isUnsigned = false;
|
||||
@ -493,29 +491,63 @@ SDValue SystemZTargetLowering::EmitCmp(SDValue LHS, SDValue RHS,
|
||||
switch (CC) {
|
||||
default: assert(0 && "Invalid integer condition!");
|
||||
case ISD::SETEQ:
|
||||
case ISD::SETOEQ:
|
||||
TCC = SystemZCC::E;
|
||||
break;
|
||||
case ISD::SETUEQ:
|
||||
TCC = SystemZCC::NLH;
|
||||
break;
|
||||
case ISD::SETNE:
|
||||
case ISD::SETONE:
|
||||
TCC = SystemZCC::NE;
|
||||
break;
|
||||
case ISD::SETUNE:
|
||||
TCC = SystemZCC::LH;
|
||||
break;
|
||||
case ISD::SETO:
|
||||
TCC = SystemZCC::O;
|
||||
break;
|
||||
case ISD::SETUO:
|
||||
TCC = SystemZCC::NO;
|
||||
break;
|
||||
case ISD::SETULE:
|
||||
if (LHS.getValueType().isFloatingPoint()) {
|
||||
TCC = SystemZCC::NH;
|
||||
break;
|
||||
}
|
||||
isUnsigned = true; // FALLTHROUGH
|
||||
case ISD::SETLE:
|
||||
case ISD::SETOLE:
|
||||
TCC = SystemZCC::LE;
|
||||
break;
|
||||
case ISD::SETUGE:
|
||||
if (LHS.getValueType().isFloatingPoint()) {
|
||||
TCC = SystemZCC::NL;
|
||||
break;
|
||||
}
|
||||
isUnsigned = true; // FALLTHROUGH
|
||||
case ISD::SETGE:
|
||||
case ISD::SETOGE:
|
||||
TCC = SystemZCC::HE;
|
||||
break;
|
||||
case ISD::SETUGT:
|
||||
isUnsigned = true;
|
||||
if (LHS.getValueType().isFloatingPoint()) {
|
||||
TCC = SystemZCC::NLE;
|
||||
break;
|
||||
}
|
||||
isUnsigned = true; // FALLTHROUGH
|
||||
case ISD::SETGT:
|
||||
TCC = SystemZCC::H; // FALLTHROUGH
|
||||
case ISD::SETOGT:
|
||||
TCC = SystemZCC::H;
|
||||
break;
|
||||
case ISD::SETULT:
|
||||
isUnsigned = true;
|
||||
case ISD::SETLT: // FALLTHROUGH
|
||||
if (LHS.getValueType().isFloatingPoint()) {
|
||||
TCC = SystemZCC::NHE;
|
||||
break;
|
||||
}
|
||||
isUnsigned = true; // FALLTHROUGH
|
||||
case ISD::SETLT:
|
||||
case ISD::SETOLT:
|
||||
TCC = SystemZCC::L;
|
||||
break;
|
||||
}
|
||||
|
@ -104,25 +104,48 @@ let isBranch = 1, isTerminator = 1 in {
|
||||
}
|
||||
|
||||
let Uses = [PSW] in {
|
||||
def JE : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"je\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_E)]>;
|
||||
def JNE : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jne\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_NE)]>;
|
||||
def JO : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jo\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_O)]>;
|
||||
def JH : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jh\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_H)]>;
|
||||
def JNLE: Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jnle\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_NLE)]>;
|
||||
def JL : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jl\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_L)]>;
|
||||
def JNHE: Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jnhe\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_NHE)]>;
|
||||
def JLH : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jlh\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_LH)]>;
|
||||
def JNE : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jne\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_NE)]>;
|
||||
def JE : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"je\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_E)]>;
|
||||
def JNLH: Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jnlh\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_NLH)]>;
|
||||
def JHE : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jhe\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_HE)]>;
|
||||
def JNL : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jnl\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_NL)]>;
|
||||
def JLE : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jle\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_LE)]>;
|
||||
|
||||
def JNH : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jnh\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_NH)]>;
|
||||
def JNO : Pseudo<(outs), (ins brtarget:$dst),
|
||||
"jno\t$dst",
|
||||
[(SystemZbrcond bb:$dst, SYSTEMZ_COND_NO)]>;
|
||||
} // Uses = [PSW]
|
||||
} // isBranch = 1
|
||||
|
||||
|
@ -17,12 +17,20 @@
|
||||
|
||||
// SystemZ specific condition code. These correspond to CondCode in
|
||||
// SystemZ.h. They must be kept in synch.
|
||||
def SYSTEMZ_COND_E : PatLeaf<(i8 0)>;
|
||||
def SYSTEMZ_COND_NE : PatLeaf<(i8 1)>;
|
||||
def SYSTEMZ_COND_H : PatLeaf<(i8 2)>;
|
||||
def SYSTEMZ_COND_L : PatLeaf<(i8 3)>;
|
||||
def SYSTEMZ_COND_HE : PatLeaf<(i8 4)>;
|
||||
def SYSTEMZ_COND_LE : PatLeaf<(i8 5)>;
|
||||
def SYSTEMZ_COND_O : PatLeaf<(i8 0)>;
|
||||
def SYSTEMZ_COND_H : PatLeaf<(i8 1)>;
|
||||
def SYSTEMZ_COND_NLE : PatLeaf<(i8 2)>;
|
||||
def SYSTEMZ_COND_L : PatLeaf<(i8 3)>;
|
||||
def SYSTEMZ_COND_NHE : PatLeaf<(i8 4)>;
|
||||
def SYSTEMZ_COND_LH : PatLeaf<(i8 5)>;
|
||||
def SYSTEMZ_COND_NE : PatLeaf<(i8 6)>;
|
||||
def SYSTEMZ_COND_E : PatLeaf<(i8 7)>;
|
||||
def SYSTEMZ_COND_NLH : PatLeaf<(i8 8)>;
|
||||
def SYSTEMZ_COND_HE : PatLeaf<(i8 9)>;
|
||||
def SYSTEMZ_COND_NL : PatLeaf<(i8 10)>;
|
||||
def SYSTEMZ_COND_LE : PatLeaf<(i8 11)>;
|
||||
def SYSTEMZ_COND_NH : PatLeaf<(i8 12)>;
|
||||
def SYSTEMZ_COND_NO : PatLeaf<(i8 13)>;
|
||||
|
||||
def LL16 : SDNodeXForm<imm, [{
|
||||
// Transformation function: return low 16 bits.
|
||||
|
Loading…
Reference in New Issue
Block a user