operand inputs when they've been assigned already.
val = storage->inputElement(src->SrcRegister.Index, indIdx);
} else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) {
val = storage->tempElement(src->SrcRegister.Index);
- } else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) {
- fprintf(stderr, "FIXME: do somethign with immediates?\n");
+ } else if (src->SrcRegister.File == TGSI_FILE_OUTPUT) {
+ val = storage->outputElement(src->SrcRegister.Index, indIdx);
} else {
fprintf(stderr, "ERROR: not supported llvm source %d\n", src->SrcRegister.File);
return;
{
m_temps[idx] = new AllocaInst(m_floatVecType, name("temp"), m_block);
}
+
+llvm::Value * Storage::outputElement(int idx, llvm::Value *indIdx )
+{
+ GetElementPtrInst *getElem = 0;
+
+ if (indIdx) {
+ getElem = new GetElementPtrInst(m_IN,
+ BinaryOperator::create(Instruction::Add,
+ indIdx,
+ constantInt(idx),
+ name("add"),
+ m_block),
+ name("output_ptr"),
+ m_block);
+ } else {
+ getElem = new GetElementPtrInst(m_IN,
+ constantInt(idx),
+ name("output_ptr"),
+ m_block);
+ }
+
+ LoadInst *load = new LoadInst(getElem, name("output"),
+ false, m_block);
+ load->setAlignment(8);
+ m_inputs[idx] = load;
+
+ return load;
+}
llvm::Constant *shuffleMask(int vec);
llvm::Value *inputElement(int idx, llvm::Value *indIdx =0);
llvm::Value *constElement(int idx, llvm::Value *indIdx =0);
+ llvm::Value *outputElement(int idx, llvm::Value *indIdx =0);
llvm::Value *tempElement(int idx);
void setTempElement(int idx, llvm::Value *val, int mask);