// Bit counting instructions can not set the high bits of the result
// register. The max number of bits sets depends on the input.
return (Mask & (MVT::getSizeInBits(Op.getValueType())*2-1)) == 0;
- default: break;
+ default:
+ if (Op.getOpcode() >= ISD::BUILTIN_OP_END)
+ return TLI.isMaskedValueZeroForTargetNode(Op, Mask);
+ break;
}
return false;
}
setOperationAction(ISD::SETCC , MVT::i8 , Custom);
setOperationAction(ISD::SETCC , MVT::i16 , Custom);
setOperationAction(ISD::SETCC , MVT::i32 , Custom);
+ setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom);
}
// We don't have line number support yet.
}
case ISD::GlobalAddress:
GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
+ SDOperand GVOp = DAG.getTargetGlobalAddress(GV, getPointerTy());
// For Darwin, external and weak symbols are indirect, so we want to load
// the value at address GV, not the value of GV itself. This means that
// the GlobalAddress must be in the base or index register of the address,
if (getTargetMachine().
getSubtarget<X86Subtarget>().getIndirectExternAndWeakGlobals() &&
(GV->hasWeakLinkage() || GV->isExternal()))
- return DAG.getLoad(MVT::i32, DAG.getEntryNode(), Op,
- DAG.getSrcValue(NULL));
+ return DAG.getLoad(MVT::i32, DAG.getEntryNode(),
+ GVOp, DAG.getSrcValue(NULL));
else
- return Op;
+ return GVOp;
break;
}
}
case X86ISD::RET_FLAG: return "X86ISD::RET_FLAG";
}
}
+
+bool X86TargetLowering::isMaskedValueZeroForTargetNode(const SDOperand &Op,
+ uint64_t Mask) const {
+
+ unsigned Opc = Op.getOpcode();
+
+ switch (Opc) {
+ default:
+ assert(Opc >= ISD::BUILTIN_OP_END && "Expected a target specific node");
+ break;
+ case X86ISD::SETCC: return (Mask & 1) == 0;
+ }
+
+ return false;
+}
/// DAG node.
virtual const char *getTargetNodeName(unsigned Opcode) const;
+ /// isMaskedValueZeroForTargetNode - Return true if 'Op & Mask' is known to
+ /// be zero. Op is expected to be a target specific node. Used by DAG
+ /// combiner.
+ virtual bool isMaskedValueZeroForTargetNode(const SDOperand &Op,
+ uint64_t Mask) const;
+
SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG);
private:
// Define X86 specific addressing mode.
def addr : ComplexPattern<i32, 4, "SelectAddr", []>;
def leaaddr : ComplexPattern<i32, 4, "SelectLEAAddr",
- [add,
- frameindex, constpool, globaladdr, externalsym]>;
+ [add, frameindex, constpool,
+ globaladdr, tglobaladdr, externalsym]>;
//===----------------------------------------------------------------------===//
// X86 Instruction Format Definitions.