upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tools/rdna2_decode.py
diff options
context:
space:
mode:
authorNotRexed <therealnothingfn@gmail.com>2026-12-01 07:52:21 -0500
committerNotRexed <therealnothingfn@gmail.com>2026-12-01 07:52:21 -0500
commitdd4829ecfc259eebc0e42e3f72d2d61911ee010e (patch)
tree607dabec0efef7e5fe71297e2c5f0b512b0859eb /tools/rdna2_decode.py
parente12f7f9f9a82288ee0424be753d383eb3eb7843f (diff)
parent1723dec94510d0aa3d99e795f0a656970c1f00e9 (diff)
Merge remote-tracking branch 'origin/main' into push/main-1130
# Conflicts: # d3d12/docs/switches.md
Diffstat (limited to 'tools/rdna2_decode.py')
-rw-r--r--tools/rdna2_decode.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/rdna2_decode.py b/tools/rdna2_decode.py
index d66c1de2d..14195cfac 100644
--- a/tools/rdna2_decode.py
+++ b/tools/rdna2_decode.py
@@ -374,7 +374,15 @@ def _format_dpp16_ctrl(ctrl: int) -> str:
374 return f"dpp_ctrl:0x{ctrl:x}" 374 return f"dpp_ctrl:0x{ctrl:x}"
375 375
376 376
377def _format_ds_swizzle(offset16: int) -> str: 377def _format_ds_swizzle(offset16: int) -> str | None:
378 if offset16 == 0:
379 return None
380 if offset16 >= 0xE000:
381 return f"offset:swizzle(FFT,{offset16 & 0x1F})"
382 if offset16 >= 0xC000:
383 direction = (offset16 >> 10) & 1
384 size = (offset16 >> 5) & 0x1F
385 return f"offset:swizzle(ROTATE,{direction},{size})"
378 if (offset16 & 0x8000) == 0: 386 if (offset16 & 0x8000) == 0:
379 # Bitmask mode: bits [4:0] = and_mask, [9:5] = or_mask, [14:10] = xor_mask. 387 # Bitmask mode: bits [4:0] = and_mask, [9:5] = or_mask, [14:10] = xor_mask.
380 # Match LLVM's canonical aliases (SWAP, REVERSE, BROADCAST) before general BITMASK_PERM. 388 # Match LLVM's canonical aliases (SWAP, REVERSE, BROADCAST) before general BITMASK_PERM.
@@ -1107,9 +1115,11 @@ def _decode_one(code: bytes, pc: int, wave32: bool, mcpu: str) -> tuple[dict | N
1107 elif fn == "DATA1": 1115 elif fn == "DATA1":
1108 args.append(_vreg(data1, w)) 1116 args.append(_vreg(data1, w))
1109 mods = [] 1117 mods = []
1110 is_2addr = ("2_" in name or "2st64_" in name) 1118 is_2addr = name.startswith(("ds_read2", "ds_write2", "ds_wrxchg2"))
1111 if name == "ds_swizzle_b32": 1119 if name == "ds_swizzle_b32":
1112 mods.append(_format_ds_swizzle(offset0 | (offset1 << 8))) 1120 swz = _format_ds_swizzle(offset0 | (offset1 << 8))
1121 if swz:
1122 mods.append(swz)
1113 elif is_2addr: 1123 elif is_2addr:
1114 if offset0: 1124 if offset0:
1115 mods.append(f"offset0:{offset0}") 1125 mods.append(f"offset0:{offset0}")