From c74a700681b0be44a74f16b0f9eaad05bba159d2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 22 Jan 2020 11:06:20 -0500 Subject: 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. --- source/slang/slang-emit-cpp.cpp | 6 ++++++ source/slang/slang-hlsl-intrinsic-set.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'source') 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 { -- cgit v1.2.3