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... llvm-svn: 21860
This commit is contained in:
		
							parent
							
								
									3740f39883
								
							
						
					
					
						commit
						25163d8d60
					
				| 
						 | 
					@ -90,7 +90,6 @@ namespace {
 | 
				
			||||||
      setOperationAction(ISD::FSQRT, MVT::f32, Expand);
 | 
					      setOperationAction(ISD::FSQRT, MVT::f32, Expand);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      //IA64 has these, but they are not implemented
 | 
					      //IA64 has these, but they are not implemented
 | 
				
			||||||
      setOperationAction(ISD::CTPOP, MVT::i64  , Expand);
 | 
					 | 
				
			||||||
      setOperationAction(ISD::CTTZ , MVT::i64  , Expand);
 | 
					      setOperationAction(ISD::CTTZ , MVT::i64  , Expand);
 | 
				
			||||||
      setOperationAction(ISD::CTLZ , MVT::i64  , Expand);
 | 
					      setOperationAction(ISD::CTLZ , MVT::i64  , Expand);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1600,6 +1599,12 @@ pC = pA OR pB
 | 
				
			||||||
    return Result;
 | 
					    return Result;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  case ISD::CTPOP: {
 | 
				
			||||||
 | 
					    Tmp1 = SelectExpr(N.getOperand(0));
 | 
				
			||||||
 | 
					    BuildMI(BB, IA64::POPCNT, 1, Result).addReg(Tmp1);
 | 
				
			||||||
 | 
					    return Result;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  case ISD::SHL: {
 | 
					  case ISD::SHL: {
 | 
				
			||||||
    Tmp1 = SelectExpr(N.getOperand(0));
 | 
					    Tmp1 = SelectExpr(N.getOperand(0));
 | 
				
			||||||
    if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
 | 
					    if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N.getOperand(1))) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -227,6 +227,8 @@ def LD4 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
 | 
				
			||||||
def LD8 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
 | 
					def LD8 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
 | 
				
			||||||
  "ld8 $dst = [$srcPtr];;">;
 | 
					  "ld8 $dst = [$srcPtr];;">;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def POPCNT : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "popcnt $dst = $src;;">;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// some FP stuff:
 | 
					// some FP stuff:
 | 
				
			||||||
def FADD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
 | 
					def FADD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
 | 
				
			||||||
  "fadd $dst = $src1, $src2;;">;
 | 
					  "fadd $dst = $src1, $src2;;">;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue