diff options
author | Zack Rusin <[email protected]> | 2008-05-16 17:10:52 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2008-05-17 13:58:44 -0400 |
commit | 02e45b2dadd42c38247cb992a07eb520ac86519b (patch) | |
tree | 29842ca21e94e322862629f1cfa10ab62f584458 /src/gallium/auxiliary/gallivm/instructionssoa.cpp | |
parent | 1d1cf8edf6a0409caf9aa7d44e186eb51f51fa1f (diff) |
fix abs and start on rsq
Diffstat (limited to 'src/gallium/auxiliary/gallivm/instructionssoa.cpp')
-rw-r--r-- | src/gallium/auxiliary/gallivm/instructionssoa.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/instructionssoa.cpp b/src/gallium/auxiliary/gallivm/instructionssoa.cpp index 074dd0ecd6b..76049ade7c0 100644 --- a/src/gallium/auxiliary/gallivm/instructionssoa.cpp +++ b/src/gallium/auxiliary/gallivm/instructionssoa.cpp @@ -180,6 +180,7 @@ void InstructionsSoa::createFunctionMap() m_functionsMap[TGSI_OPCODE_MAX] = "max"; m_functionsMap[TGSI_OPCODE_POWER] = "pow"; m_functionsMap[TGSI_OPCODE_LIT] = "lit"; + m_functionsMap[TGSI_OPCODE_RSQ] = "rsq"; } void InstructionsSoa::createDependencies() @@ -191,8 +192,9 @@ void InstructionsSoa::createDependencies() m_builtinDependencies["pow"] = powDeps; } { - std::vector<std::string> absDeps(1); + std::vector<std::string> absDeps(2); absDeps[0] = "fabsf"; + absDeps[1] = "absvec"; m_builtinDependencies["abs"] = absDeps; } { @@ -213,6 +215,14 @@ void InstructionsSoa::createDependencies() litDeps[3] = "powvec"; m_builtinDependencies["lit"] = litDeps; } + { + std::vector<std::string> rsqDeps(4); + rsqDeps[0] = "sqrtf"; + rsqDeps[1] = "sqrtvec"; + rsqDeps[2] = "fabsf"; + rsqDeps[3] = "absvec"; + m_builtinDependencies["rsq"] = rsqDeps; + } } llvm::Function * InstructionsSoa::function(int op) @@ -453,7 +463,9 @@ void InstructionsSoa::injectFunction(llvm::Function *originalFunc, int op) currentModule()->dump(); } else { DenseMap<const Value*, Value *> val; + val[m_builtins->getFunction("fabsf")] = currentModule()->getFunction("fabsf"); val[m_builtins->getFunction("powf")] = currentModule()->getFunction("powf"); + val[m_builtins->getFunction("sqrtf")] = currentModule()->getFunction("sqrtf"); func = CloneFunction(originalFunc, val); #if 0 std::cout <<" replacing "<<m_builtins->getFunction("powf") @@ -490,3 +502,9 @@ std::vector<llvm::Value*> InstructionsSoa::lit(const std::vector<llvm::Value*> i return callBuiltin(func, in); } +std::vector<llvm::Value*> InstructionsSoa::rsq(const std::vector<llvm::Value*> in) +{ + llvm::Function *func = function(TGSI_OPCODE_RSQ); + return callBuiltin(func, in); +} + |