Skip to content

Zvame: add elementwise compares, SFU estimates, and M→Acc move#1

Open
pengwubj wants to merge 1 commit into
riscv-software-src:mainfrom
pengwubj:zvame-add-compares-sfu-move
Open

Zvame: add elementwise compares, SFU estimates, and M→Acc move#1
pengwubj wants to merge 1 commit into
riscv-software-src:mainfrom
pengwubj:zvame-add-compares-sfu-move

Conversation

@pengwubj

Copy link
Copy Markdown

Adds 7 instructions to the Attached Matrix Extension (Zvame), rebased onto the recent .ew refactor (opcode 0101011):

Compare and Predication

  • mcmpeq.ew — elementwise equality (IEEE 754-2008 OEQ; NaN → false)
  • mcmpne.ew — elementwise inequality (IEEE 754-2008 UNE; logical complement of mcmpeq.ew)

Special Functions (new group)

  • mrec.ew — reciprocal estimate
  • msqrt.ew — square-root estimate
  • mrsqrt.ew — reciprocal-square-root estimate
  • mtanh.ew — hyperbolic-tangent estimate

State Management

  • mmov.m.a — move M register group → accumulator (mirror of mmov.a.m)

Encodings use opcode 0101011, funct7 36–42 (previously free); verified no encoding conflicts across the extension. Adds the corresponding AmeOperation enum members (CMPEQ1D..TANH1D).

Notes:

  • ame_op compute branches for the new ops are not yet implemented (consistent with existing draft ops like EXP21D); operation() bodies follow the madd.ew/mexp2.ew/mmov.a.m patterns.
  • SFU results are implementation-defined estimates.

🤖 Generated with Claude Code

Adds (rebased onto the .ew refactor, opcode 0101011):
- mcmpeq.ew / mcmpne.ew (elementwise == / != compares)
- mrec.ew / msqrt.ew / mrsqrt.ew / mtanh.ew (SFU estimates, new
  "Special Functions" group)
- mmov.m.a (M register -> accumulator move; mirror of mmov.a.m)
and the corresponding AmeOperation enum members (CMPEQ1D..TANH1D).
funct7 36-42 (previously free). The redundant mul/FMA instructions from
the earlier draft were dropped in favor of upstream mmul.ew/mmulacc.ew/etc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@pengwubj
pengwubj requested a review from dhower-qc as a code owner May 30, 2026 17: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