mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-24 08:33:39 +00:00
Turn X < 0 -> TEST X,X js
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30294 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7a6366de86
commit
bfd68a7858
@ -1873,14 +1873,17 @@ static bool translateX86CC(ISD::CondCode SetCCOpcode, bool isFP,
|
||||
SelectionDAG &DAG) {
|
||||
X86CC = X86ISD::COND_INVALID;
|
||||
if (!isFP) {
|
||||
if (SetCCOpcode == ISD::SETGT) {
|
||||
if (ConstantSDNode *RHSC = dyn_cast<ConstantSDNode>(RHS))
|
||||
if (RHSC->isAllOnesValue()) {
|
||||
// X > -1 -> X == 0, jump on sign.
|
||||
RHS = DAG.getConstant(0, RHS.getValueType());
|
||||
X86CC = X86ISD::COND_NS;
|
||||
return true;
|
||||
}
|
||||
if (ConstantSDNode *RHSC = dyn_cast<ConstantSDNode>(RHS)) {
|
||||
if (SetCCOpcode == ISD::SETGT && RHSC->isAllOnesValue()) {
|
||||
// X > -1 -> X == 0, jump !sign.
|
||||
RHS = DAG.getConstant(0, RHS.getValueType());
|
||||
X86CC = X86ISD::COND_NS;
|
||||
return true;
|
||||
} else if (SetCCOpcode == ISD::SETLT && RHSC->isNullValue()) {
|
||||
// X < 0 -> X == 0, jump on sign.
|
||||
X86CC = X86ISD::COND_S;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
switch (SetCCOpcode) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user