-
Notifications
You must be signed in to change notification settings - Fork 13.3k
On 32-bit x86, half
return ABI is incorrect when SSE is enabled but SSE2 is disabled
#112890
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
@llvm/issue-subscribers-backend-x86 Author: None (beetrees)
Consider the following IR ([compiler explorer](https://godbolt.org/z/nMrcsed1a)):
target triple = "i586-unknown-linux-gnu"
define half @<!-- -->only_sse(half) #<!-- -->0 {
ret half %0
}
attributes #<!-- -->0 = { "target-features"="+sse,-sse2" }
define half @<!-- -->sse_and_sse2(half) #<!-- -->1 {
ret half %0
}
attributes #<!-- -->1 = { "target-features"="+sse,+sse2" } The 32-bit x86 ABI for returning |
We don't have instructions to load/store |
AFAIK, the |
If you mean by transiting through stack for each load/store, yes, we can do it in this way, but it's not worth the complexity. SSE was designed for float type only, even double is not supported without SSE2, not to mention half. Both GCC and LLVM error out for this https://godbolt.org/z/TE8c99aTK. Other front end should follow in the same way. |
This doesn't show any error? |
Sorry, here is the right link https://godbolt.org/z/GYETdPaEe |
Consider the following IR (compiler explorer):
The 32-bit x86 ABI for returning
half
is specified as using thexmm0
register. As bothonly_sse
andsse_and_sse2
have SSE registers available, they should both be able to use the specified ABI. However, LLVM currently only compilessse_and_sse2
correctly, withonly_sse
incorrectly returning thehalf
ineax
instead.The text was updated successfully, but these errors were encountered: