-
Notifications
You must be signed in to change notification settings - Fork 211
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
This enables math module for riscv32 targets #554
Conversation
a8fd405
to
67a6cd4
Compare
src/lib.rs
Outdated
@@ -48,6 +48,7 @@ pub mod int; | |||
all(target_arch = "x86_64", target_os = "none"), | |||
all(target_arch = "x86_64", target_os = "uefi"), | |||
all(target_arch = "arm", target_os = "none"), | |||
all(target_arch = "riscv32", target_os = "none"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also gate on not(target_feature = "f")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fair amount of the intrinsics in libm don't have native instructions even on cpu's that do support floating point operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, my initial thinking was that if there are gates on non-fpu on relevant elements inside math.rs it is ok not to gate it on module inclusion
I'll do whatever you guys tell me, just created this PR to speed things up and have the thing going on somewhere since esp-hal
was clearly not a correct place for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fair amount of the intrinsics in libm don't have native instructions even on cpu's that do support floating point operations.
Is there any point in gating the math module at all then? Presumably, if the backend supports code-generation instead of using an intrinsic it will just do that, and not emit a call to the intrinsic. Compile times I suppose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any point in gating the math module at all then?
Yes, we must not include it when there is already a libm implementation providing them. This libm implementation is generally part of the system libc. We are allowlisting targets without libc here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so I brought back the original commit
e36bea1
to
e6bbec5
Compare
Should the same be done for riscv64 bare metal targets? |
good question, also does
mean that we could skip architecture and go for
? |
Yes, actually that would make more sense. It seems the same conclusion was reached for UEFI in #553, we probably shouldn't be checking |
e6bbec5
to
a3173dc
Compare
Cool! Changed it accordingly. Maybe I should rebase on #553 already? |
I've merged #553, you can rebase on top of that. Also we should remove the |
huh, but then what about gating like |
It doesn't hurt to provide them anyways. If they are not used then the linker will simply not include them in the output binary. |
This was initially a bugfix that fixed gating math module for riscv32, but conclusiion is it makes no sense to gate on target architecture.
a3173dc
to
e7bdba1
Compare
Okay, how about now? |
06a46b7
to
ce1e4d2
Compare
It is not that easy - gating only on taget os "none" enables it for targets that have these symbols already leading to multiple definitions, gating module inclusion seems fine though. Maybe some other gating scheme would do the trick, but I am not sure if it should be part of this PR |
This is likely a bug fix since in math.rs there are already config attributes that are mentioning this target.
I was pointed here from esp-rs/esp-hal#881