summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-01-22 11:06:20 -0500
committerGitHub <noreply@github.com>2020-01-22 11:06:20 -0500
commitc74a700681b0be44a74f16b0f9eaad05bba159d2 (patch)
tree6855baa362b336f17e199f1ad33242e73e98f6a7 /source
parent346a56749c99e4e05d24ad6217f34dd5d44af189 (diff)
WIP HLSL intrinsic coverage (#1171)
* Added hlsl-intrinsic test folder. Enabled ceil as works across targets. * log10 support. * Fix float % on CPU/CUDA to match HLSL which is fmod (not fremainder). * Added log10 tests back to scalar-float.slang * Don't add the ( for $Sx - it's clearer what's going on without it. * Works on CUDA/CPU. Problem with asint/asuint do not seem to be found. * Only asuint exists for double. * Support countbits on CUDA and C++. * Fix typo in C++ population count. * First pass at int vector intrinsic tests. * Swizzle for int. * Bit cast tests on CUDA. * Fix warning on gcc. * Fix bit-cast-double execution on CUDA. * scalar-int test working on gcc release.
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-emit-cpp.cpp6
-rw-r--r--source/slang/slang-hlsl-intrinsic-set.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp
index db442d131..5dd028182 100644
--- a/source/slang/slang-emit-cpp.cpp
+++ b/source/slang/slang-emit-cpp.cpp
@@ -969,6 +969,8 @@ void CPPSourceEmitter::_emitGetAtDefinition(const UnownedStringSlice& funcName,
IRType* srcType = funcType->getParamType(0);
+ emitSpecializedOperationDefinitionPreamble(specOp);
+
IRType* retType = specOp->returnType;
emitType(retType);
m_writer->emit("& ");
@@ -1046,6 +1048,8 @@ void CPPSourceEmitter::_emitConstructConvertDefinition(const UnownedStringSlice&
IRType* srcType = funcType->getParamType(1);
IRType* retType = specOp->returnType;
+ emitSpecializedOperationDefinitionPreamble(specOp);
+
emitType(retType);
writer->emit(" ");
writer->emit(funcName);
@@ -1112,6 +1116,8 @@ void CPPSourceEmitter::_emitConstructFromScalarDefinition(const UnownedStringSli
IRType* srcType = funcType->getParamType(1);
IRType* retType = specOp->returnType;
+ emitSpecializedOperationDefinitionPreamble(specOp);
+
emitType(retType);
writer->emit(" ");
writer->emit(funcName);
diff --git a/source/slang/slang-hlsl-intrinsic-set.h b/source/slang/slang-hlsl-intrinsic-set.h
index d55c908ae..df1677b17 100644
--- a/source/slang/slang-hlsl-intrinsic-set.h
+++ b/source/slang/slang-hlsl-intrinsic-set.h
@@ -123,7 +123,9 @@ just constructXXXFromScalar. Would be good if there was a suitable name to encom
x(ConstructFromScalar, "", 1) \
\
x(GetAt, "", 2) \
- x(SetAt, "", 3)
+ x(SetAt, "", 3) \
+ \
+ x(CountBits, "countbits", 1)
struct HLSLIntrinsic
{