diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-02-06 14:31:09 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-06 14:31:09 -0500 |
| commit | d3331fba6eaab44646010b556106da38925d43e0 (patch) | |
| tree | f54115540a457375a5d050bbfe1b04855b3f791b /prelude | |
| parent | 9c84cceffba26817721a23a1a85a48644bf3a560 (diff) | |
Literal handling improvements (#1202)
* WIP: 64 literal diagnostic and truncation.
* Improve how integer truncation is handled/supported.
Added literal-int64.slang test.
Set a suffix on all literals.
Fixed problem on C++ based targets where l suffix was not the same as int() cast. So on C++ derived emitters, int() is used instead of l suffix to have same behavior across targets.
* Add literal diagnostic testing.
* Allow lexer to lex - in front of literals.
* Fix lexing and converting int literal with -.
* Too large small values of floats become inf.
Handling writing inf types out on different targets.
Add function to deterimine if a float literals kind.
* Roll back the support of lexer lexing negative literals.
* Fixed tests broken because of diagnostics numbers.
Improved _isFinite
* Fix compilation on linux.
* Fix problem with abs on linux - use Math::Abs.
* Fix typo.
* * Improve warnings for float literals zeroed
* Improved 64 bit type documentation
* Handle half
* Improved comments
* Fixed tests broken
* Use capital letters for suffixes.
* Make default behavior on outputting a int literal that is an 'int32_t' is cast (not suffix) to avoid platform inconsistencies.
Improve documentation for 64 bit types.
Make tests cover material in docs.
* Fixed tests.
* Rename FloatKind::Normal -> Finite
* Fix half zero check.
Diffstat (limited to 'prelude')
| -rw-r--r-- | prelude/slang-cpp-prelude.h | 4 | ||||
| -rw-r--r-- | prelude/slang-cuda-prelude.h | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/prelude/slang-cpp-prelude.h b/prelude/slang-cpp-prelude.h index 15d200d2f..77c738620 100644 --- a/prelude/slang-cpp-prelude.h +++ b/prelude/slang-cpp-prelude.h @@ -22,6 +22,10 @@ #define SLANG_PRELUDE_EXPORT SLANG_PRELUDE_EXTERN_C SLANG_PRELUDE_SHARED_LIB_EXPORT +#ifndef SLANG_INFINITY +# define SLANG_INFINITY INFINITY +#endif + #include "slang-cpp-types.h" #include "slang-cpp-scalar-intrinsics.h" diff --git a/prelude/slang-cuda-prelude.h b/prelude/slang-cuda-prelude.h index 233903134..edfa9b5e0 100644 --- a/prelude/slang-cuda-prelude.h +++ b/prelude/slang-cuda-prelude.h @@ -1,4 +1,9 @@ +// Must be large enough to cause overflow and therefore infinity +#ifndef SLANG_INFINITY +# define SLANG_INFINITY ((float)(1e+300 * 1e+300)) +#endif + // For now we'll disable any asserts in this prelude #define SLANG_PRELUDE_ASSERT(x) |
