Commit Graph

12 Commits

Author SHA1 Message Date
9b7af801d9 shader_ir: preserve sign inside lit(-V) instead of turning it into VOP3 neg(V) 2026-11-25 23:40:03 +05:30
513294b80b shader_ir: read LLVM 23's lit(V) operand as the constant V (#6808)
Squash-merged after diff review of PR #6808 - shader_ir: read LLVM 23's lit(V) operand as the constant V
2026-11-23 09:56:26 -06:00
008b999657 Merge pull request #3213 from Leo Leahy 2026-11-22 15:15:46 -05:00
4127c9682b shader_ir: keep offset:swizzle(...) modifiers with spaces intact 2026-11-22 16:42:37 -03:00
6c0b310f4b SHADER-584: report operand census input errors 2026-11-22 20:28:37 +01:00
103eeead1d shader_ir: apply the limit only to regular shader files 2026-11-22 05:03:24 -03:00
2ff3e89ee4 Merge pull request #1002 from bbareth 2026-11-22 01:08:17 -05:00
abac6d1572 shader_ir.py: a tab after the mnemonic keeps the destination register
parse_line() split the mnemonic from its operands at the first space, so
"s_mov_b32<TAB>s3, 1" made "s_mov_b32\ts3," the opcode and dropped s3 from
the operands. The split is now on any whitespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:35:47 +01:00
b7905794d0 shader_ir: preserve VOP3 FP abs/neg modifiers on constant operands
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).
2026-11-22 01:09:48 -04:00
f15ce71faf BUILD: parse leading-zero decimal immediates in shader_ir 2026-11-21 21:16:15 -06:00
025a0ffecf shader_ir.py: parse arguments with argparse instead of indexing sys.argv
Run with no arguments it stopped with IndexError, `--limit x` with ValueError, and a missing path or a file
where a folder was expected with a traceback from os.listdir. It now has a usage line: src must be a folder,
and --limit takes a whole number of at least 1. The documented `shader_ir.py <dir> [--limit N]` form is
unchanged.

Tests: CliInputTest in tests/test_shader_ir.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:36:38 +03:00
d2c3283b54 tests: pin the shader_ir operand grammar and the pc walk
shader_ir.py is the parser both the translator and cpu_ref read listings
with, and the only assertions on it covered two scalar-load lines. These
cases cover every operand form, the modifier list, split_args nesting and
parse_file's pc stepping, so a parser regression fails here first.
2026-11-21 20:38:41 +00:00