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

wasm2c: ensure force read constraints compile for clang on mips #2274

Merged
merged 1 commit into from
Jul 30, 2023

Conversation

shravanrn
Copy link
Collaborator

@shravanrn shravanrn commented Jul 30, 2023

This is a clean slate attempt to fix #2266. To fix this i looked into how clang and gcc handle floating point constraints across a host of platforms.

Godbolt link: https://godbolt.org/z/ddeWc6ees
Results are in table below.

Given this, it seems the simplest course of action that maintains functionality as is today, but fix the mips platform is to special case this. We can separately file a bug upstream (but best case scenario is that will likely get fixed only for future clang versions, so I'm not sure we can rely on just that).

Fyi, @glandium

gcc

x86 - both
x86-64 - both
aarch32 - only "r"
aarch64 - only "r"
mips - only "r"
mips64 - both
riscv32 - both
riscv64 - both
sparc - both
sparc64 - both
powerpc - both
powerpc64 - both

clang

x86 - both
x64 - both
aarch32 - only "r"
aarch64 - only "r"
mips - only "f"
mips64 - only "f"
riscv32 - both
riscv64 - both
powerpc64 - both

@shravanrn shravanrn requested review from keithw and sbc100 July 30, 2023 18:37
Copy link
Member

@keithw keithw left a comment

Choose a reason for hiding this comment

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

lgtm % comment. Thank you for doing this whole investigation!

src/template/wasm2c.declarations.c Outdated Show resolved Hide resolved
@shravanrn
Copy link
Collaborator Author

lgtm % comment. Thank you for doing this whole investigation!

Fixed 👍

@shravanrn shravanrn enabled auto-merge (rebase) July 30, 2023 19:06
@shravanrn shravanrn merged commit 70b1c9d into WebAssembly:main Jul 30, 2023
15 checks passed
Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

I wonder if this could be accompanied by some kind CI test? Can this be verified by simply compiling some wasm2c output with clang --target=mips maybe?

src/template/wasm2c.declarations.c Show resolved Hide resolved
@shravanrn
Copy link
Collaborator Author

shravanrn commented Jul 30, 2023

I wonder if this could be accompanied by some kind CI test? Can this be verified by simply compiling some wasm2c output with clang --target=mips maybe?

Open to it, but my take is that this feels like overkill at the moment. I tested this approach on Godbolt to make sure it works. I think we can push this until/if we see other mips incompatibilities

@keithw keithw mentioned this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants