Compare commits

..
Author SHA1 Message Date
sahib453 c1cea65e17 docs: take RCL and RCR off the rejected-on-purpose list (#121)
The instruction registry document listed RCL and RCR among the forms
rejected on purpose. This branch implements them, so the list no longer
names them. SHLD and SHRD stay on it.

Signed-off-by: sahib453 <117431595+sahib453@users.noreply.github.com>
2026-11-25 00:44:28 +05:30
sahib453 4d44765363 loader: add RCL and RCR, the rotates through carry (#121)
Both engines refused RCL and RCR (group 2, digits 2 and 3) as illegal
instructions. They are now declared in the x86 registry and run on the
shared semantics for 8-, 16-, 32- and 64-bit register and memory
operands, with a count of one, CL or an immediate.

- instructions.toml, x86_table.rs (generated): the two operations, with
  CF as an input.
- x86_exec.rs: rotation over the operand plus CF. The masked count is
  reduced modulo the operand width plus one, CF takes the last bit
  rotated out, and OF is set only for a count of one.
- cpu_known_answers.rs: fourteen SDM-derived cases move from refused to
  verified, and the shift sweep runs both instructions at every width.
- tests/x86: 80 assembled RCL and RCR instructions, with a single-step
  reference in x86_integer.rs. `rcl al, 1` leaves the rejected list.

Nothing is lowered to ARM64. SHLD and SHRD stay rejected.

Signed-off-by: sahib453 <117431595+sahib453@users.noreply.github.com>
2026-11-24 23:54:26 +05:30
12 changed files with 170 additions and 50 deletions

No files matched your search

+1 -3
View File
@@ -41,8 +41,6 @@ jobs:
python3 crates/isa/generate_semantics.py --check
python3 scripts/audit/semantic_coverage.py --check
python3 scripts/audit/status.py --check
# The generated status check must not depend on the host locale encoding.
LC_ALL=C PYTHONCOERCECLOCALE=0 PYTHONUTF8=0 python3 scripts/audit/status.py --check
for fixture in x2 x3 x4; do
python3 "experiments/x1/fixtures/$fixture.py" --check || exit 1
done
@@ -67,7 +65,7 @@ jobs:
cargo test --locked --workspace
cargo test --locked --manifest-path experiments/x1/Cargo.toml
scripts/audit/dependencies.sh
LC_ALL=C PYTHONCOERCECLOCALE=0 PYTHONUTF8=0 scripts/audit/claims.sh
scripts/audit/claims.sh
- name: Inspect native CLI
run: |
cargo build --locked -p xenora
+1 -1
View File
@@ -19,6 +19,7 @@ remains unsupported.
### Added
- Added the VOP3A (`_e64`) encodings of eleven gfx1030 VOP2 integer forms (`v_mul_{i32_i24,hi_i32_i24,u32_u24,hi_u32_u24}`, `v_{min,max}_{i32,u32}`, `v_xnor_b32`, `v_sub_nc_u32`, `v_subrev_nc_u32`) and of the sixteen Wave32 integer compares (explicit SGPR mask destination, `s_cbranch_vccz` through `vcc_lo`, a translation error for reads of runtime-only SGPR results) as semantic-registry encoding variants, with VGPR sources only. New fixtures `vop3-integer` and `vop3-compare` with IR and MSL goldens, and an independent guide-derived oracle (`tests/validation/tests/vop3_{integer,compare}.rs`) that agrees on both reference interpreters and on native Metal. Part of #215.
- Added guest texture binding through D3D12-style descriptor tables (#303): shader-visible CBV_SRV_UAV and sampler heaps, `CreateShaderResourceView` for one-level RGBA8 and BC1 2D textures, a point/clamp `CreateSampler`, a root signature with one pixel-stage SRV table and one sampler table, and `SetDescriptorHeaps`/`SetGraphicsRootDescriptorTable` in `crates/loader/src/graphics.rs`, plus `NativeCompute::render_rgba8_sampled_bc1`. Verified locally on an Apple M5 Pro under Metal validation: a guest draw with the translated `image_sample_lz` pixel stage matches the software reference and hand-derived images on 16 of 16 pixels for two RGBA8 textures and 64 of 64 for an 8×8 BC1 texture. A wrong descriptor slot changes the image, off-centre and out-of-range coordinates point-sample with clamping, and a rejected binding, draw shape or resource state never reaches the backend. The software reference samples BC1 with the spec-exact decoder, while Apple's hardware rounds BC1's interpolated palette entries differently (171/84 against 170/85), so the BC1 fixtures use only endpoint colours. Not yet reachable from guest imports. Not yet independently accepted.
- Added RCL and RCR, the rotates through the carry flag, for 8-, 16-, 32- and 64-bit register and memory operands with a count of one, CL or an immediate (part of #121). The count is masked to five bits (six for 64-bit operands) and then reduced modulo 9 or 17 for 8- and 16-bit operands; a masked count of zero changes nothing, CF receives the last bit rotated out, and OF is set only for a count of one. Both engines run the shared semantics; nothing is lowered to ARM64. Fourteen SDM-derived cases already in `cpu_known_answers.rs` moved from refused to verified, and its shift sweep now runs both instructions at every width, count and carry against its bit-loop model. `tests/x86/integer.txt` gains 80 assembled RCL and RCR instructions, checked by the single-step reference in `x86_integer.rs`. SHLD and SHRD stay rejected. Not compared with x86 hardware; awaiting independent review.
- Added four Wave32 gfx1030 VOP2 select and carry forms through the semantic registry. Conditional select, add with carry and both subtract orders with borrow use a per-lane VCC bit and have a guide-derived oracle that passes on both CPU interpreters and on native Metal (local Apple M5, API and shader validation); independent acceptance is pending. Part of #215.
- Added decoding and Metal shader translation for twelve Wave32 VOPC 16-bit integer compares (#215). The signed and unsigned forms compare the low 16 bits of each source and write the Wave32 VCC mask. CPU verification covers 1,572 compiler acceptance cases and 408 rejections from the guide-derived oracle, which also passes on native Metal (1,572 cases in 1,420 programs on a local Apple M5 under API and shader validation); acceptance is pending.
- Added MOVS and STOS for 8- to 64-bit elements, with and without REP, and the direction flag with CLD and STD (#129). A REP form runs one element per step and stays on the instruction until RCX is zero, so every element counts against the step budget, a repeat can stop part-way and resume, a zero count touches nothing, and a fault keeps the elements already done with RSI, RDI and RCX at the one that faulted. An FS or GS override applies to the MOVS source only. Both engines run these on the shared semantics with no bulk-copy path, so large copies are slow. LODS, CMPS, SCAS, REPE, REPNE and the address-size override stay rejected. Fourteen SDM-derived cases already in `cpu_known_answers.rs` moved from refused to verified, and `tests/cpu_rep.rs` adds a byte-array model over every form, direction and count; not compared with x86 hardware and awaiting independent review.
@@ -196,7 +197,6 @@ remains unsupported.
- Fixed 32-bit guest stores and loads in the native DBT (MOV 89/8B and C7 /0), which accessed eight bytes: stores overwrote the next four guest bytes and accesses at the end of a mapping faulted. RIP-relative operands of byte moves and extensions, which were read as RBP-relative, and LEA with a segment prefix, which added the segment base, are fixed too.
- Fixed an x86 prefix-length test that read an untracked fuzz artifact and so failed on every fresh checkout; its input is now inline.
- Fixed agent-queue `apply_actions` crashing on comment-only decisions (claim refusals) by skipping no-op `gh issue edit` calls; accept `summary --now` after the subcommand; grant the audit job `pull-requests: read` so live audits can list open PRs (issue #180).
- Fixed `scripts/audit/status.py` and the Python embedded in `scripts/audit/claims.sh` reading and writing tracked files in the process locale encoding instead of UTF-8: under an ASCII or cp1252 locale the status check crashed on `docs/claims.toml` or reported a spurious `xenora-progress.svg` difference. Both scripts now pass `encoding="utf-8"`, as the rest of `scripts/` does, the two write sites also pin `newline="\n"` so a Windows host cannot turn tracked LF files into CRLF when it regenerates them, and CI runs the two checks again under a non-UTF-8 locale so the requirement stays enforced.
- Generated CRT adapters now report unsupported calls when the required guest ABI or runtime behavior is missing.
+21 -2
View File
@@ -241,6 +241,25 @@ fn shift(op: Op, value: u64, count: u64, size: u8, old: RFlags) -> Option<(u64,
flags.cf = signed >> (count - 1) & 1 != 0;
(signed >> count) as u64
}
Op::Rcl | Op::Rcr => {
// The carry flag is one more bit above the operand, so the rotation
// is over `bits + 1` positions and the count is reduced modulo that.
let width = bits + 1;
let ring = wide | u128::from(old.cf) << bits;
let by = count % width;
let left = if op == Op::Rcl {
by
} else {
(width - by) % width
};
let rotated = if left == 0 {
ring
} else {
ring << left | ring >> (width - left)
};
flags.cf = rotated >> bits & 1 != 0;
rotated as u64
}
_ => {
let by = count % bits;
let left = if op == Op::Rol {
@@ -268,7 +287,7 @@ fn shift(op: Op, value: u64, count: u64, size: u8, old: RFlags) -> Option<(u64,
// OF is defined only for a count of one.
if count == 1 {
flags.of = match op {
Op::Shl | Op::Rol => (result & top != 0) != flags.cf,
Op::Shl | Op::Rol | Op::Rcl => (result & top != 0) != flags.cf,
Op::Shr => value & top != 0,
Op::Sar => false,
_ => (result & top != 0) != (result & (top >> 1) != 0),
@@ -419,7 +438,7 @@ pub fn execute(
if negative { mask(size) } else { 0 },
);
}
Op::Rol | Op::Ror | Op::Shl | Op::Shr | Op::Sar => {
Op::Rol | Op::Ror | Op::Rcl | Op::Rcr | Op::Shl | Op::Shr | Op::Sar => {
let (a, count) = operands(cpu, memory, insn)?;
match shift(insn.op, a, count, size, cpu.flags) {
Some((value, flags)) => {
+38 -8
View File
@@ -34,6 +34,8 @@ pub enum Op {
Cdq,
Rol,
Ror,
Rcl,
Rcr,
Shl,
Shr,
Sar,
@@ -209,7 +211,7 @@ pub enum Op {
}
impl Op {
pub const ALL: &[Op] = &[Op::Add, Op::Or, Op::Adc, Op::Sbb, Op::And, Op::Sub, Op::Xor, Op::Cmp, Op::Test, Op::Inc, Op::Dec, Op::Neg, Op::Not, Op::Mov, Op::Movzx, Op::Movsx, Op::Movsxd, Op::Lea, Op::Xchg, Op::Xadd, Op::Cmpxchg, Op::Bswap, Op::Cwde, Op::Cdq, Op::Rol, Op::Ror, Op::Shl, Op::Shr, Op::Sar, Op::Mul, Op::Imul, Op::Imul2, Op::Div, Op::Idiv, Op::Cmov, Op::Setcc, Op::Bt, Op::Bts, Op::Btr, Op::Btc, Op::Bsf, Op::Bsr, Op::Popcnt, Op::Tzcnt, Op::Lzcnt, Op::Push, Op::Pop, Op::Leave, Op::Call, Op::Jmp, Op::Jcc, Op::Ret, Op::Nop, Op::Hlt, Op::Syscall, Op::Clc, Op::Stc, Op::Cmc, Op::Cpuid, Op::Cld, Op::Std, Op::Movs, Op::Stos, Op::Movaps, Op::Movups, Op::Movdqa, Op::Movdqu, Op::Movntdq, Op::Movntps, Op::Movss, Op::Movsd, Op::Movq, Op::Movd, Op::Movlps, Op::Movhps, Op::Movmskps, Op::Movmskpd, Op::Pmovmskb, Op::Pand, Op::Pandn, Op::Por, Op::Pxor, Op::Punpcklbw, Op::Punpcklwd, Op::Punpckldq, Op::Packsswb, Op::Pcmpgtb, Op::Pcmpgtw, Op::Pcmpgtd, Op::Packuswb, Op::Punpckhbw, Op::Punpckhwd, Op::Punpckhdq, Op::Packssdw, Op::Punpcklqdq, Op::Punpckhqdq, Op::Pcmpeqb, Op::Pcmpeqw, Op::Pcmpeqd, Op::Paddq, Op::Pmullw, Op::Psubusb, Op::Psubusw, Op::Pminub, Op::Paddusb, Op::Paddusw, Op::Pmaxub, Op::Pavgb, Op::Pavgw, Op::Pmulhuw, Op::Pmulhw, Op::Psubsb, Op::Psubsw, Op::Pminsw, Op::Paddsb, Op::Paddsw, Op::Pmaxsw, Op::Pmuludq, Op::Pmaddwd, Op::Psadbw, Op::Psubb, Op::Psubw, Op::Psubd, Op::Psubq, Op::Paddb, Op::Paddw, Op::Paddd, Op::Psrlw, Op::Psraw, Op::Psllw, Op::Psrld, Op::Psrad, Op::Pslld, Op::Psrlq, Op::Psllq, Op::Psrldq, Op::Pslldq, Op::Pshufd, Op::Pshufhw, Op::Pshuflw, Op::Shufps, Op::Shufpd, Op::Pinsrw, Op::Pextrw, Op::Ldmxcsr, Op::Stmxcsr, Op::Sqrtps, Op::Sqrtpd, Op::Sqrtss, Op::Sqrtsd, Op::Addps, Op::Addpd, Op::Addss, Op::Addsd, Op::Mulps, Op::Mulpd, Op::Mulss, Op::Mulsd, Op::Subps, Op::Subpd, Op::Subss, Op::Subsd, Op::Minps, Op::Minpd, Op::Minss, Op::Minsd, Op::Divps, Op::Divpd, Op::Divss, Op::Divsd, Op::Maxps, Op::Maxpd, Op::Maxss, Op::Maxsd, Op::Cmpps, Op::Cmppd, Op::Cmpss, Op::Cmpsd, Op::Ucomiss, Op::Comiss, Op::Ucomisd, Op::Comisd, Op::Cvtps2pd, Op::Cvtpd2ps, Op::Cvtss2sd, Op::Cvtsd2ss, Op::Cvtdq2ps, Op::Cvtps2dq, Op::Cvttps2dq, Op::Cvttpd2dq, Op::Cvtdq2pd, Op::Cvtpd2dq, Op::Cvtsi2ss, Op::Cvttss2si, Op::Cvtss2si, Op::Cvtsi2sd, Op::Cvttsd2si, Op::Cvtsd2si];
pub const ALL: &[Op] = &[Op::Add, Op::Or, Op::Adc, Op::Sbb, Op::And, Op::Sub, Op::Xor, Op::Cmp, Op::Test, Op::Inc, Op::Dec, Op::Neg, Op::Not, Op::Mov, Op::Movzx, Op::Movsx, Op::Movsxd, Op::Lea, Op::Xchg, Op::Xadd, Op::Cmpxchg, Op::Bswap, Op::Cwde, Op::Cdq, Op::Rol, Op::Ror, Op::Rcl, Op::Rcr, Op::Shl, Op::Shr, Op::Sar, Op::Mul, Op::Imul, Op::Imul2, Op::Div, Op::Idiv, Op::Cmov, Op::Setcc, Op::Bt, Op::Bts, Op::Btr, Op::Btc, Op::Bsf, Op::Bsr, Op::Popcnt, Op::Tzcnt, Op::Lzcnt, Op::Push, Op::Pop, Op::Leave, Op::Call, Op::Jmp, Op::Jcc, Op::Ret, Op::Nop, Op::Hlt, Op::Syscall, Op::Clc, Op::Stc, Op::Cmc, Op::Cpuid, Op::Cld, Op::Std, Op::Movs, Op::Stos, Op::Movaps, Op::Movups, Op::Movdqa, Op::Movdqu, Op::Movntdq, Op::Movntps, Op::Movss, Op::Movsd, Op::Movq, Op::Movd, Op::Movlps, Op::Movhps, Op::Movmskps, Op::Movmskpd, Op::Pmovmskb, Op::Pand, Op::Pandn, Op::Por, Op::Pxor, Op::Punpcklbw, Op::Punpcklwd, Op::Punpckldq, Op::Packsswb, Op::Pcmpgtb, Op::Pcmpgtw, Op::Pcmpgtd, Op::Packuswb, Op::Punpckhbw, Op::Punpckhwd, Op::Punpckhdq, Op::Packssdw, Op::Punpcklqdq, Op::Punpckhqdq, Op::Pcmpeqb, Op::Pcmpeqw, Op::Pcmpeqd, Op::Paddq, Op::Pmullw, Op::Psubusb, Op::Psubusw, Op::Pminub, Op::Paddusb, Op::Paddusw, Op::Pmaxub, Op::Pavgb, Op::Pavgw, Op::Pmulhuw, Op::Pmulhw, Op::Psubsb, Op::Psubsw, Op::Pminsw, Op::Paddsb, Op::Paddsw, Op::Pmaxsw, Op::Pmuludq, Op::Pmaddwd, Op::Psadbw, Op::Psubb, Op::Psubw, Op::Psubd, Op::Psubq, Op::Paddb, Op::Paddw, Op::Paddd, Op::Psrlw, Op::Psraw, Op::Psllw, Op::Psrld, Op::Psrad, Op::Pslld, Op::Psrlq, Op::Psllq, Op::Psrldq, Op::Pslldq, Op::Pshufd, Op::Pshufhw, Op::Pshuflw, Op::Shufps, Op::Shufpd, Op::Pinsrw, Op::Pextrw, Op::Ldmxcsr, Op::Stmxcsr, Op::Sqrtps, Op::Sqrtpd, Op::Sqrtss, Op::Sqrtsd, Op::Addps, Op::Addpd, Op::Addss, Op::Addsd, Op::Mulps, Op::Mulpd, Op::Mulss, Op::Mulsd, Op::Subps, Op::Subpd, Op::Subss, Op::Subsd, Op::Minps, Op::Minpd, Op::Minss, Op::Minsd, Op::Divps, Op::Divpd, Op::Divss, Op::Divsd, Op::Maxps, Op::Maxpd, Op::Maxss, Op::Maxsd, Op::Cmpps, Op::Cmppd, Op::Cmpss, Op::Cmpsd, Op::Ucomiss, Op::Comiss, Op::Ucomisd, Op::Comisd, Op::Cvtps2pd, Op::Cvtpd2ps, Op::Cvtss2sd, Op::Cvtsd2ss, Op::Cvtdq2ps, Op::Cvtps2dq, Op::Cvttps2dq, Op::Cvttpd2dq, Op::Cvtdq2pd, Op::Cvtpd2dq, Op::Cvtsi2ss, Op::Cvttss2si, Op::Cvtss2si, Op::Cvtsi2sd, Op::Cvttsd2si, Op::Cvtsd2si];
/// Lower-case mnemonic stem.
pub const fn name(self) -> &'static str {
@@ -240,6 +242,8 @@ impl Op {
Op::Cdq => "cdq",
Op::Rol => "rol",
Op::Ror => "ror",
Op::Rcl => "rcl",
Op::Rcr => "rcr",
Op::Shl => "shl",
Op::Shr => "shr",
Op::Sar => "sar",
@@ -444,6 +448,8 @@ impl Op {
Op::Cdq => 0,
Op::Rol => 0,
Op::Ror => 0,
Op::Rcl => 1,
Op::Rcr => 1,
Op::Shl => 0,
Op::Shr => 0,
Op::Sar => 0,
@@ -648,6 +654,8 @@ impl Op {
Op::Cdq => 0,
Op::Rol => 0,
Op::Ror => 0,
Op::Rcl => 0,
Op::Rcr => 0,
Op::Shl => 0,
Op::Shr => 0,
Op::Sar => 0,
@@ -852,6 +860,8 @@ impl Op {
Op::Cdq => 0,
Op::Rol => 9,
Op::Ror => 9,
Op::Rcl => 9,
Op::Rcr => 9,
Op::Shl => 31,
Op::Shr => 31,
Op::Sar => 31,
@@ -1056,6 +1066,8 @@ impl Op {
Op::Cdq => 0,
Op::Rol => 0,
Op::Ror => 0,
Op::Rcl => 0,
Op::Rcr => 0,
Op::Shl => 32,
Op::Shr => 32,
Op::Sar => 32,
@@ -1260,6 +1272,8 @@ impl Op {
Op::Cdq => false,
Op::Rol => false,
Op::Ror => false,
Op::Rcl => false,
Op::Rcr => false,
Op::Shl => false,
Op::Shr => false,
Op::Sar => false,
@@ -1464,6 +1478,8 @@ impl Op {
Op::Cdq => false,
Op::Rol => false,
Op::Ror => false,
Op::Rcl => false,
Op::Rcr => false,
Op::Shl => false,
Op::Shr => false,
Op::Sar => false,
@@ -1668,6 +1684,8 @@ impl Op {
Op::Cdq => false,
Op::Rol => false,
Op::Ror => false,
Op::Rcl => false,
Op::Rcr => false,
Op::Shl => false,
Op::Shr => false,
Op::Sar => false,
@@ -1844,7 +1862,7 @@ impl Op {
}
}
pub static FORMS: [Form; 369] = [
pub static FORMS: [Form; 381] = [
Form { op: Op::Movsxd, encoding: Encoding::RegRm, size: OperandSize::Wide, immediate: Immediate::None, source: 4, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Push, encoding: Encoding::OpReg, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Pop, encoding: Encoding::OpReg, size: OperandSize::Quad, immediate: Immediate::None, source: 0, has_modrm: false, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
@@ -2186,31 +2204,43 @@ pub static FORMS: [Form; 369] = [
Form { op: Op::Dec, encoding: Encoding::Rm, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rol, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Ror, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcl, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcr, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shl, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shr, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Sar, encoding: Encoding::RmImm, size: OperandSize::Byte, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rol, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Ror, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcl, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcr, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shl, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shr, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Sar, encoding: Encoding::RmImm, size: OperandSize::Variable, immediate: Immediate::SignedByte, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rol, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Ror, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcl, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcr, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shl, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shr, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Sar, encoding: Encoding::RmOne, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rol, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Ror, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcl, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcr, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shl, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shr, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Sar, encoding: Encoding::RmOne, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rol, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Ror, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcl, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcr, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shl, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shr, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Sar, encoding: Encoding::RmCl, size: OperandSize::Byte, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rol, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Ror, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcl, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Rcr, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shl, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Shr, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
Form { op: Op::Sar, encoding: Encoding::RmCl, size: OperandSize::Variable, immediate: Immediate::None, source: 0, has_modrm: true, memory_only: false, register_only: false, no_rex_b: false, unaligned: false, lockable: false },
@@ -2222,14 +2252,14 @@ pub static GROUPS: [[u16; 8]; 22] = [
[254, 263, 272, 281, 290, 299, 308, 317],
[255, 264, 273, 282, 291, 300, 309, 318],
[6, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
[339, 340, 65535, 65535, 341, 342, 65535, 343],
[344, 345, 65535, 65535, 346, 347, 65535, 348],
[339, 340, 341, 342, 343, 344, 65535, 345],
[346, 347, 348, 349, 350, 351, 65535, 352],
[33, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
[34, 65535, 65535, 65535, 65535, 65535, 65535, 65535],
[349, 350, 65535, 65535, 351, 352, 65535, 353],
[354, 355, 65535, 65535, 356, 357, 65535, 358],
[359, 360, 65535, 65535, 361, 362, 65535, 363],
[364, 365, 65535, 65535, 366, 367, 65535, 368],
[353, 354, 355, 356, 357, 358, 65535, 359],
[360, 361, 362, 363, 364, 365, 65535, 366],
[367, 368, 369, 370, 371, 372, 65535, 373],
[374, 375, 376, 377, 378, 379, 65535, 380],
[18, 65535, 323, 324, 325, 326, 327, 328],
[19, 65535, 329, 330, 331, 332, 333, 334],
[335, 336, 65535, 65535, 65535, 65535, 65535, 65535],
+1 -19
View File
@@ -2720,22 +2720,9 @@ const UNSUPPORTED: &[(&str, usize)] = &[
("ptest_flags", 0),
("push16_moves_rsp_by_two", 0),
("pushfq_popfq_status_round_trip", 0),
("rcl16_by16", 0),
("rcl16_by17_is_identity", 0),
("rcl32_by31", 0),
("rcl32_cl32_affects_nothing_but_extension", 0),
("rcl64_by63", 0),
("rcl8_by1_clear_carry_in", 0),
("rcl8_by1_set_carry_in_preserves_szap", 0),
("rcl8_by8", 0),
("rcl8_by9_is_identity", 0),
("rcpps_special_values", 0),
("rcpss_relative_error_bound", 0),
("rcpss_rsqrtss_signal_nothing", 0),
("rcr64_by1", 0),
("rcr8_by10_is_by_one_mod_9", 0),
("rcr8_by1_clear_carry_in", 0),
("rcr8_by1_set_carry_in", 0),
("rep_lodsb_source_fault", 1),
("rep_movsb_addr32_uses_32bit_registers", 1),
("repe_cmpsb_fault_restores_flags", 1),
@@ -2757,7 +2744,6 @@ const UNSUPPORTED: &[(&str, usize)] = &[
("shld32_by4", 0),
("shld32_cl32_is_count_zero", 0),
("shld64_by63", 0),
("shr_rcr_128bit_right_shift", 1),
("shrd32_by8", 0),
("shrd64_by1_sign_change", 0),
("shrd64_cl64_is_count_zero", 0),
@@ -4044,11 +4030,7 @@ fn shift_and_rotate_sweep_matches_operation_pseudocode() {
runs += bench.runs;
}
}
let wanted: Vec<String> = ["rcl", "rcr"]
.iter()
.flat_map(|op| WIDTHS.map(|bits| format!("{op}{bits}")))
.collect();
assert_eq!(refused, wanted, "unsupported shift forms changed");
assert_eq!(refused, Vec::<String>::new(), "a shift form is refused");
println!("{runs} engine runs");
}
+1 -1
View File
@@ -54,7 +54,7 @@ def cases():
for bits in (8, 16, 32, 64):
out += [f"{op} {reg(1, bits)}", f"{op} {reg(9, bits)}", f"{op} {mem(bits)}"]
out.append(f"{op} ch")
for op in "rol ror shl shr sar".split():
for op in "rol ror rcl rcr shl shr sar".split():
for bits in (8, 16, 32, 64):
for count in ("1", "3", "7", "cl"):
out += [f"{op} {reg(3, bits)}, {count}", f"{op} {mem(bits)}, {count}"]
+80
View File
@@ -547,6 +547,86 @@ d3 4c be 10 | ror dword ptr [rsi + 4*rdi + 16], cl
48 d3 4c be 10 | ror qword ptr [rsi + 4*rdi + 16], cl
49 c1 cd 3f | ror r13, 63
49 c1 cd 00 | ror r13, 0
d0 d3 | rcl bl, 1
d0 54 be 10 | rcl byte ptr [rsi + 4*rdi + 16], 1
c0 d3 03 | rcl bl, 3
c0 54 be 10 03 | rcl byte ptr [rsi + 4*rdi + 16], 3
c0 d3 07 | rcl bl, 7
c0 54 be 10 07 | rcl byte ptr [rsi + 4*rdi + 16], 7
d2 d3 | rcl bl, cl
d2 54 be 10 | rcl byte ptr [rsi + 4*rdi + 16], cl
41 c0 d5 07 | rcl r13b, 7
41 c0 d5 00 | rcl r13b, 0
66 d1 d3 | rcl bx, 1
66 d1 54 be 10 | rcl word ptr [rsi + 4*rdi + 16], 1
66 c1 d3 03 | rcl bx, 3
66 c1 54 be 10 03 | rcl word ptr [rsi + 4*rdi + 16], 3
66 c1 d3 07 | rcl bx, 7
66 c1 54 be 10 07 | rcl word ptr [rsi + 4*rdi + 16], 7
66 d3 d3 | rcl bx, cl
66 d3 54 be 10 | rcl word ptr [rsi + 4*rdi + 16], cl
66 41 c1 d5 0f | rcl r13w, 15
66 41 c1 d5 00 | rcl r13w, 0
d1 d3 | rcl ebx, 1
d1 54 be 10 | rcl dword ptr [rsi + 4*rdi + 16], 1
c1 d3 03 | rcl ebx, 3
c1 54 be 10 03 | rcl dword ptr [rsi + 4*rdi + 16], 3
c1 d3 07 | rcl ebx, 7
c1 54 be 10 07 | rcl dword ptr [rsi + 4*rdi + 16], 7
d3 d3 | rcl ebx, cl
d3 54 be 10 | rcl dword ptr [rsi + 4*rdi + 16], cl
41 c1 d5 1f | rcl r13d, 31
41 c1 d5 00 | rcl r13d, 0
48 d1 d3 | rcl rbx, 1
48 d1 54 be 10 | rcl qword ptr [rsi + 4*rdi + 16], 1
48 c1 d3 03 | rcl rbx, 3
48 c1 54 be 10 03 | rcl qword ptr [rsi + 4*rdi + 16], 3
48 c1 d3 07 | rcl rbx, 7
48 c1 54 be 10 07 | rcl qword ptr [rsi + 4*rdi + 16], 7
48 d3 d3 | rcl rbx, cl
48 d3 54 be 10 | rcl qword ptr [rsi + 4*rdi + 16], cl
49 c1 d5 3f | rcl r13, 63
49 c1 d5 00 | rcl r13, 0
d0 db | rcr bl, 1
d0 5c be 10 | rcr byte ptr [rsi + 4*rdi + 16], 1
c0 db 03 | rcr bl, 3
c0 5c be 10 03 | rcr byte ptr [rsi + 4*rdi + 16], 3
c0 db 07 | rcr bl, 7
c0 5c be 10 07 | rcr byte ptr [rsi + 4*rdi + 16], 7
d2 db | rcr bl, cl
d2 5c be 10 | rcr byte ptr [rsi + 4*rdi + 16], cl
41 c0 dd 07 | rcr r13b, 7
41 c0 dd 00 | rcr r13b, 0
66 d1 db | rcr bx, 1
66 d1 5c be 10 | rcr word ptr [rsi + 4*rdi + 16], 1
66 c1 db 03 | rcr bx, 3
66 c1 5c be 10 03 | rcr word ptr [rsi + 4*rdi + 16], 3
66 c1 db 07 | rcr bx, 7
66 c1 5c be 10 07 | rcr word ptr [rsi + 4*rdi + 16], 7
66 d3 db | rcr bx, cl
66 d3 5c be 10 | rcr word ptr [rsi + 4*rdi + 16], cl
66 41 c1 dd 0f | rcr r13w, 15
66 41 c1 dd 00 | rcr r13w, 0
d1 db | rcr ebx, 1
d1 5c be 10 | rcr dword ptr [rsi + 4*rdi + 16], 1
c1 db 03 | rcr ebx, 3
c1 5c be 10 03 | rcr dword ptr [rsi + 4*rdi + 16], 3
c1 db 07 | rcr ebx, 7
c1 5c be 10 07 | rcr dword ptr [rsi + 4*rdi + 16], 7
d3 db | rcr ebx, cl
d3 5c be 10 | rcr dword ptr [rsi + 4*rdi + 16], cl
41 c1 dd 1f | rcr r13d, 31
41 c1 dd 00 | rcr r13d, 0
48 d1 db | rcr rbx, 1
48 d1 5c be 10 | rcr qword ptr [rsi + 4*rdi + 16], 1
48 c1 db 03 | rcr rbx, 3
48 c1 5c be 10 03 | rcr qword ptr [rsi + 4*rdi + 16], 3
48 c1 db 07 | rcr rbx, 7
48 c1 5c be 10 07 | rcr qword ptr [rsi + 4*rdi + 16], 7
48 d3 db | rcr rbx, cl
48 d3 5c be 10 | rcr qword ptr [rsi + 4*rdi + 16], cl
49 c1 dd 3f | rcr r13, 63
49 c1 dd 00 | rcr r13, 0
d0 e3 | shl bl, 1
d0 64 be 10 | shl byte ptr [rsi + 4*rdi + 16], 1
c0 e3 03 | shl bl, 3
+14 -5
View File
@@ -397,7 +397,7 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
write(m, places[0], (1u128 << bits) - 1 - a);
Outcome::Done(none)
}
"shl" | "shr" | "sar" | "rol" | "ror" => {
"shl" | "shr" | "sar" | "rol" | "ror" | "rcl" | "rcr" => {
let count = match rest.split(", ").nth(1) {
Some("cl") => u32::from(m.gpr[1] as u8),
_ => read(m, places[1], 8) as u32,
@@ -405,13 +405,22 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
let start = read(m, places[0], bits);
let mut value = start;
let top = 1u128 << (bits - 1);
let mut carry = m.flags.cf;
for _ in 0..count {
let carry_in = m.flags.cf;
let mut carry = carry_in;
// RCL and RCR rotate through CF, so `bits + 1` steps come round again.
let steps = if matches!(name, "rcl" | "rcr") {
count % (bits + 1)
} else {
count
};
for _ in 0..steps {
// One step at a time, as the SDM loop does.
let (high, low) = (bit(value, bits - 1), bit(value, 0));
(value, carry) = match name {
"shl" => (truncate(value * 2, bits), high),
"rol" => (truncate(value * 2, bits) + u128::from(high), high),
"rcl" => (truncate(value * 2, bits) + u128::from(carry), high),
"rcr" => (value / 2 + if carry { top } else { 0 }, low),
"shr" => (value / 2, low),
"sar" => (value / 2 + if high { top } else { 0 }, low),
_ => (value / 2 + if low { top } else { 0 }, low),
@@ -424,7 +433,8 @@ fn reference(m: &mut Machine, text: &str) -> Outcome {
let (msb, next) = (bit(value, bits - 1), bit(value, bits - 2));
if count == 1 {
m.flags.of = match name {
"shl" | "rol" => msb != carry,
"shl" | "rol" | "rcl" => msb != carry,
"rcr" => bit(start, bits - 1) != carry_in,
"shr" => bit(start, bits - 1),
"sar" => false,
_ => msb != next,
@@ -1225,7 +1235,6 @@ fn undeclared_and_ambiguous_encodings_are_rejected() {
&[0x41, 0x90], // xchg r8, rax
&[0x8D, 0xC0], // lea with a register operand
&[0x0F, 0xA3, 0x06], // bt [rsi], eax
&[0xC0, 0xD0, 0x01], // rcl al, 1
&[0xC6, 0xC8, 0x01], // C6 /1
&[0xFF, 0xF8], // FF /7
&[0xFE, 0xD0], // FE /2
+3 -1
View File
@@ -61,6 +61,8 @@ cwde = { ref = "sdm CBW/CWDE/CDQE" }
cdq = { ref = "sdm CWD/CDQ/CQO" }
rol = { writes = "cf of", conditional = true, ref = "sdm RCL/RCR/ROL/ROR" }
ror = { writes = "cf of", conditional = true, ref = "sdm RCL/RCR/ROL/ROR" }
rcl = { reads = "cf", writes = "cf of", conditional = true, ref = "sdm RCL/RCR/ROL/ROR" }
rcr = { reads = "cf", writes = "cf of", conditional = true, ref = "sdm RCL/RCR/ROL/ROR" }
shl = { writes = "cf zf sf of pf", undefined = "af", conditional = true, ref = "sdm SAL/SAR/SHL/SHR" }
shr = { writes = "cf zf sf of pf", undefined = "af", conditional = true, ref = "sdm SAL/SAR/SHL/SHR" }
sar = { writes = "cf zf sf of pf", undefined = "af", conditional = true, ref = "sdm SAL/SAR/SHL/SHR" }
@@ -779,7 +781,7 @@ digits = { 0 = "inc", 1 = "dec" }
[[group]]
opcodes = [[0xC0, "b", "ib", "rm_imm"], [0xC1, "v", "ib", "rm_imm"], [0xD0, "b", "", "rm_one"], [0xD1, "v", "", "rm_one"], [0xD2, "b", "", "rm_cl"], [0xD3, "v", "", "rm_cl"]]
digits = { 0 = "rol", 1 = "ror", 4 = "shl", 5 = "shr", 7 = "sar" }
digits = { 0 = "rol", 1 = "ror", 2 = "rcl", 3 = "rcr", 4 = "shl", 5 = "shr", 7 = "sar" }
# SSE and SSE2 moves and packed integer forms.
+1 -1
View File
@@ -95,4 +95,4 @@ A feature bit is set only when every instruction of that feature is implemented.
## Rejected on purpose
LOCK except as described above, F2 or F3 where it is neither PAUSE nor part of a declared form, F2 combined with F3, address-size overrides, an ignored segment override after FS or GS, 16-bit stack and branch forms, 16-bit BSWAP and MOVSXD, bit tests of memory by a register index, RCL, RCR, SHLD, SHRD, LODS, CMPS, SCAS, REPE and REPNE, MMX, the RCP and RSQRT approximations, SSE3 and later, VEX, CMPXCHG8B, CMPXCHG16B and fences. The DBT also refuses raw SYSCALL.
LOCK except as described above, F2 or F3 where it is neither PAUSE nor part of a declared form, F2 combined with F3, address-size overrides, an ignored segment override after FS or GS, 16-bit stack and branch forms, 16-bit BSWAP and MOVSXD, bit tests of memory by a register index, SHLD, SHRD, LODS, CMPS, SCAS, REPE and REPNE, MMX, the RCP and RSQRT approximations, SSE3 and later, VEX, CMPXCHG8B, CMPXCHG16B and fences. The DBT also refuses raw SYSCALL.
+3 -3
View File
@@ -10,7 +10,7 @@ import sys
import tomllib
registry = Path("docs/claims.toml")
claims = tomllib.loads(registry.read_text(encoding="utf-8"))["claim"]
claims = tomllib.loads(registry.read_text())["claim"]
classes = {}
errors = []
claim_id = re.compile(r"\bCLAIM-[A-Z0-9]+(?:-[A-Z0-9]+)*\b")
@@ -37,10 +37,10 @@ files = [Path("README.md"), Path("AGENTS.md"), *Path("docs").rglob("*"),
for source in files:
if source == registry or source.suffix not in {".md", ".toml", ".rs"}:
continue
for reference in set(claim_id.findall(source.read_text(encoding="utf-8"))) - classes.keys():
for reference in set(claim_id.findall(source.read_text())) - classes.keys():
errors.append(f"{source}: unregistered {reference}")
status = tomllib.loads(Path("docs/status.toml").read_text(encoding="utf-8"))
status = tomllib.loads(Path("docs/status.toml").read_text())
for feature in status["feature"]:
verification = feature.get("hardware_verification", "")
if verification.casefold() != "verified":
+6 -6
View File
@@ -18,7 +18,7 @@ def table(headers, rows):
def replace_block(path, name, body, check):
original = path.read_text(encoding="utf-8")
original = path.read_text()
start = f"<!-- status:{name}:start -->\n"
stop = f"\n<!-- status:{name}:end -->"
head, _, tail = original.partition(start)
@@ -30,7 +30,7 @@ def replace_block(path, name, body, check):
if check:
print(f"{path}: status table differs from docs/status.toml", file=sys.stderr)
return False
path.write_text(updated, encoding="utf-8", newline="\n")
path.write_text(updated)
return True
@@ -90,12 +90,12 @@ def render_progress(status):
def check_asset(path, svg, check):
if path.exists() and path.read_text(encoding="utf-8") == svg:
if path.exists() and path.read_text() == svg:
return True
if check:
print(f"{path}: progress graphic differs from docs/status.toml", file=sys.stderr)
return False
path.write_text(svg, encoding="utf-8", newline="\n")
path.write_text(svg)
return True
@@ -105,8 +105,8 @@ def main():
check = parser.parse_args().check
root = Path(__file__).resolve().parents[2]
docs = root / "docs"
status = tomllib.loads((docs / "status.toml").read_text(encoding="utf-8"))
claims = tomllib.loads((docs / "claims.toml").read_text(encoding="utf-8"))
status = tomllib.loads((docs / "status.toml").read_text())
claims = tomllib.loads((docs / "claims.toml").read_text())
classes = {claim["id"]: claim["class"] for claim in claims["claim"]}
features = table(