-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
PowerPC ABI incompatibility with GNU on complex arguments #56023
Comments
@llvm/issue-subscribers-backend-powerpc |
So, likely the issue should to be reported to GCC? |
@asl ,my bad http://refspecs.linux-foundation.org/elf/elfspec_ppc.pdf according to this , I think GCC following like So i guess we need to have this implementation in llvm too and same goes to return value . @chmeeedalf and @nemanjai your thoughts here ? |
@asl , We made the changes ,can i raise a review with llvm trunk ? |
This is still a problem on ppc32. If I call csin(3) in libm, gcc compiled my call, and clang had compiled libm, then it segfaults. The ppc32 ABI has 2 ways to pass complex args. The old version from 1995 (elfspec_ppc.pdf) predates C99 and doesn't mention complex args, but the new version from 2011 (Power-Arch-32-bit-ABI-supp-1.0-Unified.pdf) specifies ATR-PASS-COMPLEX-IN-STRUCT and ATR-PASS-COMPLEX-IN-GPRS. clang looks like ATR-PASS-COMPLEX-IN-STRUCT, but gcc looks like ATR-PASS-COMPLEX-IN-GPRS. These are not compatible. I looked at float _Complex v1;
double _Complex v2;
float _Complex csinf(float _Complex);
double _Complex csin(double _Complex);
void f1(void) { v1 = csinf(v1); }
void f2(void) { v2 = csin(v2); } clang main from July 12 (8fe076f) passes complex in structs. csinf(v1) returns a small struct, so it uses gcc passes complex in general-purpose registers. gcc calls csinf(v1) with r3:r4 = v1, and expects the return value in r3:r4. gcc calls csin(v2) with r3:r4:r5:r6 = v2, and expects the return value in r3:r4:r5:r6. This is awkward because it doesn't use the floating-point registers. The ABI and gcc do align register pairs as odd-even, but don't align register quads. So, gcc calls f(int, float complex) with r3 = int, r5:r6 = float complex, skipping r4 to align the pair; but gcc calls g(int, double complex) with r3 = int, r4:r5:r6:r7 = double complex, without skipping registers. |
Sorry for delay, I've been in the process of moving over the last couple months. Please do submit a review for further discussion. It may get a wider audience there, too. |
ping. |
…x arguments PR : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag: -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex. Following up with this patch : https://reviews.llvm.org/D146942
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex. Following up with this patch : https://reviews.llvm.org/D146942
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex. Following up with this patch : https://reviews.llvm.org/D146942
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex. Following up with this patch : https://reviews.llvm.org/D146942
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex.
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex. Following up with this patch : https://reviews.llvm.org/D146942
…x arguments Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex. Following up with this patch : https://reviews.llvm.org/D146942
…x arguments (llvm#77732) Fixes : llvm#56023 https://godbolt.org/z/1bsW1sKMs newFlag : -fcomplex-ppc-gnu-abi GNU uses GPRs for complex parameters and return values storing for PowerPC-32bit, which can be enabled which above flag. Intent of this patch is to make clang compatible with GNU libraries of complex. Following up with this patch : https://reviews.llvm.org/D146942
We recently moved llvm from GCC and found that their is ABI difference in the two compilers. GNU passes and returns double complex in GP registers. LLVM passes an returns the value on the stack.
return double complex numbers (the assumption is this applies to complex, double complex, and long double complex).
https://godbolt.org/z/qqzzesK9r
Its case with ppc32 and we agree that the ABI insist the same semantics like LLVM ,can we have change the semantics like GCC with option ?
The text was updated successfully, but these errors were encountered: