summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2007-10-17 13:46:00 -0400
committerZack Rusin <zack@tungstengraphics.com>2007-10-24 11:21:04 -0400
commitbd38f4d92125e648b276344ebb2ab9d517b3e7a5 (patch)
tree73d5f059bfed125c4a25ac347f5b9d07794ba5e6 /src/mesa
parent3c558e17f03a9813d905e7dc38b59ff0ad142ee9 (diff)
Implement dst opcode
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/llvm/instructions.cpp22
-rw-r--r--src/mesa/pipe/llvm/instructions.h1
-rw-r--r--src/mesa/pipe/llvm/llvmtgsi.cpp4
3 files changed, 26 insertions, 1 deletions
diff --git a/src/mesa/pipe/llvm/instructions.cpp b/src/mesa/pipe/llvm/instructions.cpp
index 62289ba62a..ee67ae0eed 100644
--- a/src/mesa/pipe/llvm/instructions.cpp
+++ b/src/mesa/pipe/llvm/instructions.cpp
@@ -280,3 +280,25 @@ llvm::Value * Instructions::dph(llvm::Value *in1, llvm::Value *in2)
return vectorFromVals(dph, dph, dph, dph);
}
+llvm::Value * Instructions::dst(llvm::Value *in1, llvm::Value *in2)
+{
+ ExtractElementInst *y1 = new ExtractElementInst(in1, unsigned(1),
+ name("y1"),
+ m_block);
+ ExtractElementInst *z = new ExtractElementInst(in1, unsigned(2),
+ name("z"),
+ m_block);
+ ExtractElementInst *y2 = new ExtractElementInst(in2, unsigned(1),
+ name("y2"),
+ m_block);
+ ExtractElementInst *w = new ExtractElementInst(in2, unsigned(3),
+ name("w"),
+ m_block);
+ BinaryOperator *ry = BinaryOperator::create(Instruction::Mul,
+ y1, y2,
+ name("tyuy"),
+ m_block);
+ return vectorFromVals(ConstantFP::get(Type::FloatTy, APFloat(1.f)),
+ ry, z, w);
+}
+
diff --git a/src/mesa/pipe/llvm/instructions.h b/src/mesa/pipe/llvm/instructions.h
index fb8ac9b8cd..0ca9bd25a7 100644
--- a/src/mesa/pipe/llvm/instructions.h
+++ b/src/mesa/pipe/llvm/instructions.h
@@ -18,6 +18,7 @@ public:
llvm::Value *dp3(llvm::Value *in1, llvm::Value *in2);
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 *lit(llvm::Value *in1);
llvm::Value *madd(llvm::Value *in1, llvm::Value *in2,
llvm::Value *in2);
diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp
index 9a5d3b8d9c..91c2d9beb8 100644
--- a/src/mesa/pipe/llvm/llvmtgsi.cpp
+++ b/src/mesa/pipe/llvm/llvmtgsi.cpp
@@ -209,7 +209,9 @@ translate_instruction(llvm::Module *module,
out = instr->dp4(inputs[0], inputs[1]);
}
break;
- case TGSI_OPCODE_DST:
+ case TGSI_OPCODE_DST: {
+ out = instr->dst(inputs[0], inputs[1]);
+ }
break;
case TGSI_OPCODE_MIN:
break;