Skip to content

arm: share the Arm-common declarations (arm_common, JModel_arm) - #1548

Merged
vbgl merged 2 commits into
jasmin-lang:mainfrom
clebreto:arm-common
Sep 2, 2026
Merged

arm: share the Arm-common declarations (arm_common, JModel_arm)#1548
vbgl merged 2 commits into
jasmin-lang:mainfrom
clebreto:arm-common

Conversation

@clebreto

@clebreto clebreto commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Split out of #1541 as suggested in review: the first phase of that PR is a refactoring of existing code, reviewable (and CI-checkable) on its own.

  • First commit: the NZCV flags, the condition codes, their evaluation (arm_eval_cond) and the flag-combination description move from arm_decl.v/arm.v to a new arm_common.v that arm_decl re-exports; the OCaml side follows (Arm_common module). Pure refactoring, no behavior change.
  • Second commit: the 32-bit operations of JModel_m4.ec that are not AArch32-specific move to a new JModel_arm.ec theory that JModel_m4 re-exports. This also fixes the CI failure observed on Add an ARMv8-A (AArch64) backend #1541: since EasyCrypt 2026.07, JWord's W32.ALU theory declares ADD_32/ADC_32/AND_32/CMP_32/MUL_32/SUB_32 too, so the alias abbrevs (abbrev ADD = ADD_32) became ambiguous once the definitions moved out of the file; they now name the shared operators qualified (JModel_arm.ADD_32).

Both are preparation for the AArch64 backend (#1541), which reuses these definitions; once this lands, the corresponding hunks disappear from that PR.

Note: I could not run EasyCrypt locally, so the eclib commit is CI-validated only.

The NZCV flag register, the condition codes evaluated on it, the
condition evaluation itself (arm_eval_cond, previously in arm.v) and
the flag-combination description are not specific to AArch32: every Arm
architecture shares them. Move these declarations from arm_decl.v and
arm.v to a new arm_common.v that arm_decl re-exports, and let the OCaml
side refer to the extracted Arm_common module.

Pure refactoring in preparation for the AArch64 backend (jasmin-lang#1541), which
reuses these definitions; no behavior change.
Move the 32-bit operations of JModel_m4 that are not AArch32-specific
(flag computations, the ALU and shift operations on W32 with their
NZCV outputs) to a new JModel_arm theory that JModel_m4 re-exports,
in preparation for the AArch64 backend (jasmin-lang#1541), which reuses them for
its W-register forms.

The alias abbrevs of JModel_m4 (ADD = ADD_32, ...) now name the shared
operators qualified: since EasyCrypt 2026.07, JWord's W32.ALU theory
also declares ADD_32/ADC_32/AND_32/CMP_32/MUL_32/SUB_32, and the
unqualified references became ambiguous once the definitions moved out
of the file.
@clebreto
clebreto marked this pull request as ready for review September 1, 2026 20:41
@vbgl
vbgl merged commit cd5843b into jasmin-lang:main Sep 2, 2026
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.

2 participants