mirror of
https://github.com/odin-lang/Odin.git
synced 2026-09-02 02:03:35 +00:00
SME's outer products take five -- `smopa za0.s, p0/m, p1/m, z0.b, z1.b` -- and Instruction held four, so the 14 forms in that family could not be represented at all, let alone printed. They named one vector where the instruction multiplies two. Five Operands is 55 bytes, which is odd, so Mnemonic's alignment costs one more; three bytes of padding still land Instruction on exactly one 64-byte cache line, as before. Encoding and Decode_Entry each grow by two. The tile number was wrong as well: it sits in the low bits, as wide as the element size leaves room for -- three for .d down to none for .b -- not at bits 23:22 where the encoding read it. Every MOP form named a tile it was not writing. Note for anyone regenerating: tablegen re-emits tables.odin from a template inside gen.odin, so a struct change there has to go in the template, and the package has to compile before tablegen can run at all. Same for the builders. SVE/SME2 against llvm-mc: 697 byte-exact and 0 mismatched, of 704. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UmHLRF11EoWwNWCJ7JGaA
64 lines
2.5 KiB
Odin
64 lines
2.5 KiB
Odin
// rexcode · Brendan Punsky (dotbmp@github), original author
|
|
|
|
package rexcode_arm64
|
|
|
|
// =============================================================================
|
|
// GENERATED FILE - DO NOT EDIT
|
|
// =============================================================================
|
|
//
|
|
// Loads the flat binary encode/decode tables into @(rodata). Produced by tablegen:
|
|
//
|
|
// odin run tablegen # Stage A: ENCODING_TABLE -> generated/ + this file
|
|
// odin run tablegen/generated # Stage B: typed Odin literals -> tables/*.bin
|
|
//
|
|
// The .bin blobs are raw, host-endian, packed struct images.
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Subsidiary table types (generated scaffolding)
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Companion run index: ENCODE_RUNS[mnemonic] -> contiguous run in ENCODE_FORMS.
|
|
Encode_Run :: struct {
|
|
start: u32,
|
|
count: u32,
|
|
}
|
|
|
|
Decode_Entry :: struct #packed {
|
|
mnemonic: Mnemonic, // 2
|
|
ops: [5]Operand_Type, // 4
|
|
enc: [5]Operand_Encoding, // 4
|
|
bits: u32, // 4
|
|
mask: u32, // 4
|
|
feature: Feature, // 1
|
|
flags: Encoding_Flags, // 1
|
|
}
|
|
#assert(size_of(Decode_Entry) == 22)
|
|
|
|
Decode_Index :: struct #packed {
|
|
start: u16,
|
|
count: u16,
|
|
}
|
|
#assert(size_of(Decode_Index) == 4)
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Loaded tables (rodata, embedded from tables/*.bin at compile time)
|
|
// -----------------------------------------------------------------------------
|
|
|
|
@(rodata) ENCODE_FORMS := #load("tables/arm64.encode_forms.bin", []Encoding)
|
|
@(rodata) CLOBBER_FORMS := #load("tables/arm64.clobber_forms.bin", []Clobber)
|
|
@(rodata) ENCODE_RUNS := #load("tables/arm64.encode_runs.bin", []Encode_Run)
|
|
@(rodata) DECODE_ENTRIES := #load("tables/arm64.entries.bin", []Decode_Entry)
|
|
@(rodata) DECODE_INDEX_OP0 := #load("tables/arm64.idx_op0.bin", []Decode_Index)
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Accessors
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Per-mnemonic encode forms: the run of ENCODE_FORMS belonging to `m`.
|
|
// Replaces the old ENCODING_TABLE[m] slice; the returned view is into rodata.
|
|
@(private, require_results)
|
|
encoding_forms :: #force_inline proc "contextless" (m: Mnemonic) -> []Encoding {
|
|
r := ENCODE_RUNS[u16(m)]
|
|
return ENCODE_FORMS[r.start:][:r.count]
|
|
}
|