-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Inline assembly doesn't work with FP constraint #20213
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
Comments
Our constraints do not duplicate GCC; its just that we implement several of the same constraints GCC supports.
It is a bug in the unsafe guide if it says that we match GCC entirely. |
I wish constraints were documented somewhere. How do we implement constraints for registers on the floating point stack? |
We currently just translates Clang-3.4 translates |
The chapter of the book says that we're "Like GCC and Clang" and points to the LLVM inline asm stuff, so I'm going to give this one a close. |
@steveklabnik This is still an issue; we currently don't do like "GCC and Clang". We do like llvm IR which is different from GCC/Clang. For given GCC/Clang inline asm: __asm__("fldln2; fldl %1; fyl2x" : "=t"(out) : "m"(x)); Clang-3.7 emits the following LLVM IR: %2 = call double asm "fldln2; fldl $1; fyl2x",
"={st},*m,~{dirflag},~{fpsr},~{flags}"(double* %1) #2, !srcloc !1 where Currently we simply pass |
@steveklabnik I agree with @klutzy, this is exactly what I found confusing initially. We could actually be "Like GCC and Clang" and translate |
Okay, sorry for missing the boat here. |
@steveklabnik nw. I don't even know whether rustc should support GCC/Clang inline assembly, though it might improve ease of use. It just felt like a papercut to find out the hard way that it doesn't. |
It's not like GCC's. Fixes rust-lang#20213
Remove inaccurate claim about inline assembly It's not like GCC's. Fixes rust-lang#20213
Remove inaccurate claim about inline assembly It's not like GCC's. Fixes rust-lang#20213
The following code:
errors with the message:
The constraint
t
refers to the top of the floating point stack in GCC's inline assembly, and the unsafe guide says our constraints mirror theirs.The text was updated successfully, but these errors were encountered: