_step_state did not fold these scalar operations. Thus a literal S# that
has one dword made with one of them was not in literal_samplers.
The two-source operations fold in _fold_scalar_alu with the values that
the translator computes for immediates: the shift count of s_ashr_i32 is
modulo 32, s_bfm_b32 makes a mask of (width & 31) ones at (offset & 31),
and the field of s_bfe_u32 stops at bit 31. s_abs_i32 of a known constant
is a known constant. A source that is not a known constant gives no
constant, as before.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
_step_state did not fold the inverted scalar logic operations. Thus a
literal S# that has one dword made with one of them (for example
0xFFFFFFFF as s_not_b32 of 0) was not in literal_samplers.
s_not_b32 of a known constant is now a known constant. s_nand_b32,
s_nor_b32 and s_xnor_b32 of two known constants fold together with the
other two-source logic operations. A source that is not a known constant
gives no constant, as before.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Keep VOP3 FP source modifiers (neg(...), |...|, -|...|, abs(...), and nested combinations) as abs/neg flags on imm and fimm operands instead of applying two's-complement integer negation or folding outer '-' before FAbs, matching LLVM AMDGPUInstPrinter::printOperandAndFPInputMods.
Plain signed numeric literals (-1, -1.0, 0x10) keep their existing dict layout. Also handle -0x... inside modifiers, preserve abs on sext(...), and apply abs then neg in tools/shader_meta.py::_imm_u32.
Verified on CPU with tests/test_shader_ir.py, tests/test_shader_meta.py, tests/test_cpu_ref.py, tools/f32_fuzz.py and the full tests/semantic suite (1,027 tests).