summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/instructionssoa.cpp
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2008-05-16 14:54:40 -0400
committerZack Rusin <[email protected]>2008-05-17 13:58:44 -0400
commitea1a607292ef31df70cda8c6476755e0224c9f7d (patch)
tree035f95ea471e526bac84463bb0e24fe7b8e674a3 /src/gallium/auxiliary/gallivm/instructionssoa.cpp
parent59766ac273c426557b7790b0fcb566c8095fd820 (diff)
implement min/max and abstract ops on vectors
Diffstat (limited to 'src/gallium/auxiliary/gallivm/instructionssoa.cpp')
-rw-r--r--src/gallium/auxiliary/gallivm/instructionssoa.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/instructionssoa.cpp b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
index 4520559ba2b..55fdda27916 100644
--- a/src/gallium/auxiliary/gallivm/instructionssoa.cpp
+++ b/src/gallium/auxiliary/gallivm/instructionssoa.cpp
@@ -176,14 +176,17 @@ void InstructionsSoa::createFunctionMap()
m_functionsMap[TGSI_OPCODE_ABS] = "abs";
m_functionsMap[TGSI_OPCODE_DP3] = "dp3";
m_functionsMap[TGSI_OPCODE_DP4] = "dp4";
+ m_functionsMap[TGSI_OPCODE_MIN] = "min";
+ m_functionsMap[TGSI_OPCODE_MAX] = "max";
m_functionsMap[TGSI_OPCODE_POWER] = "pow";
}
void InstructionsSoa::createDependencies()
{
{
- std::vector<std::string> powDeps(1);
+ std::vector<std::string> powDeps(2);
powDeps[0] = "powf";
+ powDeps[1] = "powvec";
m_builtinDependencies["pow"] = powDeps;
}
{
@@ -191,6 +194,16 @@ void InstructionsSoa::createDependencies()
absDeps[0] = "fabsf";
m_builtinDependencies["abs"] = absDeps;
}
+ {
+ std::vector<std::string> maxDeps(1);
+ maxDeps[0] = "maxvec";
+ m_builtinDependencies["max"] = maxDeps;
+ }
+ {
+ std::vector<std::string> minDeps(1);
+ minDeps[0] = "minvec";
+ m_builtinDependencies["min"] = minDeps;
+ }
}
llvm::Function * InstructionsSoa::function(int op)
@@ -374,6 +387,21 @@ std::vector<llvm::Value*> InstructionsSoa::pow(const std::vector<llvm::Value*> i
return callBuiltin(func, in1, in2);
}
+std::vector<llvm::Value*> InstructionsSoa::min(const std::vector<llvm::Value*> in1,
+ const std::vector<llvm::Value*> in2)
+{
+ llvm::Function *func = function(TGSI_OPCODE_MIN);
+ return callBuiltin(func, in1, in2);
+}
+
+
+std::vector<llvm::Value*> InstructionsSoa::max(const std::vector<llvm::Value*> in1,
+ const std::vector<llvm::Value*> in2)
+{
+ llvm::Function *func = function(TGSI_OPCODE_MAX);
+ return callBuiltin(func, in1, in2);
+}
+
void checkFunction(Function *func)
{
for (Function::const_iterator BI = func->begin(), BE = func->end();