GFX10 places the separate literal dword above 32 zero bits for a binary64 source. Use the same source interpretation for reciprocal, square root and exponent decomposition so literal and register-pair forms produce the same color.
RDNA2 reads the literal dword of a double as its high word. Preserve LLVM's distinction between a printed literal and an inline integer so conversions and adds receive the encoded value.
Follow-up to #1570, which took the `neg` half of SHADER-260 and left `abs`
refused. `abs` is the ISA's absolute value of the operand: a clear of the
sign bit, on the 16-bit half the operand contributes and applied before
`neg` (which #1570 emits as a bit 15 flip). The instruction already moved
each half unchanged, so the translator emitted nothing for `abs` and threw
`Unsupported("v_pack_b32_f16 abs modifier")` for any shader that used it.
Emit the clear instead: OpBitwiseAnd 0x7FFF on the selected half, before
the `neg` xor. No hardware run of this instruction with `abs` exists, so
the docs row says the rule is ISA-derived and unmeasured rather than
quoting a measurement.
Tests: exact-bit CPU cases in tests/semantic/test_pack_b32_f16_mods.py and
tests/test_values.py (both halves, op_sel, an sNaN payload, neg+abs order),
the interpreter-run GPU fixture ps_f16_pack_mods with its words derived
from the rule, and the row in docs/design.md.
SHADER-260, Depends on: #1570
SHADER-260 measured on gfx1036 that a VOP3 `neg` on this instruction is a
plain sign flip of the 16-bit half that operand contributes, before any
quieting (0x7c01 -> 0xfc01 under IEEE mode 0 and -> 0xfe01 under mode 1), in
either half and with op_sel. The translator refused every modifier, so any
shader using it failed to translate. `abs` stays refused because its rule on
this instruction is unmeasured, and the mode-1 signalling-NaN quieting is left
out until SHADER-190 settles which mode the game's shaders run in.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.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).