upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 18:15:11 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 18:15:11 +0100
commitc921b244abec2ae82f76b4e231e855fd09a41bcf (patch)
treeedf248ea28b1fb420768d5ad9dc3580d6fa1861a
parent49475796c226c8511b9470bf97a4daf57b8af323 (diff)
rdna2spirv: v_mad_u32_u16 / v_mad_i32_i16 op_sel on S2 and D, and clamp
These forms were refused. Measured on RDNA2 (gfx1036, raw kernels through tools/hw_oracle, wave32 and wave64): op_sel bit 2 adds S2[31:16] zero-extended (in the i16 op too), op_sel bit 3 writes the result shifted left by 16, and clamp saturates the sum to u32 / i32 before that shift. GPU test ps_valu16_mad_sel (4096/4096 on RTX 5080 and the gfx1036 iGPU), the same shader as a semantic fixture, test_alu_mad_32_16 checks the measured rule instead of the refusal, and a docs/design.md row (EGEN-HW-MAD-U32-U16). AI-assisted.
-rw-r--r--docs/design.md1
-rw-r--r--runtime/test/shaders/check.py2
-rw-r--r--runtime/test/shaders/ps_valu16_mad_sel.asm35
-rw-r--r--scripts/run_gpu_tests.py1
-rw-r--r--tests/semantic/fixtures/disasm/ps_valu16_mad_sel.s17
-rw-r--r--tests/semantic/regen_fixtures.py1
-rw-r--r--tests/semantic/test_alu_mad_32_16.py39
-rw-r--r--tests/semantic/test_value_semantics.py19
-rw-r--r--tools/rdna2spirv.py40
9 files changed, 141 insertions, 14 deletions
diff --git a/docs/design.md b/docs/design.md
index 6c8a00c03..2bb594ab1 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -274,6 +274,7 @@ How the generated SPIR-V expects the runtime to work:
274| Geometry shaders | All 195 are `$GS_VoxelizeGeneric` permutations: legacy (merged ES/GS) wave32 programs on LDS rings, with no `exp`. Inputs: vertex i sits at the dword offset in v0 lo / v0 hi / v1 lo; an LDS read at vertex base + 4·(4·reg + comp) is input-signature register reg, component comp (checked: SV_Position xyz in dwords 0–2 and TEXCOORD0.xy in 4–5, as ISG1 declares). Outputs: emitted vertex k is dwords [k·4·nreg, (k+1)·4·nreg) of the lane's GSVS area, dword = 4·reg + comp of the output signature (20 dwords = 5 OSG1 registers; every write matches a declared mask). Translation: synthetic offsets (vertex i at dword 64·i), LDS reads → `gl_in[i]` inputs, LDS writes → staged slots, `MSG_GS EMIT` → copy slot (emit count) to the outputs + `OpEmitVertex`, `CUT` → `OpEndPrimitive`, `GS_DONE` → nothing. The prologue's `s_bfm_b64`/`s_cselect` EXEC setup is fed s3 = 64 << 8. GPU-checked with `runtime/test/shaders/gs_tri.asm` (`VKH_GS=… vk_harness`): 0 error. Without a geometry stage (Apple GPUs: Metal, MoltenVK), `tools/spirv_gs_to_compute.py` lowers the translated module to a compute capture pass, one invocation per input primitive: inputs come from a buffer, each `OpEmitVertex` writes the outputs to a record buffer, and a meta buffer holds each primitive's vertex count and strip ends, for an ordinary draw afterwards (SHADER-159). `gs_tri` lowered this way, converted with SPIRV-Cross and run natively on an Apple A18 Pro: 195/195 records exact for 65 random triangles, and the captured fullscreen triangle drawn from the records matches all 4096 gradient pixels. Not done: wiring it into a draw path, and GS that use cross-lane operations or more than one invocation. | 274| Geometry shaders | All 195 are `$GS_VoxelizeGeneric` permutations: legacy (merged ES/GS) wave32 programs on LDS rings, with no `exp`. Inputs: vertex i sits at the dword offset in v0 lo / v0 hi / v1 lo; an LDS read at vertex base + 4·(4·reg + comp) is input-signature register reg, component comp (checked: SV_Position xyz in dwords 0–2 and TEXCOORD0.xy in 4–5, as ISG1 declares). Outputs: emitted vertex k is dwords [k·4·nreg, (k+1)·4·nreg) of the lane's GSVS area, dword = 4·reg + comp of the output signature (20 dwords = 5 OSG1 registers; every write matches a declared mask). Translation: synthetic offsets (vertex i at dword 64·i), LDS reads → `gl_in[i]` inputs, LDS writes → staged slots, `MSG_GS EMIT` → copy slot (emit count) to the outputs + `OpEmitVertex`, `CUT` → `OpEndPrimitive`, `GS_DONE` → nothing. The prologue's `s_bfm_b64`/`s_cselect` EXEC setup is fed s3 = 64 << 8. GPU-checked with `runtime/test/shaders/gs_tri.asm` (`VKH_GS=… vk_harness`): 0 error. Without a geometry stage (Apple GPUs: Metal, MoltenVK), `tools/spirv_gs_to_compute.py` lowers the translated module to a compute capture pass, one invocation per input primitive: inputs come from a buffer, each `OpEmitVertex` writes the outputs to a record buffer, and a meta buffer holds each primitive's vertex count and strip ends, for an ordinary draw afterwards (SHADER-159). `gs_tri` lowered this way, converted with SPIRV-Cross and run natively on an Apple A18 Pro: 195/195 records exact for 65 random triangles, and the captured fullscreen triangle drawn from the records matches all 4096 gradient pixels. Not done: wiring it into a draw path, and GS that use cross-lane operations or more than one invocation. |
275| Integer clamp | The VOP3 `clamp` bit on `v_add_nc_u32`, `v_sub_nc_u32`, `v_subrev_nc_u32` saturates the result to [0, 0xFFFFFFFF], and on `v_add_nc_i32`/`v_sub_nc_i32` to [0x80000000, 0x7FFFFFFF]; without it they wrap. GFX9+ semantics: LLVM selects `uaddsat`/`usubsat` and `saddsat`/`ssubsat` to exactly these ops with clamp set. **Until this change clamp was silently ignored on the unsigned ops** (and the signed ones were `Unsupported`). Checked on the CPU by `tests/semantic/test_alu_add_nc_clamp.py`. The 16-bit unsigned add/sub (`v_add_nc_u16`, `v_sub_nc_u16`, and the `v_add_u16`/`v_sub_u16`/`v_subrev_u16` `_e64` names) saturate to [0, 0xFFFF] with `clamp` (llvm-mc 21 gfx1030 encodes the bit on them, and LLVM selects i16 `uaddsat`/`usubsat` to them); **until 2026-11-22 the translator wrapped instead**. `clamp` on any other 16-bit integer op raises `Unsupported`. CPU-checked by `tests/semantic/test_alu_u16_clamp.py` (the high half of the destination is kept). **Hardware-verified on RDNA2** (AMD Radeon 680M, `gfx1035`, Windows 11, driver `26.5.1`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137): all 32-bit and 16-bit `*_nc_*` `clamp` cases (including `op_sel` and kept destination half on u16) match hardware bit-for-bit. **Open divergence measured on the same hardware:** `v_add_co_u32`, `v_sub_co_u32`, `v_subrev_co_u32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32` and `v_subrev_co_ci_u32` with `clamp` saturate D (`0xFFFFFFFF` / `0`) while still reporting the real carry/borrow in `sdst`, whereas the translator currently ignores `clamp` on these carry-out ops. | 275| Integer clamp | The VOP3 `clamp` bit on `v_add_nc_u32`, `v_sub_nc_u32`, `v_subrev_nc_u32` saturates the result to [0, 0xFFFFFFFF], and on `v_add_nc_i32`/`v_sub_nc_i32` to [0x80000000, 0x7FFFFFFF]; without it they wrap. GFX9+ semantics: LLVM selects `uaddsat`/`usubsat` and `saddsat`/`ssubsat` to exactly these ops with clamp set. **Until this change clamp was silently ignored on the unsigned ops** (and the signed ones were `Unsupported`). Checked on the CPU by `tests/semantic/test_alu_add_nc_clamp.py`. The 16-bit unsigned add/sub (`v_add_nc_u16`, `v_sub_nc_u16`, and the `v_add_u16`/`v_sub_u16`/`v_subrev_u16` `_e64` names) saturate to [0, 0xFFFF] with `clamp` (llvm-mc 21 gfx1030 encodes the bit on them, and LLVM selects i16 `uaddsat`/`usubsat` to them); **until 2026-11-22 the translator wrapped instead**. `clamp` on any other 16-bit integer op raises `Unsupported`. CPU-checked by `tests/semantic/test_alu_u16_clamp.py` (the high half of the destination is kept). **Hardware-verified on RDNA2** (AMD Radeon 680M, `gfx1035`, Windows 11, driver `26.5.1`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137): all 32-bit and 16-bit `*_nc_*` `clamp` cases (including `op_sel` and kept destination half on u16) match hardware bit-for-bit. **Open divergence measured on the same hardware:** `v_add_co_u32`, `v_sub_co_u32`, `v_subrev_co_u32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32` and `v_subrev_co_ci_u32` with `clamp` saturate D (`0xFFFFFFFF` / `0`) while still reporting the real carry/borrow in `sdst`, whereas the translator currently ignores `clamp` on these carry-out ops. |
276| Integer clamp | The VOP3 `clamp` bit on `v_add_nc_u32`, `v_sub_nc_u32`, `v_subrev_nc_u32` saturates the result to [0, 0xFFFFFFFF], and on `v_add_nc_i32`/`v_sub_nc_i32` to [0x80000000, 0x7FFFFFFF]; without it they wrap. GFX9+ semantics: LLVM selects `uaddsat`/`usubsat` and `saddsat`/`ssubsat` to exactly these ops with clamp set. **Until this change clamp was silently ignored on the unsigned ops** (and the signed ones were `Unsupported`). Checked on the CPU by `tests/semantic/test_alu_add_nc_clamp.py`. The carry-out unsigned ops (`v_add_co_u32`, `v_sub_co_u32`, `v_subrev_co_u32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32`, `v_subrev_co_ci_u32`) with VOP3 `clamp` likewise saturate D to `0xFFFFFFFF` on add carry or `0` on sub borrow while still reporting the real carry/borrow bit in `sdst` (**until 2026-11-22 the translator ignored `clamp` on all six**); confirmed natively on RDNA2 (AMD Radeon 680M `gfx1035` wave32 & wave64 via `tools/hw_oracle`, and independently on `gfx1036` in #1746) and CPU-checked by `tests/semantic/test_alu_add_co_clamp.py`. The 16-bit unsigned add/sub (`v_add_nc_u16`, `v_sub_nc_u16`, and the `v_add_u16`/`v_sub_u16`/`v_subrev_u16` `_e64` names) saturate to [0, 0xFFFF] with `clamp` (llvm-mc 21 gfx1030 encodes the bit on them, and LLVM selects i16 `uaddsat`/`usubsat` to them); **until 2026-11-22 the translator wrapped instead**. `clamp` on any other 16-bit integer op raises `Unsupported`. CPU-checked by `tests/semantic/test_alu_u16_clamp.py` (the high half of the destination is kept), **not GPU-verified**. | 276| Integer clamp | The VOP3 `clamp` bit on `v_add_nc_u32`, `v_sub_nc_u32`, `v_subrev_nc_u32` saturates the result to [0, 0xFFFFFFFF], and on `v_add_nc_i32`/`v_sub_nc_i32` to [0x80000000, 0x7FFFFFFF]; without it they wrap. GFX9+ semantics: LLVM selects `uaddsat`/`usubsat` and `saddsat`/`ssubsat` to exactly these ops with clamp set. **Until this change clamp was silently ignored on the unsigned ops** (and the signed ones were `Unsupported`). Checked on the CPU by `tests/semantic/test_alu_add_nc_clamp.py`. The carry-out unsigned ops (`v_add_co_u32`, `v_sub_co_u32`, `v_subrev_co_u32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32`, `v_subrev_co_ci_u32`) with VOP3 `clamp` likewise saturate D to `0xFFFFFFFF` on add carry or `0` on sub borrow while still reporting the real carry/borrow bit in `sdst` (**until 2026-11-22 the translator ignored `clamp` on all six**); confirmed natively on RDNA2 (AMD Radeon 680M `gfx1035` wave32 & wave64 via `tools/hw_oracle`, and independently on `gfx1036` in #1746) and CPU-checked by `tests/semantic/test_alu_add_co_clamp.py`. The 16-bit unsigned add/sub (`v_add_nc_u16`, `v_sub_nc_u16`, and the `v_add_u16`/`v_sub_u16`/`v_subrev_u16` `_e64` names) saturate to [0, 0xFFFF] with `clamp` (llvm-mc 21 gfx1030 encodes the bit on them, and LLVM selects i16 `uaddsat`/`usubsat` to them); **until 2026-11-22 the translator wrapped instead**. `clamp` on any other 16-bit integer op raises `Unsupported`. CPU-checked by `tests/semantic/test_alu_u16_clamp.py` (the high half of the destination is kept), **not GPU-verified**. |
277| `v_mad_u32_u16` / `v_mad_i32_i16` op_sel on S2 and D, and clamp | D = S0.half · S1.half + S2, the halves zero- (u16) or sign-extended (i16), op_sel bit 0 / 1 reading the high half of S0 / S1. The other bits and `clamp` were refused (`Unsupported: op_sel/clamp`) until their results were measured on RDNA2 (AMD Radeon iGPU, gfx1036, Windows driver 26.10.1, raw kernels through `tools/hw_oracle`, wave32 and wave64 alike; EGEN-HW-MAD-U32-U16, 44 words): **op_sel bit 2 adds S2[31:16] zero-extended, in the i16 op too** (`v_mad_i32_i16 d, 3, 3, 0xffff8000 op_sel:[0,0,1,0]` gives `0x00010008`, not 8); an inline float constant there is its f32 pattern (`1.0` adds `0x3f80`); **op_sel bit 3 writes the result shifted left by 16** (low half 0, the old D not kept); **`clamp` saturates the 32-bit sum** to [0, 0xffffffff] (u16) or [0x80000000, 0x7fffffff] (i16), before that shift (the 16-bit product itself never overflows). GPU-checked with `runtime/test/shaders/ps_valu16_mad_sel.asm` (4096/4096 on NVIDIA GeForce RTX 5080, driver 616.92, and the gfx1036 iGPU); CPU-checked by `tests/semantic/test_alu_mad_32_16.py` (40 seeded cases against a Python reference) and `tests/semantic/test_value_semantics.py`. |
277| `v_add_nc_i16`, `v_sub_nc_i16` | GFX10 VOP3-only signed 16-bit add and subtract. Without `clamp` they are bit-identical to `v_add_nc_u16`/`v_sub_nc_u16` (the low 16 bits wrap) and take the same path: `op_sel:[s0,s1,dst]` picks each source's half and the destination half, and the other half of D is kept. With `clamp`, the exact sum or difference of the sign-extended halves saturates to [-32768, 32767] (`SClamp`), where the u16 forms saturate to [0, 0xFFFF]. Until 2026-11-22 both raised `Unsupported`. CPU-checked by `tests/semantic/test_valu_add_sub_nc_i16.py` (a value grid with and without `clamp`, `op_sel` including the destination half, and equality with the u16 forms without `clamp`). **Not GPU-verified.** | 278| `v_add_nc_i16`, `v_sub_nc_i16` | GFX10 VOP3-only signed 16-bit add and subtract. Without `clamp` they are bit-identical to `v_add_nc_u16`/`v_sub_nc_u16` (the low 16 bits wrap) and take the same path: `op_sel:[s0,s1,dst]` picks each source's half and the destination half, and the other half of D is kept. With `clamp`, the exact sum or difference of the sign-extended halves saturates to [-32768, 32767] (`SClamp`), where the u16 forms saturate to [0, 0xFFFF]. Until 2026-11-22 both raised `Unsupported`. CPU-checked by `tests/semantic/test_valu_add_sub_nc_i16.py` (a value grid with and without `clamp`, `op_sel` including the destination half, and equality with the u16 forms without `clamp`). **Not GPU-verified.** |
278| Gather sampler LOD | Before choosing the mip for the four fetches in `image_gather4_l(_o)`, clamp the requested LOD to S# word 1's MIN_LOD [11:0] and MAX_LOD [23:12] (unsigned 4.8). `ps_gather_sampler_lod.asm` reads the S# from the heap. On RTX 5080 and Radeon Graphics, a maximum of 0.25 selects the base quadrants and a minimum of 0.75 selects the cyan mip across the 64×64 draw. Without these bounds half of each frame reads the wrong level. Radeon also agreed with native `OpImageGather Lod` (`VK_AMD_texture_gather_bias_lod`) for those bounds. At exactly 0.5, with bounds [0,1], that native draw selected mip 1; the emulation now computes the mip as `Floor(LOD + 0.5)`, ties up, and also selects mip 1 (before SHADER-152 it used `RoundEven`, which selected mip 0). | 279| Gather sampler LOD | Before choosing the mip for the four fetches in `image_gather4_l(_o)`, clamp the requested LOD to S# word 1's MIN_LOD [11:0] and MAX_LOD [23:12] (unsigned 4.8). `ps_gather_sampler_lod.asm` reads the S# from the heap. On RTX 5080 and Radeon Graphics, a maximum of 0.25 selects the base quadrants and a minimum of 0.75 selects the cyan mip across the 64×64 draw. Without these bounds half of each frame reads the wrong level. Radeon also agreed with native `OpImageGather Lod` (`VK_AMD_texture_gather_bias_lod`) for those bounds. At exactly 0.5, with bounds [0,1], that native draw selected mip 1; the emulation now computes the mip as `Floor(LOD + 0.5)`, ties up, and also selects mip 1 (before SHADER-152 it used `RoundEven`, which selected mip 0). |
279| `s_absdiff_i32`, `s_mul_hi_i32` | `s_absdiff_i32`: D = \|S0 − S1\| with the 32-bit difference wrapped first (0x7FFFFFFF − 0x80000000 → 1; a difference of −2³¹ stays 0x80000000), SCC = D ≠ 0. `s_mul_hi_i32`: high word of the signed 64-bit product, SCC kept. From the RDNA2 ISA pseudocode; checked on the CPU by `tests/semantic/test_salu_absdiff_mul_hi.py`. **Hardware-verified** on an AMD Radeon RX 7900 XTX (gfx1100, Windows 11, driver 26.10.1) as raw wave32 kernels through `tools/hw_oracle`: `s_absdiff_i32(0x7FFFFFFF, 0x80000000)` = 1 and `s_absdiff_i32(0x80000000, 0)` = 0x80000000, both with SCC = 1, and equal operands give 0 with SCC = 0; `s_mul_hi_i32(0x7FFFFFFF, 0x7FFFFFFF)` = 0x3FFFFFFF and `s_mul_hi_i32(-1, 1)` = 0xFFFFFFFF, with SCC left as it was. | 280| `s_absdiff_i32`, `s_mul_hi_i32` | `s_absdiff_i32`: D = \|S0 − S1\| with the 32-bit difference wrapped first (0x7FFFFFFF − 0x80000000 → 1; a difference of −2³¹ stays 0x80000000), SCC = D ≠ 0. `s_mul_hi_i32`: high word of the signed 64-bit product, SCC kept. From the RDNA2 ISA pseudocode; checked on the CPU by `tests/semantic/test_salu_absdiff_mul_hi.py`. **Hardware-verified** on an AMD Radeon RX 7900 XTX (gfx1100, Windows 11, driver 26.10.1) as raw wave32 kernels through `tools/hw_oracle`: `s_absdiff_i32(0x7FFFFFFF, 0x80000000)` = 1 and `s_absdiff_i32(0x80000000, 0)` = 0x80000000, both with SCC = 1, and equal operands give 0 with SCC = 0; `s_mul_hi_i32(0x7FFFFFFF, 0x7FFFFFFF)` = 0x3FFFFFFF and `s_mul_hi_i32(-1, 1)` = 0xFFFFFFFF, with SCC left as it was. |
diff --git a/runtime/test/shaders/check.py b/runtime/test/shaders/check.py
index 00acdc5ef..6859dcc62 100644
--- a/runtime/test/shaders/check.py
+++ b/runtime/test/shaders/check.py
@@ -301,6 +301,8 @@ PIXEL_BITS = {"ps_clip_color": (0x3e800000, 0x3f000000, 0x3f400000, 0x3f800000),
301 "ps_interp_mov_mods": (0x3f800000, 0x3fc00000, 0x40000000, 0x3f400000), 301 "ps_interp_mov_mods": (0x3f800000, 0x3fc00000, 0x40000000, 0x3f400000),
302 # v_mad_u32_u16 / v_mad_i32_i16 and v_subrev_f16, which had CPU checks only (derivations in the .asm headers) 302 # v_mad_u32_u16 / v_mad_i32_i16 and v_subrev_f16, which had CPU checks only (derivations in the .asm headers)
303 "ps_valu16_mad": (0x00000002, 0x00030002, 0x00008000, 0x00000004), 303 "ps_valu16_mad": (0x00000002, 0x00030002, 0x00008000, 0x00000004),
304 # op_sel on S2 / D and clamp, measured on gfx1036 (EGEN-HW-MAD-U32-U16)
305 "ps_valu16_mad_sel": (0x00008003, 0xdb880000, 0xffffffff, 0x80000000),
304 "ps_valu16_subrev": (0xaaaabc00, 0xaaaac000, 0xaaaa3c00, 0x42003800), 306 "ps_valu16_subrev": (0xaaaabc00, 0xaaaac000, 0xaaaa3c00, 0x42003800),
305 # v_readlane_b32 across both halves of a wave64 (the .asm header derives the words) 307 # v_readlane_b32 across both halves of a wave64 (the .asm header derives the words)
306 "ps_w64x_readlane": (0x40000079, 0x40000010, 0x40000064, 0x400000be)} 308 "ps_w64x_readlane": (0x40000079, 0x40000010, 0x40000064, 0x400000be)}
diff --git a/runtime/test/shaders/ps_valu16_mad_sel.asm b/runtime/test/shaders/ps_valu16_mad_sel.asm
new file mode 100644
index 000000000..81b3c17e0
--- /dev/null
+++ b/runtime/test/shaders/ps_valu16_mad_sel.asm
@@ -0,0 +1,35 @@
1; v_mad_u32_u16 / v_mad_i32_i16 with op_sel on S2 or D and with clamp, the forms the translator used to refuse.
2; Measured on an AMD Radeon iGPU (gfx1036, RDNA2, Windows driver 26.10.1) with raw kernels through tools/hw_oracle,
3; wave32 and wave64 alike (EGEN-HW-MAD-U32-U16):
4; op_sel bit 2 (S2) adds S2[31:16] zero-extended, in the i16 op too (S2 = 0xffff8000 adds 0xffff, not -1);
5; op_sel bit 3 (D) writes the 32-bit result shifted left by 16: its low half to D's high half, 0 to D's low half;
6; clamp saturates the 32-bit sum, to [0, 0xffffffff] (u16) or [0x80000000, 0x7fffffff] (i16), before that shift.
7; Otherwise as ps_valu16_mad: D = S0.half * S1.half + S2 mod 2^32, the halves zero- (u16) or sign-extended (i16),
8; op_sel bit 0 / 1 picks the high half of S0 / S1; the destinations' 0xaaaa5555 is never kept.
9; v0 = 0x1234ffff, v1 = 0x5678fffe, v3 = 0x8001fff0 (high half 0x8001: negative as an i16)
10; v5 = 0x00018000 (low -32768), v6 = 0xffff7fff (low 32767), v7 = 0x80000000
11; x: v_mad_i32_i16 v2, v0, v1, v3 op_sel:[0,0,1,0]: (-1) * (-2) = 2; + 0x8001 = 0x00008003
12; (S2 high half sign-extended: 0xffff8003; whole S2: 0x8001fff2)
13; y: v_mad_u32_u16 v4, v0, v1, v3 op_sel:[1,0,0,1]: 0x1234 * 0xfffe = 0x1233db98; + 0x8001fff0 = 0x9235db88;
14; << 16 = 0xdb880000
15; z: v_mad_u32_u16 v8, v0, v0, v3 clamp: 0xffff * 0xffff = 0xfffe0001; + 0x8001fff0 = 0x1_7ffffff1 > 0xffffffff,
16; so 0xffffffff (wrapping: 0x7ffffff1)
17; w: v_mad_i32_i16 v9, v5, v6, v7 clamp: -32768 * 32767 = -1073709056; + (-2^31) < -2^31, so 0x80000000
18; (wrapping: 0x40008000)
19; Expected mrt0 bits: 0x00008003, 0xdb880000, 0xffffffff, 0x80000000
20v_mov_b32 v0, 0x1234ffff
21v_mov_b32 v1, 0x5678fffe
22v_mov_b32 v3, 0x8001fff0
23v_mov_b32 v5, 0x00018000
24v_mov_b32 v6, 0xffff7fff
25v_mov_b32 v7, 0x80000000
26v_mov_b32 v2, 0xaaaa5555
27v_mov_b32 v4, 0xaaaa5555
28v_mov_b32 v8, 0xaaaa5555
29v_mov_b32 v9, 0xaaaa5555
30v_mad_i32_i16 v2, v0, v1, v3 op_sel:[0,0,1,0]
31v_mad_u32_u16 v4, v0, v1, v3 op_sel:[1,0,0,1]
32v_mad_u32_u16 v8, v0, v0, v3 clamp
33v_mad_i32_i16 v9, v5, v6, v7 clamp
34exp mrt0 v2, v4, v8, v9 done vm
35s_endpgm
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 698ec36d0..b9e99e352 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -1153,6 +1153,7 @@ def run_suite(a, work: str) -> int:
1153 "ps_interp_mov_mods": (0x3F800000, 0x3FC00000, 0x40000000, 0x3F400000), 1153 "ps_interp_mov_mods": (0x3F800000, 0x3FC00000, 0x40000000, 0x3F400000),
1154 # v_mad_u32_u16 / v_mad_i32_i16 and v_subrev_f16, which had CPU checks only (.asm headers) 1154 # v_mad_u32_u16 / v_mad_i32_i16 and v_subrev_f16, which had CPU checks only (.asm headers)
1155 "ps_valu16_mad": (0x00000002, 0x00030002, 0x00008000, 0x00000004), 1155 "ps_valu16_mad": (0x00000002, 0x00030002, 0x00008000, 0x00000004),
1156 "ps_valu16_mad_sel": (0x00008003, 0xDB880000, 0xFFFFFFFF, 0x80000000), # measured on gfx1036
1156 "ps_valu16_subrev": (0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800), 1157 "ps_valu16_subrev": (0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800),
1157 "ps_w64x_readlane": (0x40000079, 0x40000010, 0x40000064, 0x400000BE), # same expectation as check.py 1158 "ps_w64x_readlane": (0x40000079, 0x40000010, 0x40000064, 0x400000BE), # same expectation as check.py
1158 } 1159 }
diff --git a/tests/semantic/fixtures/disasm/ps_valu16_mad_sel.s b/tests/semantic/fixtures/disasm/ps_valu16_mad_sel.s
new file mode 100644
index 000000000..f86e9f508
--- /dev/null
+++ b/tests/semantic/fixtures/disasm/ps_valu16_mad_sel.s
@@ -0,0 +1,17 @@
1; ps_valu16_mad_sel test fixture generated by tests/semantic/regen_fixtures.py from runtime/test/shaders/ps_valu16_mad_sel.asm
2 v_mov_b32 v0, 0x1234ffff
3 v_mov_b32 v1, 0x5678fffe
4 v_mov_b32 v3, 0x8001fff0
5 v_mov_b32 v5, 0x00018000
6 v_mov_b32 v6, 0xffff7fff
7 v_mov_b32 v7, 0x80000000
8 v_mov_b32 v2, 0xaaaa5555
9 v_mov_b32 v4, 0xaaaa5555
10 v_mov_b32 v8, 0xaaaa5555
11 v_mov_b32 v9, 0xaaaa5555
12 v_mad_i32_i16 v2, v0, v1, v3 op_sel:[0,0,1,0]
13 v_mad_u32_u16 v4, v0, v1, v3 op_sel:[1,0,0,1]
14 v_mad_u32_u16 v8, v0, v0, v3 clamp
15 v_mad_i32_i16 v9, v5, v6, v7 clamp
16 exp mrt0 v2, v4, v8, v9 done vm
17 s_endpgm
diff --git a/tests/semantic/regen_fixtures.py b/tests/semantic/regen_fixtures.py
index e0ee965a9..fc6ef3a66 100644
--- a/tests/semantic/regen_fixtures.py
+++ b/tests/semantic/regen_fixtures.py
@@ -33,6 +33,7 @@ SHADERS = ("cs_smem_bounds", "cs_smem_stride_align", "cs_smem_sload_neg", "cs_bu
33 "cs_w64x_andn2_exec", # s_andn2_saveexec_b64 / s_andn2_wrexec_b64 (test_andn2_exec_b64.py) 33 "cs_w64x_andn2_exec", # s_andn2_saveexec_b64 / s_andn2_wrexec_b64 (test_andn2_exec_b64.py)
34 "cs_w64x_saveexec_b64", # s_and/s_or/s_andn2_saveexec_b64, s_andn2_wrexec_b64 (test_saveexec_b64.py) 34 "cs_w64x_saveexec_b64", # s_and/s_or/s_andn2_saveexec_b64, s_andn2_wrexec_b64 (test_saveexec_b64.py)
35 "ps_valu16_mad", "ps_valu16_subrev", # v_mad_u32_u16 / v_mad_i32_i16, v_subrev_f16 35 "ps_valu16_mad", "ps_valu16_subrev", # v_mad_u32_u16 / v_mad_i32_i16, v_subrev_f16
36 "ps_valu16_mad_sel", # v_mad_u32_u16 / v_mad_i32_i16 op_sel S2 / D and clamp (EGEN-HW-MAD-U32-U16)
36 "cs_cvt_pk_u8") # v_cvt_pk_u8_f32 rounding and NaN (test_cvt_pk_u8.py) 37 "cs_cvt_pk_u8") # v_cvt_pk_u8_f32 rounding and NaN (test_cvt_pk_u8.py)
37 38
38 39
diff --git a/tests/semantic/test_alu_mad_32_16.py b/tests/semantic/test_alu_mad_32_16.py
index 8b9cbc4bc..0d5c6643d 100644
--- a/tests/semantic/test_alu_mad_32_16.py
+++ b/tests/semantic/test_alu_mad_32_16.py
@@ -2,7 +2,9 @@
2 2
3RDNA ISA pseudocode: D = S0.half * S1.half + S2, wrapping at 32 bits. The 16-bit halves are zero-extended for 3RDNA ISA pseudocode: D = S0.half * S1.half + S2, wrapping at 32 bits. The 16-bit halves are zero-extended for
4v_mad_u32_u16 and sign-extended for v_mad_i32_i16; op_sel bit 0 / 1 reads the high half of S0 / S1 (the low half by 4v_mad_u32_u16 and sign-extended for v_mad_i32_i16; op_sel bit 0 / 1 reads the high half of S0 / S1 (the low half by
5default). S2 and D are whole dwords. Each case translates a synthetic pixel shader with tools/rdna2spirv.py, runs it 5default). S2 and D are whole dwords. Measured on RDNA2 (gfx1036, EGEN-HW-MAD-U32-U16): op_sel bit 2 adds S2[31:16]
6zero-extended (in the i16 op too), op_sel bit 3 writes the result shifted left by 16, and clamp saturates the sum to
7[0, 0xffffffff] (u16) or [0x80000000, 0x7fffffff] (i16) before that shift. Each case translates a synthetic pixel shader with tools/rdna2spirv.py, runs it
6in tests/semantic/spirv_mini_interp.py and compares the result with a plain-Python reference. D leaves through exp as 8in tests/semantic/spirv_mini_interp.py and compares the result with a plain-Python reference. D leaves through exp as
7two 16-bit halves ORed into 0x40000000, so no export channel is a NaN or denormal pattern that a float round trip 9two 16-bit halves ORed into 0x40000000, so no export channel is a NaN or denormal pattern that a float round trip
8could change. 10could change.
@@ -36,9 +38,14 @@ def half(x: int, hi: int, signed: bool) -> int:
36 return h - 0x10000 if signed and h >> 15 else h 38 return h - 0x10000 if signed and h >> 15 else h
37 39
38 40
39def ref(op: str, x: int, y: int, z: int, sel=(0, 0)) -> int: 41def ref(op: str, x: int, y: int, z: int, sel=(0, 0), s2hi=0, dhi=0, clamp=False) -> int:
40 signed = op == "v_mad_i32_i16" 42 signed = op == "v_mad_i32_i16"
41 return (half(x, sel[0], signed) * half(y, sel[1], signed) + z) & M32 43 c = z >> 16 if s2hi else z - (1 << 32) if signed and z >> 31 else z
44 r = half(x, sel[0], signed) * half(y, sel[1], signed) + c
45 if clamp:
46 r = max(-(1 << 31), min((1 << 31) - 1, r)) if signed else min(r, M32)
47 r &= M32
48 return (r << 16) & M32 if dhi else r
42 49
43 50
44OPS = ("v_mad_u32_u16", "v_mad_i32_i16") 51OPS = ("v_mad_u32_u16", "v_mad_i32_i16")
@@ -119,11 +126,27 @@ class Mad3216Tests(unittest.TestCase):
119 with self.subTest(op=op, x=hex(x), y=hex(y), z=hex(z), op_sel=sel): 126 with self.subTest(op=op, x=hex(x), y=hex(y), z=hex(z), op_sel=sel):
120 self.assertEqual(run_op(op, x, y, z, sel), ref(op, x, y, z, sel)) 127 self.assertEqual(run_op(op, x, y, z, sel), ref(op, x, y, z, sel))
121 128
122 def test_unmodelled_modifiers_are_rejected(self): 129 def test_reference_measured_modifiers(self):
123 for mod in (" op_sel:[0,0,1,0]", " op_sel:[0,0,0,1]", " clamp"): 130 # Words measured on gfx1036 (raw kernels, wave32 = wave64).
124 with self.subTest(mod=mod): 131 self.assertEqual(ref("v_mad_i32_i16", 0xFFFF, 0xFFFF, 0xFFFF8000, s2hi=1), 0x00010000) # 1 + 0xffff
125 with self.assertRaises(rdna2spirv.Unsupported): 132 self.assertEqual(ref("v_mad_u32_u16", 0x8003FFFE, 0x7FFF0005, 0x12345678, dhi=1), 0x566E0000)
126 run_lines(["v_mov_b32 v1, 1", f"v_mad_u32_u16 v0, v1, v1, v1{mod}"]) 133 self.assertEqual(ref("v_mad_u32_u16", 0xFFFE, 0xFFFE, 0xFFFFFFF0, clamp=True), 0xFFFFFFFF)
134 self.assertEqual(ref("v_mad_i32_i16", 0x8000, 0x8000, 0x7FFFFFFF, clamp=True, dhi=1), 0xFFFF0000)
135 self.assertEqual(ref("v_mad_i32_i16", 0x8000, 0x7FFF, 0x80000000, clamp=True), 0x80000000)
136
137 def test_op_sel_s2_d_and_clamp_seeded(self):
138 rng = random.Random(0x3217)
139 edges = [0, 0xFFFF, 0x8000, 0x7FFF, 0x80000000, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFF8000]
140 for _ in range(40):
141 op = rng.choice(OPS)
142 sel = (rng.getrandbits(1), rng.getrandbits(1))
143 s2hi, dhi, clamp = rng.getrandbits(1), rng.getrandbits(1), rng.random() < 0.6
144 x, y, z = (rng.choice(edges) if rng.random() < 0.5 else rng.getrandbits(32) for _ in range(3))
145 mod = f" op_sel:[{sel[0]},{sel[1]},{s2hi},{dhi}]" + (" clamp" if clamp else "")
146 with self.subTest(op=op, x=hex(x), y=hex(y), z=hex(z), mod=mod):
147 got = run_lines([f"v_mov_b32 v1, {x:#x}", f"v_mov_b32 v2, {y:#x}", f"v_mov_b32 v3, {z:#x}",
148 f"{op} v0, v1, v2, v3{mod}"])
149 self.assertEqual(got, ref(op, x, y, z, sel, s2hi, dhi, clamp))
127 150
128 151
129if __name__ == "__main__": 152if __name__ == "__main__":
diff --git a/tests/semantic/test_value_semantics.py b/tests/semantic/test_value_semantics.py
index aebadca2b..d1f69df5f 100644
--- a/tests/semantic/test_value_semantics.py
+++ b/tests/semantic/test_value_semantics.py
@@ -37,6 +37,8 @@ ISA semantics used (AMD RDNA2 ISA reference, VALU/VOP3/VOP3P chapters):
37 s_ff0_i32_b32 constant or literal source is a 32-bit value, not a lane mask (SHADER-46). 37 s_ff0_i32_b32 constant or literal source is a 32-bit value, not a lane mask (SHADER-46).
38 v_mad_u32_u16 / D = S0.lo * S1.lo + S2 mod 2^32, the halves zero- (u16) or sign-extended (i16); op_sel bit 38 v_mad_u32_u16 / D = S0.lo * S1.lo + S2 mod 2^32, the halves zero- (u16) or sign-extended (i16); op_sel bit
39 v_mad_i32_i16 0/1 reads the high half of S0/S1. D is a whole dword (nothing of the old value is kept). 39 v_mad_i32_i16 0/1 reads the high half of S0/S1. D is a whole dword (nothing of the old value is kept).
40 Measured on gfx1036 (ps_valu16_mad_sel.asm): op_sel bit 2 adds S2[31:16] zero-extended
41 (i16 too), bit 3 writes the result << 16, clamp saturates to u32 / i32 before that shift.
40 v_subrev_f16 D.lo = S1.lo - S0.lo; the high half of D is kept in the VOP2 and the VOP3 form. 42 v_subrev_f16 D.lo = S1.lo - S0.lo; the high half of D is kept in the VOP2 and the VOP3 form.
41 s_*_saveexec_b32/b64, a constant used as a lane mask gives lane L its bit L: of the 32-bit value for a b32 op, 43 s_*_saveexec_b32/b64, a constant used as a lane mask gives lane L its bit L: of the 32-bit value for a b32 op,
42 s_andn2_wrexec_*, of the 64-bit value for a b64 op (inline constants sign-extended, literals with a zero 44 s_andn2_wrexec_*, of the 64-bit value for a b64 op (inline constants sign-extended, literals with a zero
@@ -79,6 +81,7 @@ EXPECTED_FMT_1010102 = {0x00: 0x00000000, 0x04: 0x3F800000, 0x08: 0x00000000, 0x
79EXPECTED_SFF_IMM = [0x00000002, 0x00000001, 0x00000014, 0x00000010] 81EXPECTED_SFF_IMM = [0x00000002, 0x00000001, 0x00000014, 0x00000010]
80EXPECTED_VALU16_MAD = [0x00000002, 0x00030002, 0x00008000, 0x00000004] 82EXPECTED_VALU16_MAD = [0x00000002, 0x00030002, 0x00008000, 0x00000004]
81EXPECTED_VALU16_SUBREV = [0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800] 83EXPECTED_VALU16_SUBREV = [0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800]
84EXPECTED_VALU16_MAD_SEL = [0x00008003, 0xDB880000, 0xFFFFFFFF, 0x80000000] # hardware-measured
82 85
83 86
84def _f32_bits(x): 87def _f32_bits(x):
@@ -308,6 +311,16 @@ def reference_valu16_mad():
308 _mad_32_16(True, v5, v6, 5, sel=(1, 1))] 311 _mad_32_16(True, v5, v6, 5, sel=(1, 1))]
309 312
310 313
314def reference_valu16_mad_sel():
315 # op_sel bit 2 adds S2[31:16] zero-extended; bit 3 shifts the result left by 16; clamp saturates the sum.
316 v0, v1, v3, v5, v6, v7 = 0x1234FFFF, 0x5678FFFE, 0x8001FFF0, 0x00018000, 0xFFFF7FFF, 0x80000000
317 x = _mad_32_16(True, v0, v1, v3 >> 16)
318 y = (_mad_32_16(False, v0, v1, v3, sel=(1, 0)) << 16) & 0xFFFFFFFF
319 z = min((v0 & 0xFFFF) * (v0 & 0xFFFF) + v3, 0xFFFFFFFF)
320 w = max(-(1 << 31), min((1 << 31) - 1, -32768 * 32767 - (1 << 31))) & 0xFFFFFFFF # v5.lo * v6.lo + v7
321 return [x, y, z, w]
322
323
311def reference_valu16_subrev(): 324def reference_valu16_subrev():
312 a, b, d = _unhalf(0x3E00), _unhalf(0x3800), _unhalf(0x3C00) # low halves: v0 1.5, v1 0.5, v5 1.0 325 a, b, d = _unhalf(0x3E00), _unhalf(0x3800), _unhalf(0x3C00) # low halves: v0 1.5, v1 0.5, v5 1.0
313 return [0xAAAA0000 | _half(b - a), 0xAAAA0000 | _half(-b - a), 0xAAAA0000 | _half(min(1.0, b + a)), 326 return [0xAAAA0000 | _half(b - a), 0xAAAA0000 | _half(-b - a), 0xAAAA0000 | _half(min(1.0, b + a)),
@@ -364,6 +377,7 @@ class OracleTests(unittest.TestCase):
364 self.assertEqual(reference_sff_imm(), EXPECTED_SFF_IMM) 377 self.assertEqual(reference_sff_imm(), EXPECTED_SFF_IMM)
365 self.assertEqual(reference_valu16_mad(), EXPECTED_VALU16_MAD) 378 self.assertEqual(reference_valu16_mad(), EXPECTED_VALU16_MAD)
366 self.assertEqual(reference_valu16_subrev(), EXPECTED_VALU16_SUBREV) 379 self.assertEqual(reference_valu16_subrev(), EXPECTED_VALU16_SUBREV)
380 self.assertEqual(reference_valu16_mad_sel(), EXPECTED_VALU16_MAD_SEL)
367 381
368 382
369class TranslatorValueSemantics(unittest.TestCase): 383class TranslatorValueSemantics(unittest.TestCase):
@@ -425,6 +439,11 @@ class TranslatorValueSemantics(unittest.TestCase):
425 # halves); the destination dword is replaced, its 0xaaaa5555 is not kept. 439 # halves); the destination dword is replaced, its 0xaaaa5555 is not kept.
426 self.check("ps_valu16_mad", EXPECTED_VALU16_MAD) 440 self.check("ps_valu16_mad", EXPECTED_VALU16_MAD)
427 441
442 def test_mad_u32_u16_i32_i16_op_sel_s2_d_and_clamp(self):
443 # EGEN-HW-MAD-U32-U16: S2's high half zero-extended even in the i16 op (0x8001, not -32767), the result
444 # shifted into D's high half, and u32 / i32 saturation; all four used to be Unsupported.
445 self.check("ps_valu16_mad_sel", EXPECTED_VALU16_MAD_SEL)
446
428 def test_subrev_f16_reversed_and_keeps_high_half(self): 447 def test_subrev_f16_reversed_and_keeps_high_half(self):
429 # S1 - S0 in the _e32 and _e64 forms (neg, clamp), low half out, the destination's high half kept, also 448 # S1 - S0 in the _e32 and _e64 forms (neg, clamp), low half out, the destination's high half kept, also
430 # when the destination is a source. 449 # when the destination is a source.
diff --git a/tools/rdna2spirv.py b/tools/rdna2spirv.py
index 7c73f1228..cacce4bae 100644
--- a/tools/rdna2spirv.py
+++ b/tools/rdna2spirv.py
@@ -7345,20 +7345,48 @@ class Gen:
7345 self.mask_dst(sd, m) 7345 self.mask_dst(sd, m)
7346 elif op in ("v_mad_u32_u16", "v_mad_i32_i16"): 7346 elif op in ("v_mad_u32_u16", "v_mad_i32_i16"):
7347 # D = S0.half * S1.half + S2 (RDNA ISA pseudocode), wrapping at 32 bits: the 16-bit halves zero-extended 7347 # D = S0.half * S1.half + S2 (RDNA ISA pseudocode), wrapping at 32 bits: the 16-bit halves zero-extended
7348 # (u16) or sign-extended (i16); op_sel bits 0 / 1 read the high half of S0 / S1. S2 and D are whole 7348 # (u16) or sign-extended (i16); op_sel bits 0 / 1 read the high half of S0 / S1. Measured on RDNA2
7349 # dwords, so an op_sel bit on them, and clamp, are not modelled: rejected rather than guessed. 7349 # (gfx1036, raw kernels, wave32 and wave64, EGEN-HW-MAD-U32-U16) for the other bits: op_sel bit 2 adds
7350 # S2[31:16] zero-extended, also in the i16 op (S2 = 0xffff8000 adds 0xffff); op_sel bit 3 writes the
7351 # result shifted left by 16 (low half 0, the old D not kept); clamp saturates the sum to [0, 0xffffffff]
7352 # (u16) or [0x80000000, 0x7fffffff] (i16), before that shift.
7350 sel, dhi = self.opsel_bits(mods, 3) 7353 sel, dhi = self.opsel_bits(mods, 3)
7351 if sel[2] or dhi or "clamp" in mods: 7354 signed = op == "v_mad_i32_i16"
7352 raise Unsupported(op + " op_sel/clamp") 7355 ext = "OpBitFieldSExtract" if signed else "OpBitFieldUExtract"
7353 ext = "OpBitFieldSExtract" if op == "v_mad_i32_i16" else "OpBitFieldUExtract"
7354 hs = [] 7356 hs = []
7355 for i, src in enumerate(a[1:3]): 7357 for i, src in enumerate(a[1:3]):
7356 h = self.tmp() 7358 h = self.tmp()
7357 self.emit(f"{h} = {ext} %uint {self.src_u(src)} {self.cu(16 * sel[i])} {self.cu(16)}") 7359 self.emit(f"{h} = {ext} %uint {self.src_u(src)} {self.cu(16 * sel[i])} {self.cu(16)}")
7358 hs.append(h) 7360 hs.append(h)
7361 c = self.src_u(a[3])
7362 if sel[2]:
7363 c2 = self.tmp()
7364 self.emit(f"{c2} = OpShiftRightLogical %uint {c} {self.cu(16)}")
7365 c = c2
7359 m, r = self.tmp(), self.tmp() 7366 m, r = self.tmp(), self.tmp()
7360 self.emit(f"{m} = OpIMul %uint {hs[0]} {hs[1]}") 7367 self.emit(f"{m} = OpIMul %uint {hs[0]} {hs[1]}")
7361 self.emit(f"{r} = OpIAdd %uint {m} {self.src_u(a[3])}") 7368 self.emit(f"{r} = OpIAdd %uint {m} {c}")
7369 if "clamp" in mods:
7370 # Two 16-bit halves never overflow their 32-bit product, so only the addition can: unsigned when
7371 # the sum is below the product, signed when product and addend share a sign the sum lacks.
7372 ov, sat, rs = self.tmp(), self.tmp(), self.tmp()
7373 if signed:
7374 x1, x2, both, neg = self.tmp(), self.tmp(), self.tmp(), self.tmp()
7375 self.emit(f"{x1} = OpBitwiseXor %uint {r} {m}")
7376 self.emit(f"{x2} = OpBitwiseXor %uint {r} {c}")
7377 self.emit(f"{both} = OpBitwiseAnd %uint {x1} {x2}")
7378 self.emit(f"{ov} = OpSLessThan %bool {self.as_int(both)} {self.as_int(self.cu(0))}")
7379 self.emit(f"{neg} = OpSLessThan %bool {self.as_int(c)} {self.as_int(self.cu(0))}")
7380 self.emit(f"{sat} = OpSelect %uint {neg} {self.cu(0x80000000)} {self.cu(0x7FFFFFFF)}")
7381 else:
7382 self.emit(f"{ov} = OpULessThan %bool {r} {m}")
7383 sat = self.cu(0xFFFFFFFF)
7384 self.emit(f"{rs} = OpSelect %uint {ov} {sat} {r}")
7385 r = rs
7386 if dhi:
7387 rd = self.tmp()
7388 self.emit(f"{rd} = OpShiftLeftLogical %uint {r} {self.cu(16)}")
7389 r = rd
7362 self.dst(a[0], r) 7390 self.dst(a[0], r)
7363 elif op in ("v_dot4_i32_i8", "v_dot4c_i32_i8"): 7391 elif op in ("v_dot4_i32_i8", "v_dot4c_i32_i8"):
7364 # The four products of the signed bytes of two dwords, summed, plus an addend: the third source for 7392 # The four products of the signed bytes of two dwords, summed, plus an addend: the third source for