-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Calling convention differs from MSVC for member functions returning SIMD types #104
Comments
Static analyzer cherrypicks 2
@llvm/issue-subscribers-backend-x86 |
deletes slots that have lifetime markers and the lifetime ranges are empty.
…2023.06.30 Promote develop branch (as of e1491f6) to mainline
deletes slots that have lifetime markers and the lifetime ranges are empty.
There was mismatch between exec mode represented by global variable and kernel environment struct
…ic family (llvm#104) * [Clang][XTHeadVector] Implement 15.1-15.4 `vred/vfred/vfwred` intrinsic family * [Clang][XTHeadVector] Test 15.1-15.4 `vred/vfred/vfwred` intrinsic family * [Clang][XTHeadVector] Implement wrappers for 15.1-15.4 `vred/vfred/vfwred` intrinsic family
We just got bit by this as well where we linked to a MSVC compiled library that returned a SIMD type. I would like to fix this so that since I think not being compatible with the MSVC ABI is a bug. If someone can point me in the right direction of where to look I can try to put up a PR. |
MicrosoftCXXABI::classifyReturnType in clang/lib/CodeGen/MicrosoftCXXABI.cpp is the code that handles this sort of thing. Assuming I'm understanding the issue correctly; this is specifically for instance methods of C++ classes, right? |
Here is a simplified repro: https://godbolt.org/z/TM6rW738v |
I think this is a better godbolt reproducer: The We could return all vector types from C++ instance methods indirectly, but that includes user-defined vector types, which are not required to be ABI-compatible with MSVC. We probably can't reliably differentiate vector types provided by intrinsic headers, so that's probably the correct solution. Code is here: Maybe this is a good first issue for a potential contributor. |
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below. |
@llvm/issue-subscribers-good-first-issue Author: Lewis Hallam (lhallam)
```c++
#include "xmmintrin.h"
class Foo {
|
clang-cl
returns inxmm0
, msvc takes a second hidden parameter to write to, so when the caller and callee come from objects created by different compilers any integer parameters are offset and the return value is incorrect.The visual studio documentation (https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019#return-values) seem to imply that clang's behaviour is correct, unless __m128 etc are considered user defined types.
The text was updated successfully, but these errors were encountered: