From d3331fba6eaab44646010b556106da38925d43e0 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 6 Feb 2020 14:31:09 -0500 Subject: 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. --- tests/compute/half-texture.slang.1.expected | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/compute') diff --git a/tests/compute/half-texture.slang.1.expected b/tests/compute/half-texture.slang.1.expected index dc742a1ff..1e1a282fa 100644 --- a/tests/compute/half-texture.slang.1.expected +++ b/tests/compute/half-texture.slang.1.expected @@ -24,7 +24,7 @@ void computeMain(vector dispatchThreadID_0 : SV_DISPATCHTHREADID) #line 20 vector pos_0 = (vector) dispatchThreadID_0.xy; float _S1 = 1.00000000000000000000 / 3.00000000000000000000; - vector pos2_0 = vector(3 - pos_0.y, 3 - pos_0.x); + vector pos2_0 = vector(int(3) - pos_0.y, int(3) - pos_0.x); #line 29 half h_0 = halfTexture_0[(vector) pos2_0]; @@ -37,7 +37,7 @@ void computeMain(vector dispatchThreadID_0 : SV_DISPATCHTHREADID) halfTexture2_0[(vector) pos_0] = h4_0.xy; halfTexture4_0[(vector) pos_0] = vector(h2_0, h_0, h_0); - int index_0 = pos_0.x + pos_0.y * 4; + int index_0 = pos_0.x + pos_0.y * int(4); outputBuffer_0[(uint) index_0] = index_0; #line 18 -- cgit v1.2.3