aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2006-02-13 18:52:29 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2006-02-13 18:52:29 +0000
commit40ec5037fa11b33e21bee07dfe26d9c185201df7 (patch)
tree1cf088f9054c6f903fdb46dc7c71e0e17c476302
parentbd7c22cdcc79f1f0c9e43991bb45d52177474ef8 (diff)
improved zap discovery
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26148 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/Alpha/AlphaISelDAGToDAG.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
index 1a442c07bc..4c49fb9d0a 100644
--- a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
+++ b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
@@ -363,6 +363,39 @@ void AlphaDAGToDAGISel::Select(SDOperand &Result, SDOperand Op) {
}
break;
+ case ISD::AND: {
+ ConstantSDNode* SC;
+ ConstantSDNode* MC;
+ if (N->getOperand(0).getOpcode() == ISD::SRL &&
+ (MC = dyn_cast<ConstantSDNode>(N->getOperand(1))) &&
+ (SC = dyn_cast<ConstantSDNode>(N->getOperand(0).getOperand(1))))
+ {
+ uint64_t sval = SC->getValue();
+ uint64_t mval = MC->getValue();
+ if (get_zapImm(mval)) //the result is a zap, let the autogened stuff deal
+ break;
+ // given mask X, and shift S, we want to see if there is any zap in the mask
+ // if we play around with the botton S bits
+ uint64_t dontcare = (~0ULL) >> (64 - sval);
+ uint64_t mask = mval << sval;
+
+ if (get_zapImm(mask | dontcare))
+ mask = mask | dontcare;
+
+ if (get_zapImm(mask)) {
+ SDOperand Src;
+ Select(Src, N->getOperand(0).getOperand(0));
+ SDOperand Z =
+ SDOperand(CurDAG->getTargetNode(Alpha::ZAPNOTi, MVT::i64, Src,
+ getI64Imm(get_zapImm(mask))), 0);
+ Result = SDOperand(CurDAG->getTargetNode(Alpha::SRL, MVT::i64, Z,
+ getI64Imm(sval)), 0);
+ return;
+ }
+ }
+ break;
+ }
+
}
SelectCode(Result, Op);