Add count_{leading,trailing}_zeros() functions to stdlib.

(Documentation is still yet to be written.)
This commit is contained in:
Matt Pharr
2011-11-30 10:12:16 -08:00
parent 1703f2717c
commit 7a2561c429
9 changed files with 192 additions and 6 deletions

View File

@@ -2158,13 +2158,14 @@ FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType,
// Figure out the first lane that still needs its function
// pointer to be called.
llvm::Value *currentMask = LoadInst(maskPtr);
llvm::Function *cttz = m->module->getFunction("__count_trailing_zeros");
llvm::Function *cttz =
m->module->getFunction("__count_trailing_zeros_i32");
assert(cttz != NULL);
llvm::Value *firstLane = CallInst(cttz, NULL, LaneMask(currentMask),
"first_lane");
// Get the pointer to the function we're going to call this time through:
// ftpr = func[firstLane]
// Get the pointer to the function we're going to call this
// time through: ftpr = func[firstLane]
llvm::Value *fptr =
llvm::ExtractElementInst::Create(func, firstLane,
"extract_fptr", bblock);