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

ISA Zfinx extension #668

Closed
Snorny opened this issue Aug 10, 2023 · 8 comments
Closed

ISA Zfinx extension #668

Snorny opened this issue Aug 10, 2023 · 8 comments
Labels
SW software-related

Comments

@Snorny
Copy link

Snorny commented Aug 10, 2023

Hello,

I'd like to ask you a question. I would like to use the Zfinx ISA extension to perform float calculations.
The only problem is that my code compiles whether I add zfinx to the compile flag or not.
(-march=rv32im_zfinx)

My question is how can I be sure that the float calculations are used by the hardware and not the software?

Thank you in advance for your answers.

@GideonZ
Copy link
Collaborator

GideonZ commented Aug 10, 2023 via email

@Snorny
Copy link
Author

Snorny commented Aug 10, 2023

It seems that the operations are the same, so I deduce that I haven't activated the zfinx extension properly.

@stnolting
Copy link
Owner

stnolting commented Aug 10, 2023

You need to check first if your toolchain actually supports the Zfinx extension. I think support has been added with GCC version 12.something?!

Anyway, you can also "force" the compiler to infer Zfinx instructions using the provided intrinsics library. This is also possible even if the toolchain does not support Zfinx yet.

@stnolting stnolting added the SW software-related label Aug 10, 2023
@Snorny
Copy link
Author

Snorny commented Aug 10, 2023

You need to check first if your toolchain actually supports the Zfinx extension. I think support has been added with GCC version 12.something?!

Anyway, you can also "force" the compiler to infer Zfinx instructions using the provided intrinsics library. This is also possible even if the toolchain does not support Zfinx yet.

Thanks for those precision, how can i know if the toolchain support it ?

@stnolting
Copy link
Owner

Good question 😅

Unfortunately, it is quite hard to make GCC emit a list off all supported Z* sub-extensions... Better compare your version of GCC/binutils with the official release lists.

Or just try to compile a simple floating-point program with Zfinx in the march string and scan the resulting assembly code for any floating point instructions.

@Snorny
Copy link
Author

Snorny commented Aug 17, 2023

I've tried looking, but it seems that my toolchain can't use the Zfinx extension, I'm working with RTEMS and the riscv-rtems6-gcc toolchain. I don't know if this is possible, but I need an answer and another opinion on my conclusion.

Other question, does the riscv32-unknown-elf-gcc can use this extension ?

@stnolting
Copy link
Owner

Other question, does the riscv32-unknown-elf-gcc can use this extension ?

No, not yet.

According to this list https://gcc.gnu.org/gcc-13/changes.html support for the Zfinx was introduced this year with GCC 13.

However, you can still utilize this extension with older GCC versions by using intrinsics.

@Snorny
Copy link
Author

Snorny commented Aug 18, 2023

Thanks a lot for your help !

However, you can still utilize this extension with older GCC versions by using intrins

Yeah thanks for this precision ! It could be helpful.

@Snorny Snorny closed this as completed Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SW software-related
Projects
None yet
Development

No branches or pull requests

3 participants