-
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
Add hexagon support #556
Add hexagon support #556
Conversation
a97458c
to
699784e
Compare
As I understand it this will add the target-specific builtins that are currently implemented in assembly in @Amanieu or someone else please let me know if this is the right approach or if instead I need to port the assembly files over to inline assembly. |
It's fine to use C or assembly implementations, as long as these are optional. Essentially, it should be possible to have a working target using only the intrinsics provided by the Rust code. The C/asm versions are only to provide optimized implementations. |
Ok so Is there a way to alias |
I mean, they're presumably "optional" if we tell the compiler not to emit these calls at all. But perhaps they could also be optional if we did the mapping with some alias/flag for the linker? But if not that then I could probably write a rust implementation to explicitly forward each of these calls to the |
@Amanieu does that mean that rust functions that have inline asm would suffice here in lieu of the references to |
Rust functions with inline assembly are fine. The main constraint is that we shouldn't need to depend on an external C compiler to build the target with |
699784e
to
decf956
Compare
@Amanieu I think this is ready to review now. Here are some items that I think are worth discussing:
Symbol visibility
formatting
|
This isn't what I had in mind. The problem with your current implementation is that the code is unmaintainable: it was copied from the asm in compiler-rt and mangled to work with Either:
|
Well, shoot! I'm sorry I misunderstood. I don't think it's unmaintainable, though, is it? No more so than the other architecture-specific specializations already in
There's a reason we're overriding these operations: because the same Hexagon LLVM backend that clang uses generates suboptimal code for them. So we made the compiler emit calls to the optimized version instead. Why should rust programs perform worse than C ones for the same arithmetic operations?
IMO there's a benefit to having rust inline asm implementations here - it's just as you preferred - to eliminate a dependency on the C compiler. The reference implementations in Even though I think this PR gets the best behavior overall, I'm happy to do whatever it takes to suit I can understand from your POV it might seem as if I am dumping a bunch of assembly for a special (VLIW) architecture, but I fully intend to support this code. |
As a possible middle ground, would you consider placing your assembly code in global_asm!(include_string!("foo.s"), options(raw)); |
Sure -- happy to do that. |
decf956
to
d507d74
Compare
I also removed the hexagon-specific changes to |
Signed-off-by: Brian Cain <[email protected]>
d507d74
to
2402342
Compare
Ok, sorry to drag this out @Amanieu - this recent push was to address build failures that showed up in release that were not present with debug build. There were macros with the same name defined among multiple assembly files and they were conflicting, as well as some conflicting label names. The specific organization of the assembly does seem to be slightly different among these, but the way it's documented indicates to me that these conflicts are the expected behavior. So I changed the assembly to comply. This should be satisfactory now. |
No description provided.