summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2012-06-20 17:43:11 -0400
committerTom Stellard <[email protected]>2012-06-21 20:42:06 +0000
commit563a764110ac9a2e93e2a01e362d8dc756232634 (patch)
treeea0234b7659aab26d1b2fdb54cdf92562ea7e93d /src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
parentc53c8d05551083437eb991e79002c0a272541a79 (diff)
radeon/llvm: Turn on the BitExtract peephole optimization
Thie BitExtract optimization folds a mask and shift operation together into a single instruction (BFE_UINT).
Diffstat (limited to 'src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp')
-rw-r--r--src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp b/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
index b62c7ab048b..5b5932ac8c2 100644
--- a/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
+++ b/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
@@ -691,6 +691,11 @@ AMDILPeepholeOpt::optimizeBitExtract(Instruction *inst)
}
Type *aType = inst->getType();
bool isVector = aType->isVectorTy();
+
+ // XXX Support vector types
+ if (isVector) {
+ return false;
+ }
int numEle = 1;
// This only works on 32bit integers
if (aType->getScalarType()
@@ -792,23 +797,24 @@ AMDILPeepholeOpt::optimizeBitExtract(Instruction *inst)
callTypes.push_back(aType);
callTypes.push_back(aType);
FunctionType *funcType = FunctionType::get(aType, callTypes, false);
- std::string name = "__amdil_ubit_extract";
+ std::string name = "llvm.AMDIL.bit.extract.u32";
if (isVector) {
- name += "_v" + itostr(numEle) + "i32";
+ name += ".v" + itostr(numEle) + "i32";
} else {
- name += "_i32";
+ name += ".";
}
// Lets create the function.
Function *Func =
dyn_cast<Function>(inst->getParent()->getParent()->getParent()->
getOrInsertFunction(llvm::StringRef(name), funcType));
Value *Operands[3] = {
- newMaskConst,
+ ShiftInst->getOperand(0),
shiftValConst,
- ShiftInst->getOperand(0)
+ newMaskConst
};
// Lets create the Call with the operands
CallInst *CI = CallInst::Create(Func, Operands, "ByteExtractOpt");
+ CI->setDoesNotAccessMemory();
CI->insertBefore(inst);
inst->replaceAllUsesWith(CI);
return true;