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

[X86] ABI mismatch between Clang and GCC/ICC when arguments are structures with more than one element #54582

Closed
phoebewang opened this issue Mar 27, 2022 · 5 comments
Assignees
Labels
ABI Application Binary Interface backend:X86

Comments

@phoebewang
Copy link
Contributor

This is found during working on D122104. https://godbolt.org/z/5z4eG6a5P
The comments and the code below seems not correct:

// The only case a 256-bit wide vector could be used is when the array
// contains a single 256-bit element. Since Lo and Hi logic isn't extended
// to work for sizes wider than 128, early check and fallback to memory.
//
if (Size > 128 &&
(Size != EltSize || Size > getNativeVectorSizeForAVXABI(AVXLevel)))
return;

@phoebewang phoebewang self-assigned this Mar 27, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 27, 2022

@llvm/issue-subscribers-backend-x86

@EugeneZelenko EugeneZelenko added the ABI Application Binary Interface label Mar 27, 2022
@RKSimon
Copy link
Collaborator

RKSimon commented Mar 29, 2022

This looks suspicious:

typedef struct {
  __m256d r1[2];
} __sVector;

double bar(__sVector a) {
    return a.r1[0][4];
}

define dso_local double @bar(%struct.__sVector* nocapture noundef readnone byval(%struct.__sVector) align 32 %0) local_unnamed_addr #2 {
  ret double poison
}

@phoebewang
Copy link
Contributor Author

I didn't intend to use the index 4. It should use 0~3 instead.
I'm not sure whether it's a problem of not. The 4 is out of the range of the vector. But if the array is continuous, it should be equal to a.r1[1][0]. What do you think?

@phoebewang
Copy link
Contributor Author

Just found it's not a problem if I change it to 3. So it's a mistake of the test case.

@phoebewang
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ABI Application Binary Interface backend:X86
Projects
None yet
Development

No branches or pull requests

4 participants