From 8c529546136404b1b98603782a30d59df8ab301b Mon Sep 17 00:00:00 2001 From: Kelbo Date: Mon, 30 Nov 2026 10:54:42 -0500 Subject: [PATCH] tests: follow the f-suffixed literals in three shader fixtures #3568 writes binary32 literals with an f suffix, so the patterns three fixtures mutate stopped matching: startup_image_sample_b_flow_check and startup_image_get_lod_flow_check failed in mutants() on None, and startup_gfx2hlsl_cvt_off_f32_i4_check found no saturate/multiply to swap. The patterns accept or capture the suffix. The native_direct_mesh clamp case is already fixed on main, so it is not part of this change. --- tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py | 4 ++-- tests/startup_image_get_lod_flow_check.py | 2 +- tests/startup_image_sample_b_flow_check.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py b/tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py index a9904eb8b4..82e86a40e1 100644 --- a/tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py +++ b/tests/startup_gfx2hlsl_cvt_off_f32_i4_check.py @@ -709,8 +709,8 @@ def mutate_plain_5bit(text): def mutate_mod_early_clamp(text): # Swap saturate((...) * 4.0) into (saturate(...)) * 4.0 on lane 2 (v14) - pattern = r'saturate\(\(\(float\(int\(v2 << 28\) >> 28\) \* 0\.0625\)\) \* 4\.0\)' - replacement = r'(saturate((float(int(v2 << 28) >> 28) * 0.0625))) * 4.0' + pattern = r'saturate\(\(\(float\(int\(v2 << 28\) >> 28\) \* 0\.0625(f?)\)\) \* 4\.0\1\)' + replacement = r'(saturate((float(int(v2 << 28) >> 28) * 0.0625\1))) * 4.0\1' mutated, count = re.subn(pattern, replacement, text) assert count == 1 and mutated != text, (count, text) return mutated diff --git a/tests/startup_image_get_lod_flow_check.py b/tests/startup_image_get_lod_flow_check.py index 00be477e5f..a6025572cf 100644 --- a/tests/startup_image_get_lod_flow_check.py +++ b/tests/startup_image_get_lod_flow_check.py @@ -247,7 +247,7 @@ def check_binary(llvm_mc): def mutants(name, hlsl): """HLSL variants that must give another LOD: the branch write dropped, or the EXEC guard dropped.""" - write = re.search(r'\n\s*if \(exec & 1\) v2 = U\((-0\.5|F\(0x3fc00000u\)) \+ F\(v2\)\);', hlsl) + write = re.search(r'\n\s*if \(exec & 1\) v2 = U\((-0\.5f?|F\(0x3fc00000u\)) \+ F\(v2\)\);', hlsl) if name.startswith('join'): return [('without the branch write', hlsl.replace(write.group(0), ''))] if name in ('cmpx', 'inside', 'kill'): diff --git a/tests/startup_image_sample_b_flow_check.py b/tests/startup_image_sample_b_flow_check.py index b51aea26b8..f65038f3e0 100644 --- a/tests/startup_image_sample_b_flow_check.py +++ b/tests/startup_image_sample_b_flow_check.py @@ -382,7 +382,7 @@ def mutants(name, hlsl): """HLSL variants that must read another texel: the branch write dropped, the EXEC guard of the u write dropped, the bias dropped.""" out = [] - write = re.search(r'\n\s*if \(exec & 1\) v2 = U\(-?0\.5 \+ F\(v2\)\);', hlsl) + write = re.search(r'\n\s*if \(exec & 1\) v2 = U\(-?0\.5f? \+ F\(v2\)\);', hlsl) if name.startswith('join'): out.append(('without the branch write', hlsl.replace(write.group(0), ''))) if name in ('cmpx', 'inside', 'kill'):