}
// Handle the setcc cases here. select_cc lhs, 0, 1, 0, cc
- if (!isPPC64)
- if (ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N->getOperand(1)))
- if (ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N->getOperand(2)))
- if (ConstantSDNode *N3C = dyn_cast<ConstantSDNode>(N->getOperand(3)))
- if (N1C->isZero() && N3C->isZero() && N2C->getZExtValue() == 1ULL &&
- CC == ISD::SETNE &&
- // FIXME: Implement this optzn for PPC64.
- N->getValueType(0) == MVT::i32) {
- SDNode *Tmp =
- CurDAG->getMachineNode(PPC::ADDIC, dl, MVT::i32, MVT::Glue,
- N->getOperand(0), getI32Imm(~0U, dl));
- CurDAG->SelectNodeTo(N, PPC::SUBFE, MVT::i32, SDValue(Tmp, 0),
- N->getOperand(0), SDValue(Tmp, 1));
- return;
- }
+ if (!isPPC64 && isNullConstant(N->getOperand(1)) &&
+ isOneConstant(N->getOperand(2)) && isNullConstant(N->getOperand(3)) &&
+ CC == ISD::SETNE &&
+ // FIXME: Implement this optzn for PPC64.
+ N->getValueType(0) == MVT::i32) {
+ SDNode *Tmp =
+ CurDAG->getMachineNode(PPC::ADDIC, dl, MVT::i32, MVT::Glue,
+ N->getOperand(0), getI32Imm(~0U, dl));
+ CurDAG->SelectNodeTo(N, PPC::SUBFE, MVT::i32, SDValue(Tmp, 0),
+ N->getOperand(0), SDValue(Tmp, 1));
+ return;
+ }
SDValue CCReg = SelectCC(N->getOperand(0), N->getOperand(1), CC, dl);
return;
case 'J':
// Validate & create an integer zero operand.
- if (auto *C = dyn_cast<ConstantSDNode>(Op))
- if (C->getZExtValue() == 0)
- Ops.push_back(
- DAG.getTargetConstant(0, SDLoc(Op), Subtarget.getXLenVT()));
+ if (isNullConstant(Op))
+ Ops.push_back(
+ DAG.getTargetConstant(0, SDLoc(Op), Subtarget.getXLenVT()));
return;
case 'K':
// Validate & create a 5-bit unsigned immediate operand.
// zero-extended to 64 bits and then added it to the base address, which gives
// unwanted results when the register holds a negative value.
// For more information see http://people.redhat.com/drepper/tls.pdf
- if (auto *C = dyn_cast<ConstantSDNode>(Address)) {
- if (C->getSExtValue() == 0 && AM.Segment.getNode() == nullptr &&
- !IndirectTlsSegRefs &&
- (Subtarget->isTargetGlibc() || Subtarget->isTargetAndroid() ||
- Subtarget->isTargetFuchsia())) {
- if (Subtarget->isTarget64BitILP32() && !AllowSegmentRegForX32)
- return true;
- switch (N->getPointerInfo().getAddrSpace()) {
- case X86AS::GS:
- AM.Segment = CurDAG->getRegister(X86::GS, MVT::i16);
- return false;
- case X86AS::FS:
- AM.Segment = CurDAG->getRegister(X86::FS, MVT::i16);
- return false;
+ if (isNullConstant(Address) && AM.Segment.getNode() == nullptr &&
+ !IndirectTlsSegRefs &&
+ (Subtarget->isTargetGlibc() || Subtarget->isTargetAndroid() ||
+ Subtarget->isTargetFuchsia())) {
+ if (Subtarget->isTarget64BitILP32() && !AllowSegmentRegForX32)
+ return true;
+ switch (N->getPointerInfo().getAddrSpace()) {
+ case X86AS::GS:
+ AM.Segment = CurDAG->getRegister(X86::GS, MVT::i16);
+ return false;
+ case X86AS::FS:
+ AM.Segment = CurDAG->getRegister(X86::FS, MVT::i16);
+ return false;
// Address space X86AS::SS is not handled here, because it is not used to
// address TLS areas.
- }
}
}