aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuraid Madina <duraid@octopus.com.au>2005-05-11 05:16:09 +0000
committerDuraid Madina <duraid@octopus.com.au>2005-05-11 05:16:09 +0000
commit63bbed536c609d02b04339963a1f24de3632b421 (patch)
treeaaefcf9f3875a7d67ba08d88234123f4eaf7b1ce
parent9b583b49103f21888ac3de3f7941a98a63a23aea (diff)
add the popcount instruction and support this in the isel
the primary user of this will probably end up being find-first-set-bit/find- last-set-bit, which i'll get around to... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21860 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/IA64/IA64ISelPattern.cpp7
-rw-r--r--lib/Target/IA64/IA64InstrInfo.td2
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Target/IA64/IA64ISelPattern.cpp b/lib/Target/IA64/IA64ISelPattern.cpp
index 06be6ab2e0..2d00c3be47 100644
--- a/lib/Target/IA64/IA64ISelPattern.cpp
+++ b/lib/Target/IA64/IA64ISelPattern.cpp
@@ -90,7 +90,6 @@ namespace {
setOperationAction(ISD::FSQRT, MVT::f32, Expand);
//IA64 has these, but they are not implemented
- setOperationAction(ISD::CTPOP, MVT::i64 , Expand);
setOperationAction(ISD::CTTZ , MVT::i64 , Expand);
setOperationAction(ISD::CTLZ , MVT::i64 , Expand);
@@ -1600,6 +1599,12 @@ pC = pA OR pB
return Result;
}
+ case ISD::CTPOP: {
+ Tmp1 = SelectExpr(N.getOperand(0));
+ BuildMI(BB, IA64::POPCNT, 1, Result).addReg(Tmp1);
+ return Result;
+ }
+
case ISD::SHL: {
Tmp1 = SelectExpr(N.getOperand(0));
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
diff --git a/lib/Target/IA64/IA64InstrInfo.td b/lib/Target/IA64/IA64InstrInfo.td
index 92e68eb02c..cd1dea7a9f 100644
--- a/lib/Target/IA64/IA64InstrInfo.td
+++ b/lib/Target/IA64/IA64InstrInfo.td
@@ -227,6 +227,8 @@ def LD4 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
def LD8 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
"ld8 $dst = [$srcPtr];;">;
+def POPCNT : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "popcnt $dst = $src;;">;
+
// some FP stuff:
def FADD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
"fadd $dst = $src1, $src2;;">;