Skip to content

feat: critical ARM fixes, WASM SIMD/Helium MVE, code-gen STPA#59

Merged
avrabe merged 1 commit intomainfrom
feat/bugfixes-simd-stpa
Mar 21, 2026
Merged

feat: critical ARM fixes, WASM SIMD/Helium MVE, code-gen STPA#59
avrabe merged 1 commit intomainfrom
feat/bugfixes-simd-stpa

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Mar 21, 2026

Summary

Critical/High Bug Fixes (from embedded code review)

  • C1: Division by zero now trapped with CMP+BNE+UDF guard (WASM spec compliance)
  • C2/C3: Constant materialization uses MOVW/MOVT for full 32-bit range
  • C4/C5: Register allocator excludes R9/R10/R11 from temp pool
  • H2: Bounds check accounts for access size (was ignoring it)
  • H3: Callee-saved registers preserved via PUSH/POP
  • H4: 8-byte stack alignment enforced per AAPCS
  • H5: Inline i64 division no longer does premature POP {PC}
  • H7: Popcnt uses scratch register instead of clobbering R11
  • H8: I64SetCondZ uses 32-bit CMP for high registers

WASM SIMD → Helium MVE (Cortex-M55)

  • 90 v128 WasmOp variants, 40 MVE ArmOp variants
  • Full i8x16/i16x8/i32x4/i64x2/f32x4 arithmetic, comparisons, splat/extract/replace
  • Q-register allocator (Q0-Q7), ISA gating via has_helium()
  • Lane-wise f32x4 div/sqrt via S-register aliasing

Code-Generation STPA

  • 4 losses, 9 hazards, 13 UCAs, 8 loss scenarios, 10 constraints
  • 11 code review findings as rivet verification artifacts
  • All linked to existing system-level STPA (L-1..6, H-1..10, SC-1..10)

851 tests (up from 802), AGENTS.md generated (231 artifacts, 17 types)

Test plan

  • cargo test --workspace — 851 tests, 0 failures
  • cargo clippy — clean
  • cargo fmt --check — clean

🤖 Generated with Claude Code

Critical/high bug fixes:
- C1: Division by zero now trapped (CMP+BNE+UDF guard before SDIV/UDIV)
- C2/C3: Constant materialization uses MOVW/MOVT for full 32-bit range
- C4/C5: Register allocator excludes R9/R10/R11 from temp allocation
- H2: Bounds check accounts for access size
- H3: Callee-saved registers preserved (PUSH/POP R4-R11,LR)
- H4: 8-byte stack alignment enforced
- H5: Inline i64 division no longer does POP {PC}
- H7: Popcnt uses scratch register instead of R11
- H8: I64SetCondZ uses 32-bit CMP for high registers

WASM SIMD → Helium MVE (Cortex-M55):
- 90 v128 WasmOp variants (i8x16, i16x8, i32x4, i64x2, f32x4)
- 40 MVE ArmOp variants with ISA gating (has_helium())
- Q-register allocator (Q0-Q7), MveSize enum
- Thumb-2 MVE encoding (VADD/VSUB/VMUL/VDUP/VLDR/VSTR etc.)
- Lane-wise f32x4 div/sqrt via S-register aliasing

Code-generation STPA:
- 4 code-level losses (L-CODE-1..4)
- 9 code-level hazards (H-CODE-1..9) linked to system hazards
- 13 UCAs across 3 controllers (regalloc, instruction selector, encoder)
- 8 loss scenarios with root cause analysis
- 10 system constraints with verification criteria
- 11 code review findings (CR-C1..C5, CR-H2..H8) as rivet artifacts

AGENTS.md generated by rivet init --agents (231 artifacts, 17 types).

851 tests (up from 802), clippy clean, fmt clean.

Implements: FR-002
Implements: FR-005
Fixes: NFR-002
Fixes: NFR-005
Trace: skip

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit f86d459 into main Mar 21, 2026
6 checks passed
@avrabe avrabe deleted the feat/bugfixes-simd-stpa branch March 21, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant