[llvm-commits] CVS: llvm/lib/Target/IA64/IA64InstrInfo.td IA64ISelPattern.cpp

Duraid Madina duraid at octopus.com.au
Tue May 10 22:16:58 PDT 2005



Changes in directory llvm/lib/Target/IA64:

IA64InstrInfo.td updated: 1.12 -> 1.13
IA64ISelPattern.cpp updated: 1.37 -> 1.38
---
Log message:

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...



---
Diffs of the changes:  (+8 -1)

 IA64ISelPattern.cpp |    7 ++++++-
 IA64InstrInfo.td    |    2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/IA64/IA64InstrInfo.td
diff -u llvm/lib/Target/IA64/IA64InstrInfo.td:1.12 llvm/lib/Target/IA64/IA64InstrInfo.td:1.13
--- llvm/lib/Target/IA64/IA64InstrInfo.td:1.12	Thu Apr 14 05:08:01 2005
+++ llvm/lib/Target/IA64/IA64InstrInfo.td	Wed May 11 00:16:09 2005
@@ -227,6 +227,8 @@
 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;;">;


Index: llvm/lib/Target/IA64/IA64ISelPattern.cpp
diff -u llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.37 llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.38
--- llvm/lib/Target/IA64/IA64ISelPattern.cpp:1.37	Wed May 11 00:03:56 2005
+++ llvm/lib/Target/IA64/IA64ISelPattern.cpp	Wed May 11 00:16:09 2005
@@ -90,7 +90,6 @@
       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 @@
     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))) {






More information about the llvm-commits mailing list