diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-10-27 06:03:34 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-26 15:03:34 -0700 |
| commit | 41e17d370d67a584fbac9bbbe435c057c18715f4 (patch) | |
| tree | 7d262d4734186fda93ea32ab9f1a7c31b7ef2e1c /tests | |
| parent | bee74b16eafa64ccc33bb386a1dc753cd6c41a82 (diff) | |
Make the exponent return value from frexp int (#3284)
* Make the exponent return value from frexp int
Fixes https://github.com/shader-slang/slang/issues/3282
* Update slang-llvm.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/frexp-double.slang | 27 | ||||
| -rw-r--r-- | tests/bugs/frexp.slang | 26 |
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/bugs/frexp-double.slang b/tests/bugs/frexp-double.slang new file mode 100644 index 000000000..1ad5a57e8 --- /dev/null +++ b/tests/bugs/frexp-double.slang @@ -0,0 +1,27 @@ +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-dx12 -use-dxil -output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-cpu -output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -emit-spirv-directly -output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-cuda -output-using-type + +// BUF: type: int32_t +// BUF-NEXT: 1 +// BUF-NEXT: 6 +// BUF-NEXT: -1 +// BUF-NEXT: 0 + +// The values are: [1.0 42.75 0.25 0.0] +//TEST_INPUT:set inputBuffer = ubuffer(data=[0 1072693248 0 1078288384 0 1070596096 0 0], stride=4) +RWStructuredBuffer<double> inputBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint i : SV_GroupIndex) +{ + var exponent : int; + frexp(inputBuffer[i], exponent); + outputBuffer[i] = exponent; +} diff --git a/tests/bugs/frexp.slang b/tests/bugs/frexp.slang new file mode 100644 index 000000000..ea8f17411 --- /dev/null +++ b/tests/bugs/frexp.slang @@ -0,0 +1,26 @@ +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-dx12 -use-dxil -output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-cpu -output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -emit-spirv-directly -output-using-type +//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-cuda -output-using-type + +// BUF: type: int32_t +// BUF-NEXT: 1 +// BUF-NEXT: 6 +// BUF-NEXT: -1 +// BUF-NEXT: 0 + +//TEST_INPUT:set inputBuffer = ubuffer(data=[1.0 42.75 0.25 0.0], stride=4) +RWStructuredBuffer<float> inputBuffer; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint i : SV_GroupIndex) +{ + var exponent : int = 0; + frexp(inputBuffer[i], exponent); + outputBuffer[i] = exponent; +} |
