The B3 oracle (#309) checks v_not_b32, v_bfrev_b32, v_ffbh_u32, v_ffbl_b32, v_ffbh_i32 and v_swap_b32 against the guide on both CPU interpreters, but its native Metal half was skipped because the translator did not accept the forms. This adds the VOP1 registry file and operand rule, decoder dispatch, IR and MSL lowering (v_swap_b32 writes both VGPRs, each merged under EXEC), fixture and goldens, and removes the oracle's skip from scripts/test-gpu.sh. A new CPU test checks that the compiler accepts every case of the oracle and rejects each of its rejections at the same word. v_mov_b32 stays hand-written. Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2.1 KiB
Wave32 vector unary integer operations and swap
Xenora translates six gfx1030 VOP1 integer forms for the synthetic Wave32 compute ABI. The AMD RDNA 2 ISA Reference Guide defines the operations in section 12.8, the encoding in section 13.3.2, and the execution mask (EXEC) in section 3.3.
| Form | Result in each active lane |
|---|---|
v_not_b32_e32 |
Complement all 32 bits. |
v_bfrev_b32_e32 |
Reverse the order of the 32 bits. |
v_ffbh_u32_e32 |
Count leading zeros. Return all ones if the source is zero. |
v_ffbl_b32_e32 |
Count trailing zeros. Return all ones if the source is zero. |
v_ffbh_i32_e32 |
Count leading bits equal to the sign bit. Return all ones if all bits match. |
v_swap_b32 |
Exchange the old values of two vector general-purpose registers (VGPRs). A register swapped with itself keeps its value. |
The unary forms accept a VGPR, scalar register s0–s105, vcc_lo (the low
half of the vector condition code), inline integer -16–64, or a literal
word as SRC0. Swap requires a VGPR as SRC0 because it writes both operands.
Both operands of swap must be initialized when EXEC is nonzero. The compute
ABI reserves v0 for indexing and requires waiting for buffer loads before
using or overwriting their destination. Inactive lanes retain their old
values. The six forms leave EXEC, VCC and the scalar condition code (SCC)
unchanged.
The compiler emits per-thread Metal Shading Language for unary operations. For swap it captures both old values in the intermediate representation before updating either register binding. Under partial EXEC, each register receives its own lane merge.
The guide-derived oracle checks 752 accepted cases against each CPU interpreter and the compiler, and verifies that 610 rejected programs fail at the same instruction offset. The LLVM-assembled fixture exercises all six forms with a partial EXEC swap. Native Metal execution and independent acceptance of the translator are pending. Xbox hardware agreement is unknown.