Implement ex2 opcode
authorZack Rusin <zack@tungstengraphics.com>
Thu, 18 Oct 2007 09:51:01 +0000 (05:51 -0400)
committerZack Rusin <zack@tungstengraphics.com>
Wed, 24 Oct 2007 15:21:04 +0000 (11:21 -0400)
src/mesa/pipe/llvm/instructions.cpp
src/mesa/pipe/llvm/instructions.h
src/mesa/pipe/llvm/llvmtgsi.cpp

index ee67ae0eedad7520baed3cc5edd3cad4a328f96f..1e6b74eac62f581dee2624101947049a2032f79a 100644 (file)
@@ -302,3 +302,12 @@ llvm::Value * Instructions::dst(llvm::Value *in1, llvm::Value *in2)
                          ry, z, w);
 }
 
+llvm::Value * Instructions::ex2(llvm::Value *in)
+{
+   llvm::Value *val = callPow(ConstantFP::get(Type::FloatTy, APFloat(2.f)),
+                              new ExtractElementInst(in, unsigned(0),
+                                                     name("x1"),
+                                                     m_block));
+   return vectorFromVals(val, val, val, val);
+}
+
index 0ca9bd25a7662e9bd31248c35deca840f5ff0211..de33b79e378435525243e3dec44c2b13739ebd52 100644 (file)
@@ -19,6 +19,7 @@ public:
    llvm::Value *dp4(llvm::Value *in1, llvm::Value *in2);
    llvm::Value *dph(llvm::Value *in1, llvm::Value *in2);
    llvm::Value *dst(llvm::Value *in1, llvm::Value *in2);
+   llvm::Value *ex2(llvm::Value *in1);
    llvm::Value *lit(llvm::Value *in1);
    llvm::Value *madd(llvm::Value *in1, llvm::Value *in2,
                      llvm::Value *in2);
index 91c2d9beb8ea59505e1e0e26a6e85b281ac3495d..5ad45ff6ccf46794f799b005eb680a0495198d63 100644 (file)
@@ -249,7 +249,9 @@ translate_instruction(llvm::Module *module,
       break;
    case TGSI_OPCODE_ROUND:
       break;
-   case TGSI_OPCODE_EXPBASE2:
+   case TGSI_OPCODE_EXPBASE2: {
+      out = instr->ex2(inputs[0]);
+   }
       break;
    case TGSI_OPCODE_LOGBASE2:
       break;