Provide both signed and unsigned int variants of bitcode-based builtins.
When creating function Symbols for functions that were defined in LLVM bitcode for the standard library, if any of the function parameters are integer types, create two ispc-side Symbols: one where the integer types are all signed and the other where they are all unsigned. This allows us to provide, for example, both store_to_int16(reference int a[], uniform int offset, int val) as well as store_to_int16(reference unsigned int a[], uniform int offset, unsigned int val). functions.
Added some additional tests to exercise the new variants of these.
Also fixed some cases where the __{load,store}_int{8,16} builtins would read from/write to memory even if the mask was all off (which could cause crashes in some cases.)
This commit is contained in:
3
ctx.cpp
3
ctx.cpp
@@ -695,7 +695,8 @@ FunctionEmitContext::LaneMask(llvm::Value *v) {
|
||||
// Call the target-dependent movmsk function to turn the vector mask
|
||||
// into an i32 value
|
||||
std::vector<Symbol *> *mm = m->symbolTable->LookupFunction("__movmsk");
|
||||
assert(mm && mm->size() == 1);
|
||||
// There should be one with signed int signature, one unsigned int.
|
||||
assert(mm && mm->size() == 2);
|
||||
llvm::Function *fmm = (*mm)[0]->function;
|
||||
return CallInst(fmm, v, "val_movmsk");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user