diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-01-21 18:49:44 -0500 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2020-01-21 15:49:44 -0800 |
| commit | 5988ce80f580d57ce6718a61c86da6296caf0845 (patch) | |
| tree | 5549f197d437c578556bb25d65d57ff213bbb55b /tests | |
| parent | 47392bc72b826b4ad427b703391a77e697735a65 (diff) | |
HLSL intrinsic coverage (#1169)
* 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.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/hlsl-scalar-float-intrinsic.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/scalar-float.slang (renamed from tests/compute/hlsl-scalar-float-intrinsic.slang) | 15 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/scalar-float.slang.expected.txt | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/tests/compute/hlsl-scalar-float-intrinsic.slang.expected.txt b/tests/compute/hlsl-scalar-float-intrinsic.slang.expected.txt deleted file mode 100644 index 04d17659c..000000000 --- a/tests/compute/hlsl-scalar-float-intrinsic.slang.expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -FFFFFA3C -FFFFFEEC -3CA -8C1 diff --git a/tests/compute/hlsl-scalar-float-intrinsic.slang b/tests/hlsl-intrinsic/scalar-float.slang index 213db4b23..a1982bbb8 100644 --- a/tests/compute/hlsl-scalar-float-intrinsic.slang +++ b/tests/hlsl-intrinsic/scalar-float.slang @@ -12,13 +12,13 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { int idx = int(dispatchThreadID.x); - float f = idx * (1.0f / (4.0f - 1)); + float f = idx * (1.0f / (4.0f)); int it = 0; float ft = 0.0f; // fmod - // ft += f % 0.5f; + ft += int(((f % 0.11f) * 100) + 0.5); ft += sin(f); ft += cos(f); @@ -51,7 +51,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) ft += frac(f * 3); -// ft += ceil(f * 5 - 3); + ft += ceil(f * 5 - 3); ft += floor(f * 10 - 7); ft += trunc(f * 7); @@ -59,9 +59,12 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) ft += log(f + 10.0); ft += log2(f * 3 + 2); - - // ft += log10(f * 10 + 4); - + + { + float v[] = { 1, 10, 100, 1000 }; + ft += int(log10(v[idx]) + 0.5f); + } + ft += abs(f * 4 - 2.0f); ft += min(0.5, f); diff --git a/tests/hlsl-intrinsic/scalar-float.slang.expected.txt b/tests/hlsl-intrinsic/scalar-float.slang.expected.txt new file mode 100644 index 000000000..3ad5914c4 --- /dev/null +++ b/tests/hlsl-intrinsic/scalar-float.slang.expected.txt @@ -0,0 +1,4 @@ +FFFFFA0C +FFFFFDF4 +1ED +5EE |
