-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add support for RV32IM without division #45
Comments
In principle it's possible but probably will not happen because the number of compiler options that would need to be supported for a marginal area/speed saving.
Also + - * / form a closed group so it is inelegant to leave one out.
…Sent from my iPhone
On 26 Sep 2017, at 19:15, Luís Marques ***@***.***> wrote:
Could we add something like -mattr=+m,-div or -mattr=+mul to generate multiplication instructions but not division (and remainder, etc.) instructions?
I'm not the only one who wants this. For instance: https://twitter.com/jangray/status/877188603440316416
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This sort of thing has also come up on the mailing lists. I think it's inevitable we'll need to support this sort of flexibility, though it's not clear exactly how it should be expressed (specifically, are there lots of cases beyond the mul/div issues where you need this fine-grained approach?). There's also the issue with the "U-mode" instructions like rdcycle, which sadly will trap on M-mode only implementations. I wish implementers of M-mode-only cores would just alias it to reading the M-mode cycle CSR to give us a single common ISA baseline, but it seems that's not the preferred approach. If targeting one of these cores, it would be nice if LLVM knew to complain when trying to use rdcycle. Different "profiles" has been discussed as one potential approach, but nobody has really elaborated how this would work, and enumerated what these profiles might look like. Whatever the solution, we should try and coordinate with GCC to keep a uniform interface. |
I meant inelegant from an engineering standpoint, not mathematically. Without division, the programmer would have to know that divisions were performed in a slow software loop, and apply appropriate workarounds, for example division by some constant c might be replaced by multiplying by (2^16)/c, with associated rounding issues to be considered. In my hand-waving way I represented a closed group as being a set of integers which applied to any of those operators would always lead to another integer (if you exclude the irritating divide by zero case). Anyway, I think the statute of limitations has run out on that remark since I said it over five years ago. |
Could we add something like
-mattr=+m,-div
or-mattr=+mul
to generate multiplication instructions but not division (and remainder, etc.) instructions?I'm not the only one who wants this. For instance: https://twitter.com/jangray/status/877188603440316416
The text was updated successfully, but these errors were encountered: