From: Zack Rusin Date: Wed, 13 Feb 2008 08:18:37 +0000 (-0500) Subject: implement mul X-Git-Tag: android-x86-1.6~16^2~1465^2~390^2~2632 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=135d2329de7721b2083aa5f38f8d66beb20c1181;p=android-x86%2Fexternal-mesa.git implement mul --- diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/mesa/pipe/llvm/instructionssoa.cpp index 0e501ab08d0..f1c174a26e5 100644 --- a/src/mesa/pipe/llvm/instructionssoa.cpp +++ b/src/mesa/pipe/llvm/instructionssoa.cpp @@ -2,7 +2,8 @@ InstructionsSoa::InstructionsSoa(llvm::Module *mod, llvm::Function *func, llvm::BasicBlock *block, StorageSoa *storage) - : m_builder(block) + : m_builder(block), + m_idx(0) { } @@ -19,6 +20,11 @@ std::vector InstructionsSoa::mul(const std::vector i { std::vector res(4); + res[0] = m_builder.CreateMul(in1[0], in2[0], name("mul")); + res[1] = m_builder.CreateMul(in1[1], in2[1], name("mul")); + res[2] = m_builder.CreateMul(in1[2], in2[2], name("mul")); + res[3] = m_builder.CreateMul(in1[3], in2[3], name("mul")); + return res; } @@ -26,3 +32,10 @@ void InstructionsSoa::end() { m_builder.CreateRetVoid(); } + +const char * InstructionsSoa::name(const char *prefix) const +{ + ++m_idx; + snprintf(m_name, 32, "%s%d", prefix, m_idx); + return m_name; +} diff --git a/src/mesa/pipe/llvm/instructionssoa.h b/src/mesa/pipe/llvm/instructionssoa.h index 233d363b906..01955015844 100644 --- a/src/mesa/pipe/llvm/instructionssoa.h +++ b/src/mesa/pipe/llvm/instructionssoa.h @@ -51,8 +51,15 @@ public: std::vector mul(const std::vector in1, const std::vector in2); void end(); + +private: + const char * name(const char *prefix) const; private: llvm::LLVMFoldingBuilder m_builder; + +private: + mutable int m_idx; + mutable char m_name[32]; };