diff options
| author | Andrew Lenharth <andrewl@lenharth.org> | 2005-05-03 17:19:30 +0000 |
|---|---|---|
| committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-05-03 17:19:30 +0000 |
| commit | 691ef2ba066dda14ae4ac0ad645054fbc967785a (patch) | |
| tree | 1c06734df74c2303e4c1481e59c9598cd401b11c /lib/Target/Alpha/AlphaISelPattern.cpp | |
| parent | c88e681498feb35b78a029d029e3de401c75a8d3 (diff) | |
| download | llvm-691ef2ba066dda14ae4ac0ad645054fbc967785a.tar.gz llvm-691ef2ba066dda14ae4ac0ad645054fbc967785a.tar.bz2 llvm-691ef2ba066dda14ae4ac0ad645054fbc967785a.tar.xz | |
Implement count leading zeros (ctlz), count trailing zeros (cttz), and count
population (ctpop). Generic lowering is implemented, however only promotion
is implemented for SelectionDAG at the moment.
More coming soon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Alpha/AlphaISelPattern.cpp')
| -rw-r--r-- | lib/Target/Alpha/AlphaISelPattern.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Target/Alpha/AlphaISelPattern.cpp b/lib/Target/Alpha/AlphaISelPattern.cpp index 574f8644ee..53d8a9e561 100644 --- a/lib/Target/Alpha/AlphaISelPattern.cpp +++ b/lib/Target/Alpha/AlphaISelPattern.cpp @@ -76,6 +76,10 @@ namespace { setOperationAction(ISD::SREM , MVT::f32 , Expand); setOperationAction(ISD::SREM , MVT::f64 , Expand); + // setOperationAction(ISD::CTPOP , MVT::i64 , Expand); + // setOperationAction(ISD::CTTZ , MVT::i64 , Expand); + // setOperationAction(ISD::CTTZ , MVT::i64 , Expand); + //If this didn't legalize into a div.... // setOperationAction(ISD::SREM , MVT::i64, Expand); // setOperationAction(ISD::UREM , MVT::i64, Expand); @@ -1215,6 +1219,15 @@ unsigned ISel::SelectExpr(SDOperand N) { Node->dump(); assert(0 && "Node not handled!\n"); + case ISD::CTPOP: + case ISD::CTTZ: + case ISD::CTLZ: + Opc = opcode == ISD::CTPOP ? Alpha::CTPOP : + (opcode == ISD::CTTZ ? Alpha::CTTZ : Alpha::CTLZ); + Tmp1 = SelectExpr(N.getOperand(0)); + BuildMI(BB, Opc, 1, Result).addReg(Tmp1); + return Result; + case ISD::MULHU: Tmp1 = SelectExpr(N.getOperand(0)); Tmp2 = SelectExpr(N.getOperand(1)); |
