Be more careful about using the right mask when emitting gathers.

Specifically, we had been using the full mask for all gathers, rather than
using the internal mask when we were loading from locally-declared arrays.
Thus, given code like:

  uniform float x[programCount] = { .. . };
  float xx = x[programIndex];

Previously we weren't generating a plain vector load to initialize xx, when
this code was in a function where it wasn't known that the mask was all on,
even though it should have.  Now it does.
This commit is contained in:
Matt Pharr
2011-10-17 20:25:52 -04:00
parent 19087e4761
commit 290032f4f5
4 changed files with 83 additions and 54 deletions

View File

@@ -418,7 +418,7 @@ lCopyInTaskParameter(int i, llvm::Value *structArgPtr, const std::vector<Symbol
// and copy the value from the struct and into the local alloca'ed
// memory
llvm::Value *ptrval = ctx->LoadInst(ptr, NULL, sym->name.c_str());
llvm::Value *ptrval = ctx->LoadInst(ptr, NULL, NULL, sym->name.c_str());
ctx->StoreInst(ptrval, sym->storagePtr);
ctx->EmitFunctionParameterDebugInfo(sym);
}
@@ -465,7 +465,7 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
// The mask is the last parameter in the argument structure
llvm::Value *ptr = ctx->GetElementPtrInst(structParamPtr, 0, nArgs,
"task_struct_mask");
llvm::Value *ptrval = ctx->LoadInst(ptr, NULL, "mask");
llvm::Value *ptrval = ctx->LoadInst(ptr, NULL, NULL, "mask");
ctx->SetFunctionMask(ptrval);
// Copy threadIndex and threadCount into stack-allocated storage so