Commit Graph
60 Commits
Author SHA1 Message Date
elforeign 947d6e4eaf isa, decoder, shader: the six VOP1 integer forms through the semantic registry (#215)
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>
2026-11-24 09:41:08 -06:00
elforeign 81cfe69143 Merge remote-tracking branch 'origin/main' into task/215-sopk-oracle
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
2026-11-24 09:06:03 -06:00
Ranveer Soni d6f21217a2 Merge branch 'main' into task/215-vop1-int-oracle 2026-11-24 20:27:11 +05:30
elforeign 9ef9537540 isa, decoder, shader: SOPK integer forms through the semantic registry (#215)
Declares s_movk_i32, s_cmovk_i32, s_cmpk_{eq,lg,gt,ge,lt,le}_{i32,u32},
s_addk_i32 and s_mulk_i32 as registry data under the new operand rules
sopk_sgpr and sopk_compare (SDST s0-s105 only, SIMM16 never a literal),
with the operations mov and cmov, the sext_simm16 primitive and an XML
check of the 16-bit immediate. The decoder dispatches them through the
generated ScalarImmediateOp and ScalarImmediateCompareOp (the fixed
0xbbfd0000 fence keeps its own decoding) and the translator folds them
into its scalar state like SOP2 and SOPC, refusing writes to s0-s7.

The guide-derived oracle in tests/validation/tests/sopk.rs is unchanged.
Adds IR and MSL goldens for the new fixture, LLVM-checked decoder words,
a known answer, an isa dispatch test and generator unit tests.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:55:52 -06:00
elforeign 6ff79431bc validation: swap rejections for v0, honest pending-load labels (#215)
v_swap_b32 gains rejections for v0 as SRC0 and as VDST under full EXEC.
Its outstanding-load case is a VDST read, so it is labelled as one. The
GPU gate skip names #215.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:51:35 -06:00
elforeign 1b4911ffea validation, docs: close the wide-compare review gaps (#215)
A CPU test checks that the production compiler still rejects all 28
forms, and each 64-bit form gains a rejection for v255 as VSRC1 after an
inline integer (dropping that check in the second interpreter now fails
the rejection test). Docs and counts follow.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:50:10 -06:00
elforeign 8f67a9680d scripts, changelog: VOP1 integer oracle; skip its Metal test until the translator lands (#215)
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:46:52 -06:00
elforeign 74af0d8eb9 scripts: skip the wide-compare Metal oracle in the GPU gate until the translator lands (#215)
The ignored native Metal test fails today because the translator rejects
the 16- and 64-bit compares; scripts/test-gpu.sh runs every ignored
semantic-review test, so it skips this one by name.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:46:52 -06:00
elforeign 0b00fb378d docs, validation: document the 16-bit and 64-bit compare oracle subset (#215)
vector-compare.md gains section 2a for the subset the reference
interpreters accept, and no longer says the reference rejects these
forms. vopc_f_t.rs stops listing the 64-bit F/T opcodes as unsupported:
the reference accepts them now, and the check passed only because v2 of
the v[1:2] pair was uninitialized.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:44:01 -06:00
elforeign d5437c1c18 Merge remote-tracking branch 'origin/main' into task/215-vopc-wide-oracle 2026-11-24 08:43:19 -06:00
elforeign 8b0b62a771 validation: close SOPK test gaps from review
Compares now run with both SCC values before, so an implementation that
only flips SCC fails. New checks: a taken s_cmovk_i32 initializes an
unwritten SDST, s_cmovk_i32 without SCC is refused, the forms write no
SGPR but SDST, and s_waitcnt_vscnt null with a nonzero count is refused.
The opcode comment now lists 17 and 20 as unlisted.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:40:55 -06:00
elforeign 9500ed17e5 ref, validation: independent oracle for the SOPK integer forms
Adds s_movk_i32, s_cmovk_i32, s_cmpk_{eq,lg,gt,ge,lt,le}_{i32,u32},
s_addk_i32 and s_mulk_i32 (guide 12.2, 13.1.2) to the reference
interpreter and the second interpreter, each written from the guide
separately, and a guide-derived test that runs both. SDST is limited to
s0-s105; every other SOPK opcode and SDST stays refused.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:37:00 -06:00
elforeign f4c4b5f9d0 Merge remote-tracking branch 'origin/main' into task/215-vop1-int-oracle
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:29:04 -06:00
elforeign c5238a83a3 Tighten the VOP1 checks the review found weak
A fresh review showed that the swap max-register cases saw only one of
the two writes, the flag cases could not see a VCC rotation, the swap
SRC0 sweep could pass on a failed SGPR read, and no case read or wrote a
VGPR with a load outstanding. Add the other-register reads, a partial
VCC_LO seed, a decode-level check of every swap SRC0 selector and twelve
pending-load rejections.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:28:45 -06:00
elforeign 22e1864b36 Clarify what the VOP1 rejection sweeps establish
The guide-only cross-check noted that the opcode sweep cannot isolate why
a form is refused and that the SRC0 rejections are the accepted subset,
not a guide limit; say so. Also name the bit-position pattern type for
clippy.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:24:53 -06:00
elforeign 175335e1f6 Add a guide-derived oracle for the VOP1 integer forms
Issue #215 slice S12: the reference and the second interpreter now decode
and run v_not_b32, v_bfrev_b32, v_ffbh_u32, v_ffbl_b32, v_ffbh_i32 (SRC0:
SGPR, vcc_lo, inline integer, literal or VGPR) and v_swap_b32 (VGPR SRC0),
all _e32, from the RDNA 2 ISA guide section 12.8 pseudocode. The new
vop1_integer test checks both against expectations written separately from
the guide, and checks that both refuse the other SRC0 selectors and every
other VOP1 opcode at the same word. Float forms, lane-crossing and
M0-relative forms, and V_SAT_PK_U8_I16 (its guide entry does not define
sat8) stay unsupported.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:22:51 -06:00
elforeign b37a859cd6 isa, decoder, shader: Wave32 VOPC integer compares through the semantic registry, plus v_cmp_{f,t}_{i32,u32} (#215) (#295)
* isa, decoder, shader: move the twelve Wave32 VOPC compares into the semantic registry (#215)

The v_cmp_{lt,eq,le,gt,ne,ge}_{i32,u32}_e32 forms from #239 are now
registry data under a new vopc_vcc operand rule (SRC0 a vector_source,
VSRC1 a VGPR, destination implicitly vcc_lo). The decoder dispatches them
through the generated VectorCompareOp instead of a hand-written opcode
table, and the hand-written VectorCompareOp struct in xenora-isa is gone.
No behaviour change: goldens, known answers and the LLVM oracle are
unchanged.

The vocabulary gains vcc = "lane_mask", allowed exactly for the VOPC rule
and required to account for the XML's implicit VCC output, and wave =
"wave32", now allowed exactly for that rule (its one entry point is the
Wave32 compute fixture ABI) and still rejected elsewhere. exec must stay
unchanged, so v_cmpx cannot be declared.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>

* test(vopc): independent oracle for v_cmp_{f,t}_{i32,u32}_e32 (#215)

The registry stage adds the four constant 32-bit integer VOPC compares,
which nothing could check: the reference and the second interpreter both
rejected them. Derive them from the RDNA 2 guide only (12.9 Table 61:
D = 0 / D = 1; 3.9: VCC[n] = EXEC[n] & test, fully written) under the
#239 Wave32 contract, so T writes EXEC_LO masked to existing lanes, F
writes 0, and sources keep the allowlist and initialization rules.

vopc_f_t.rs covers every SRC0 class, aliasing, full, partial and empty
EXEC with a stale VCC_LO, a partial final wave, s_cbranch_vccz on both
edges and the rejections; the native Metal part is ignored until the
translator side lands. known_answers no longer expects F and T to be
rejected.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>

* isa, decoder, shader: v_cmp_{f,t}_{i32,u32} through the semantic registry (#215)

Adds the four constant Wave32 VOPC compares as registry forms with the
relations f and t (guide Table 59 offsets 0 and 7), valid only for the
vopc_vcc rule, backed by false_b32/true_b32 primitives. They keep the
#239 contract: sources are decoded and checked as for every compare,
VCC_LO := EXEC & existing lanes & test, fully written, and the mask is
lane-derived. Their MSL wave mask reads no operand bits. A new
LLVM-assembled fixture covers F clearing a stale VCC, T and F under
partial EXEC, T reading vcc_lo and runtime s_cbranch_vccz on both
results; the oracle merged from task/215-vopc-oracle supplies the
reference side.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>

* test(vopc): cover EXEC preservation, known-0 branch, pending loads (#215)

Review found four ways F/T could be wrong and still pass: clearing EXEC
under partial EXEC, treating the empty-EXEC result as lane-derived,
ignoring an outstanding load on a source, and decoding opcode 200. Add a
case or rejection for each; each was shown failing with that break.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>

* isa: check VOPC relations against the Table 59 opcode layout and the VCC write direction (#215)

Review fixes. A VOPC compare's opcode must equal its group base (128
signed, 192 unsigned) plus its relation's Table 59 offset, so a row such
as V_CMP_T_I32 with relation f is rejected instead of lowering to false.
A lane_mask form now needs exactly one fieldless XML VCC operand that is
written and not read. The generator tests render the real F/T rows, and
the vector-compare doc names the file each count comes from.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>

---------

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:22:04 -06:00
elforeign 06d895ec23 test(vopc): close review gaps in the 64-bit oracle (#215)
The fresh review found the independent interpreter accepted v255 as a
VSRC1 pair base when SRC0 was an SGPR pair (and overflowed at run time),
and that four checks could pass with a wrong implementation: overlapping
and highest pairs decided by the high dword alone, a second wave equal
to the first, and a known-zero vccz branch over an unread SGPR. Fix the
interpreter, add both rejections, and make each case observable.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:14:28 -06:00
elforeign 01a8445412 test(vopc): check pair halves with no active lane; tighten guide notes (#215)
A reference that checked only the low register of a 64-bit pair still
passed every case, because an executing lane reads both halves anyway.
The difference shows only when EXEC_LO enables just absent lanes, so add
that rejection per 64-bit form. The guide-only cross-check also pointed
out that odd SGPR bases are illegal per 3.6.3 (not unsettled), that the
negative inline bit patterns are a reading of Table 20, and that "empty
EXEC reads nothing" is the contract's rule; say so in the module notes.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:10:26 -06:00
elforeign 93d26d6e45 test(vopc): independent oracle for 16- and 64-bit integer compares (#215)
B1 adds v_cmp_{lt..ge}_{i16,u16}_e32 and v_cmp_{f..t}_{i64,u64}_e32 as
registry forms. To check them without trusting the registry, decoder or
shader, both interpreters now decode and evaluate the 28 forms from the
RDNA 2 guide alone: 16-bit forms read bits 15:0 and ignore the upper
half, 64-bit forms read register pairs low dword first, inline integers
keep their value at the operand width, and VCC_LO = EXEC & lanes & test.
Points the guide does not settle (literals, vcc as a pair, odd SGPR
bases, v255 as a pair base) are rejected. vopc_wide.rs derives the
expected lanes per form: 6212 cases on each interpreter, 1128 rejections.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:08:00 -06:00
elforeign 8909b99ece test(vopc): cover EXEC preservation, known-0 branch, pending loads (#215)
Review found four ways F/T could be wrong and still pass: clearing EXEC
under partial EXEC, treating the empty-EXEC result as lane-derived,
ignoring an outstanding load on a source, and decoding opcode 200. Add a
case or rejection for each; each was shown failing with that break.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 07:39:24 -06:00
elforeign 1ac4f82d7a test(vopc): independent oracle for v_cmp_{f,t}_{i32,u32}_e32 (#215)
The registry stage adds the four constant 32-bit integer VOPC compares,
which nothing could check: the reference and the second interpreter both
rejected them. Derive them from the RDNA 2 guide only (12.9 Table 61:
D = 0 / D = 1; 3.9: VCC[n] = EXEC[n] & test, fully written) under the
#239 Wave32 contract, so T writes EXEC_LO masked to existing lanes, F
writes 0, and sources keep the allowlist and initialization rules.

vopc_f_t.rs covers every SRC0 class, aliasing, full, partial and empty
EXEC with a stale VCC_LO, a partial final wave, s_cbranch_vccz on both
edges and the rejections; the native Metal part is ignored until the
translator side lands. known_answers no longer expects F and T to be
rejected.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 07:34:38 -06:00
elforeign ad424d690a isa, validation: reject undeclared implicit XML operands; runtime vcc_lo for VOP2 (#215)
Review follow-up: the generator now rejects a form whose XML lists an
implicit operand other than SCC (for example the VCC carry of
v_add_co_ci_u32 or the VCC select of v_cndmask_b32), since the
vocabulary can only declare VCC and EXEC unchanged. New known-answer
tests read a lane-derived vcc_lo as VOP2 SRC0 (also on native Metal)
and require the forms to be refused inside a runtime s_cbranch_vccz skip
region. The LLVM comparison normalises inline SRC0 for the registry VOP2
forms as for VOPC; docs and counts follow.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 05:11:31 -06:00
elforeign 5ba0496c63 isa, decoder, shader: twelve VOP2 vector integer forms through the semantic registry (#215)
Adds v_mul_{i32_i24,hi_i32_i24,u32_u24,hi_u32_u24}, v_min/max_{i32,u32},
v_xnor_b32 and v_{add,sub,subrev}_nc_u32 as registry data under a new
vop2_vgpr operand rule (VGPR destination; SRC0 a VGPR, s0-s105, vcc_lo,
an inline integer or a literal; VGPR VSRC1). Vector forms select a
per-lane VectorBinary from their declared operation and signedness, and
the shader lowers each VectorBinary through one typed MSL template; SUBREV
declares source_order = reversed. Variant names are now unique per
generated enum. The decoder shares the VOPC SRC0 decode, and the
translator binds a result to the slot it was pushed at, since operand
constants may now be pushed first. The oracle merged from
task/215-vop2-oracle supplies the reference side; a new LLVM-assembled
fixture computes every lane from its own input.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 05:06:48 -06:00
elforeign aef29ff65d Merge branch 'task/215-vop2-oracle' into task/215-vop2 2026-11-24 04:57:47 -06:00
elforeign 3392c226ce validation: SCC stays unset across SOP2 forms that do not write it; compiler rejections at the SOP2 word (#215)
Review follow-up: four programs run BFM, MUL or MUL_HI and then CSELECT
with SCC never written, and every interpreter and the compiler must
refuse the CSELECT. The native test now also requires the compiler to
reject each program at the same word as the interpreters, so a later
failure cannot stand in (shown by a translator that turns an unset SCC
into false, which only this check catches).

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:56:28 -06:00
elforeign 72bf5f7e32 validation: VOP2 integer review gaps: reserved SRC0, literal under empty EXEC, VCC under partial EXEC (#215)
A Codex review found three ways a defective interpreter would still pass:
selectors 209-232 were never refused (a negative inline range one too
long passed), the literal was never decoded with EXEC = 0, and VCC was
only checked under full EXEC, so a VCC write limited to active lanes
went unseen. Each now has cases; a reference accepting selector 209 and
one ANDing VCC_LO with EXEC were both shown failing.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:55:51 -06:00
elforeign a6d354fb2a validation: rustfmt the VOP2 integer oracle (#215)
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:52:53 -06:00
elforeign 00f79c10d2 isa, decoder, shader: sixteen SOP2 integer forms through the semantic registry (#215)
Adds s_min/max_{i32,u32}, s_cselect_b32, s_bfm_b32, s_mul_i32,
s_mul_hi_{u32,i32}, s_bfe_{u32,i32}, s_absdiff_i32 and
s_lshl1..4_add_u32 as registry data over new shared primitives. The
vocabulary gains a selected_src0 SCC effect (min and max: S0 won the
strict compare), the select's SCC input (carry_in = scc, required for
cselect), a declared shift_amount for the shift-and-add forms, and a
check that BFE's S1 descriptor is unsigned in the XML. The generated
ScalarAluOp::evaluate now returns an optional SCC, so forms whose XML
shows no SCC output leave it unchanged in the translator. The decoder
picks them up through the generated SOP2 table; the oracle merged from
task/215-sop2-arith-oracle supplies the reference side. A new
LLVM-assembled fixture chains all sixteen.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:51:33 -06:00
elforeign 95a8c61f1b ref, validation: twelve VOP2 integer forms in both interpreters (#215)
The VOP2 decode in both interpreters accepted only a VGPR as SRC0, so
the 24-bit multiplies, MIN/MAX, XNOR and the no-carry add/sub forms
also take an SGPR, vcc_lo, an inline integer or a literal through the
VOPC source decode, now shared. The reference uses exact i64
arithmetic; the second interpreter a shift-and-add multiplier with
Euclidean division for the high half, sign-flipped unsigned order for
MIN/MAX and the ripple adder for add and subtract. Neither writes VCC
or SCC, and inactive lanes keep VDST. The earlier hand-written VOP2
forms keep their VGPR-only SRC0.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:51:02 -06:00
elforeign 31627363f1 validation: guide-derived per-lane oracle for twelve VOP2 integer forms (#215)
Expected values for the 24-bit multiplies, MIN/MAX, XNOR and the no-carry
add/sub forms come from the RDNA 2 guide section 12.7 only, checked per
lane over boundary operands, every SRC0 kind, aliasing, v255, partial and
empty EXEC, a partial final wave and VCC/SCC seeds. Both interpreters
reject these forms today, so the reference and independent tests fail
until they gain the forms.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:49:32 -06:00
elforeign 84b6fb4d50 Merge branch 'task/215-sop2-arith-oracle' into task/215-sop2-arith 2026-11-24 04:41:40 -06:00
elforeign b98380c1b0 Merge branch 'task/215-sop2-arith-oracle' into task/215-vop2-oracle 2026-11-24 04:41:22 -06:00
elforeign 0e9211cd42 validation: s105 operands for the SOP2 integer forms; s_min_i32 is no longer an unsupported example (#215)
A review found that every passing sop2_arith case wrote s8-s10, so an
interpreter refusing a high destination would pass; s105 now appears as
destination, either source and all three. known_answers used s_min_i32
as an opcode outside the subset; it is supported now, so s_cselect_b64
takes its place.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:38:51 -06:00
elforeign c41e034fa1 ref, validation: 16 SOP2 integer forms in both interpreters (#215)
xenora_ref and independent_ref now run s_min/max_{i32,u32},
s_cselect_b32, s_bfm_b32, s_mul_i32, s_bfe_{u32,i32}, s_absdiff_i32,
s_lshl1..4_add_u32 and s_mul_hi_{u32,i32} as the RDNA 2 ISA guide 12.1
describes, so the guide-derived sop2_arith expectations pass on both.
CSELECT reads SCC and is refused when SCC was never written; CSELECT,
BFM, MUL_I32 and MUL_HI leave SCC unchanged. The second interpreter
uses bit loops, a ripple adder and shift-and-add products rather than
the reference's host arithmetic.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:36:31 -06:00
elforeign a2c696b551 validation: guide-derived expectations for 16 SOP2 integer forms (#215)
Expected D and SCC for s_min/max_{i32,u32}, s_cselect_b32, s_bfm_b32,
s_mul_i32, s_bfe_{u32,i32}, s_absdiff_i32, s_lshl1..4_add_u32 and
s_mul_hi_{u32,i32}, written from the RDNA 2 ISA guide (12.1 and the
section 5 tables) before either interpreter supports them, so both fail
here. A separate guide-only table agrees on all 5086 shared inputs.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:34:26 -06:00
elforeign e6eece6983 validation: require the compiler's SOP1 rejections at the SOP1 word (#215)
Review follow-up: the native test only checked that compilation failed,
so a regressed destination guard still passed when a later instruction
read an uninitialized SGPR (shown by allowing vcc_lo as a destination).
It now requires a decode error at the SOP1 offset. Also check that no
registry form duplicates a hand-written decoder form.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:30:44 -06:00
elforeign 2e0e5a36f6 isa, decoder, shader: SOP1 unary integer forms through the semantic registry (#215)
Adds eleven SOP1 forms as registry data: complement, bit reverse, bit
counts, find-first and find-last searches, sign extension and absolute
value. Sign extension declares source_bits, which the generator checks
against the XML's 8- and 16-bit source operands; forms whose XML shows
no SCC output must declare SCC unchanged. The decoder dispatches them
through the generated SOP1 table after s_mov_b32, and the translator
folds them with ScalarUnaryOp::evaluate. The separately written oracle
from task/215-sop1-oracle supplies the reference side.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:27:14 -06:00
elforeign b96511bfc5 validation: cover s105 in the SOP1 unary cases (#215)
Review found that every register operand was s8 or s10, so a decoder that
dropped the top bit of SDST or SSRC0 would pass. s105 now appears as source,
destination and both.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:22:34 -06:00
elforeign 84bb80d910 ref, validation: evaluate eleven SOP1 unary forms in both interpreters (#215)
Both interpreters now run s_not/brev/bcnt0/bcnt1/ff0/ff1/flbit(_b32)/
sext_i8/sext_i16/abs with SDST s0-s105. Not-found searches return -1,
s_flbit_i32 returns -1 for 0 and -1, abs keeps 0x80000000, and only NOT,
BCNT0, BCNT1 and ABS write SCC (D != 0). The reference uses host bit
intrinsics; the second interpreter works from an explicit bit array and
arithmetic, so they do not share an evaluation path.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:20:56 -06:00
elforeign b705104403 validation: guide-derived expectations for eleven SOP1 unary forms (#215)
D and SCC for s_not/brev/bcnt0/bcnt1/ff0/ff1/flbit(_b32)/sext_i8/sext_i16/abs
are written from the RDNA 2 ISA guide (12.3 pseudocode and examples, Tables 12
and 14 for SCC) before either interpreter implements them.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:19:31 -06:00
elforeign cd59e081d9 isa, decoder: SOPC integer compares through the semantic registry (#215 stage D)
Adds a compare operation with a declared relation and the sopc_scalar
operand rule, so all twelve s_cmp_*_{i32,u32} forms are registry data.
The decoder dispatches them through the generated OP table and the
translator resolves SCC with ScalarCompareOp::test; the hand-written
s_cmp_eq_u32 path and its opcode constant are gone. A new LLVM-assembled
fixture records every compare's SCC, and the separately written oracle
from task/215-stage-d-oracle supplies the reference side.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:16:09 -06:00
elforeign 3f710928af validation: close four blind spots in the stage D cases (#215)
Review found cases that a broken implementation would still pass: an inline
or literal value that compares like its neighbour against both registers, an
extra write to the SCC-setting scratch SGPR s12, and rejections accepted at
any offset. Inline and literal cases now also compare a value with itself,
s12 is read back, and every rejection must happen at the SOPC word.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:10:00 -06:00
elforeign 2fdf01fbb3 ref, validation: evaluate the twelve SOPC integer compares in both interpreters (#215)
Both interpreters now run s_cmp_{eq,lg,gt,ge,lt,le}_{i32,u32}: SCC = S0 <rel>
S1, signed for opcodes 0-5 and unsigned for 6-11, with no SGPR written. The
reference keeps Op::CompareEqual for the two EQ opcodes (its public shape is
used by other crates' tests) and adds Op::ScalarCompare for the rest, reusing
the VOPC relation; the second interpreter orders signed operands by flipping
the sign bits, so the two do not share the comparison code.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:08:32 -06:00
elforeign 705b074a08 validation: guide-derived expectations for the stage D scalar compares (#215)
SCC for s_cmp_{eq,lg,gt,ge,lt,le}_{i32,u32} is written from the RDNA 2 ISA
guide (12.4, 13.1.4, 5.3) before either interpreter implements the new forms,
with cases for both branch edges, unchanged SGPRs and rejected operands.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:05:59 -06:00
elforeign 8d53d82981 Merge branch 'task/215-stage-c-oracle' into task/215-stage-c 2026-11-24 04:03:01 -06:00
elforeign ba2cfc2a00 validation: close two blind spots in the stage C cases (#215)
Review found that one register operand per inline constant hides some wrong
inline values (ANDN2 with s8 = 0x80000f0f cannot tell 16 from 0), and that the
odd-opcode check used a misaligned SGPR pair. Each inline now runs against a
word and its complement, and the 64-bit neighbours read aligned pairs.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:02:10 -06:00
elforeign b13ab327f2 ref, validation: evaluate the stage C SOP2 forms in both interpreters (#215)
The reference interpreter and the second, independent interpreter now run
s_andn2/orn2/nand/nor/xnor_b32, s_lshl/lshr_b32 and s_ashr_i32 per the RDNA 2
guide: shifts use only S1[4:0] and every form sets SCC = (D != 0). The two use
different arithmetic (host bit ops vs per-bit and power-of-two evaluation),
so they cannot share a mistake with each other or with the expectations.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 04:00:28 -06:00
elforeign e7795d0e5a validation: guide-derived expectations for the stage C SOP2 forms (#215)
Expected D and SCC for s_andn2/orn2/nand/nor/xnor_b32, s_lshl/lshr_b32 and
s_ashr_i32 are written from the RDNA 2 ISA guide (12.1, 5.3) before either
interpreter implements them, so the implementation cannot shape the oracle.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 03:57:55 -06:00
elforeign ff191d89bd isa: declare eight more SOP2 logical and shift forms in the registry (#215 stage C, WIP)
Adds andn2, orn2, nand, nor, xnor, lshl, lshr and ashr as registry
primitives with a declared shift-count width that the generator applies
as a mask and checks against the XML's unsigned count operand. The forms
reach the decoder and translator through the generated dispatch with no
per-form Rust. The independent oracle side lands separately.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 03:55:00 -06:00