mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
X86: when replacing SUB with TEST in ISelDAGToDAG, only replace uses of the
second output of SUB with first output of TEST. PR13966 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2525,7 +2525,13 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||||||
MVT::i8, Reg);
|
MVT::i8, Reg);
|
||||||
|
|
||||||
// Emit a testb.
|
// Emit a testb.
|
||||||
return CurDAG->getMachineNode(X86::TEST8ri, dl, MVT::i32, Subreg, Imm);
|
SDNode *NewNode = CurDAG->getMachineNode(X86::TEST8ri, dl, MVT::i32,
|
||||||
|
Subreg, Imm);
|
||||||
|
// Replace SUB|CMP with TEST, since SUB has two outputs while TEST has
|
||||||
|
// one, do not call ReplaceAllUsesWith.
|
||||||
|
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
|
||||||
|
SDValue(NewNode, 0));
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For example, "testl %eax, $2048" to "testb %ah, $8".
|
// For example, "testl %eax, $2048" to "testb %ah, $8".
|
||||||
@@ -2556,8 +2562,13 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||||||
// Emit a testb. The EXTRACT_SUBREG becomes a COPY that can only
|
// Emit a testb. The EXTRACT_SUBREG becomes a COPY that can only
|
||||||
// target GR8_NOREX registers, so make sure the register class is
|
// target GR8_NOREX registers, so make sure the register class is
|
||||||
// forced.
|
// forced.
|
||||||
return CurDAG->getMachineNode(X86::TEST8ri_NOREX, dl, MVT::i32,
|
SDNode *NewNode = CurDAG->getMachineNode(X86::TEST8ri_NOREX, dl,
|
||||||
Subreg, ShiftedImm);
|
MVT::i32, Subreg, ShiftedImm);
|
||||||
|
// Replace SUB|CMP with TEST, since SUB has two outputs while TEST has
|
||||||
|
// one, do not call ReplaceAllUsesWith.
|
||||||
|
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
|
||||||
|
SDValue(NewNode, 0));
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For example, "testl %eax, $32776" to "testw %ax, $32776".
|
// For example, "testl %eax, $32776" to "testw %ax, $32776".
|
||||||
@@ -2573,7 +2584,13 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||||||
MVT::i16, Reg);
|
MVT::i16, Reg);
|
||||||
|
|
||||||
// Emit a testw.
|
// Emit a testw.
|
||||||
return CurDAG->getMachineNode(X86::TEST16ri, dl, MVT::i32, Subreg, Imm);
|
SDNode *NewNode = CurDAG->getMachineNode(X86::TEST16ri, dl, MVT::i32,
|
||||||
|
Subreg, Imm);
|
||||||
|
// Replace SUB|CMP with TEST, since SUB has two outputs while TEST has
|
||||||
|
// one, do not call ReplaceAllUsesWith.
|
||||||
|
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
|
||||||
|
SDValue(NewNode, 0));
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For example, "testq %rax, $268468232" to "testl %eax, $268468232".
|
// For example, "testq %rax, $268468232" to "testl %eax, $268468232".
|
||||||
@@ -2589,7 +2606,13 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||||||
MVT::i32, Reg);
|
MVT::i32, Reg);
|
||||||
|
|
||||||
// Emit a testl.
|
// Emit a testl.
|
||||||
return CurDAG->getMachineNode(X86::TEST32ri, dl, MVT::i32, Subreg, Imm);
|
SDNode *NewNode = CurDAG->getMachineNode(X86::TEST32ri, dl, MVT::i32,
|
||||||
|
Subreg, Imm);
|
||||||
|
// Replace SUB|CMP with TEST, since SUB has two outputs while TEST has
|
||||||
|
// one, do not call ReplaceAllUsesWith.
|
||||||
|
ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)),
|
||||||
|
SDValue(NewNode, 0));
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user