Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv64: Add remaining Zfa Instructions #8582

Merged
merged 4 commits into from
May 8, 2024

Conversation

afonso360
Copy link
Contributor

👋 Hey,

This PR adds support for the remaining instructions in the Zfa extension (introduced in #8536).

The first one is fround.{s,d} that is a direct match of all of our float rounding instructions (ceil, floor, trunc, nearest) depending on how the instruction is encoded.

The second one is fli.{s,d} that loads a floating point constant from a predefined table of constants. Additionally I've also added a rule that supports loading the negated constant and then subsequently inverting the sign bit with fneg.

There are additional instructions in Zfa, but none that can be easily matched with our IR.

@afonso360 afonso360 added the cranelift:area:riscv64 Issues related to the RISC-V 64 backend. label May 8, 2024
@afonso360 afonso360 requested a review from a team as a code owner May 8, 2024 12:44
@afonso360 afonso360 requested review from cfallin and removed request for a team May 8, 2024 12:44
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language labels May 8, 2024
Copy link

github-actions bot commented May 8, 2024

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "cranelift", "cranelift:area:riscv64", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

One thought below about Capstone but otherwise good to go 👍

; fsd fs10, 0x10(sp)
; fsd fs11, 8(sp)
; block1: ; offset 0x40
; .byte 0x53, 0x05, 0x10, 0xf0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting that Capstone doesn't yet support these flis; does a newer version exist that does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capstone in general doesn't support any RISC-V extension, last time I checked the RISC-V support seemed a bit abandoned, but I'll go check again.

Copy link
Contributor Author

@afonso360 afonso360 May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at the release notes for the capstone engine for the past year or so. There aren't many RISC-V specific fixes, and none of them add any extensions 😞

@cfallin cfallin added this pull request to the merge queue May 8, 2024
Merged via the queue into bytecodealliance:main with commit d89e2b3 May 8, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:area:riscv64 Issues related to the RISC-V 64 backend. cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants