diff options
| author | Andrew Lenharth <andrewl@lenharth.org> | 2006-02-13 18:52:29 +0000 |
|---|---|---|
| committer | Andrew Lenharth <andrewl@lenharth.org> | 2006-02-13 18:52:29 +0000 |
| commit | a438ef0ee7a326b8a7a2ae371ead2906ca8d65eb (patch) | |
| tree | 1d1688abbb0e5e96cade9c3a1ee50ce2f4dabdf3 /llvm | |
| parent | a3bc7b8a85fa5054b20bcda6d9ba2673204dd5ff (diff) | |
| download | bcm5719-llvm-a438ef0ee7a326b8a7a2ae371ead2906ca8d65eb.tar.gz bcm5719-llvm-a438ef0ee7a326b8a7a2ae371ead2906ca8d65eb.zip | |
improved zap discovery
llvm-svn: 26148
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp b/llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp index 1a442c07bce..4c49fb9d0a2 100644 --- a/llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp +++ b/llvm/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); |

