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

[GlobalISel][AArch64] Calling convention for small arguments passed on stack incorrect on big-endian targets #34709

Closed
ostannard opened this issue Nov 20, 2017 · 5 comments
Assignees
Labels
backend:AArch64 bugzilla Issues migrated from bugzilla llvm:globalisel wontfix Issue is real, but we can't or won't fix it. Not invalid

Comments

@ostannard
Copy link
Collaborator

Bugzilla Link 35361
Version trunk
OS Linux
Depends On #26535
CC @qcolombet

Extended Description

Global-isel generates incorrect code when targeting big-endian AArch64 for this code:
int foo(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7,
int stack1) {
return stack1;
}

int main() {
int ret = foo(0,1,2,3,4,5,6,7,8);
printf("%d\n", ret);
}

Global isel thinks that the incoming value of stack1 is stored in bytes [0,4) above SP, but for big-endian targets this should be in bytes [4,8):

// /work/llvm/build/bin/clang --target=aarch64-arm-none-eabi -march=armv8-a -c callees.cpp -O0 -Wall -std=c++11 -mllvm -global-isel=true -mllvm -global-isel-abort=0 -mbig-endian -o - -S
_Z3fooiiiiiiiii: // @​_Z3fooiiiiiiiii
// BB#0: // %entry
sub sp, sp, #​48 // =48
ldr w8, [sp, #​48] // <= Should be [sp, #​52]
str w0, [sp, #​44]
str w1, [sp, #​40]
str w2, [sp, #​36]
str w3, [sp, #​32]
str w4, [sp, #​28]
str w5, [sp, #​24]
str w6, [sp, #​20]
str w7, [sp, #​16]
str w8, [sp, #​12]
ldr w0, [sp, #​12]
add sp, sp, #​48 // =48
ret

@ostannard
Copy link
Collaborator Author

assigned to @aemerson

@qcolombet
Copy link
Collaborator

Hi Amara, could you take a look?
Thanks.

@aemerson
Copy link
Contributor

aemerson commented Dec 4, 2017

GISel big endian will be disabled until #26535 is resolved.

@aemerson
Copy link
Contributor

aemerson commented Mar 2, 2022

Closing as we're not going to implement BE support for AArch64 GISel any time soon. This has been worked around via a fallback instead.

@aemerson aemerson closed this as completed Mar 2, 2022
@EugeneZelenko EugeneZelenko added backend:AArch64 wontfix Issue is real, but we can't or won't fix it. Not invalid labels Mar 2, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 2, 2022

@llvm/issue-subscribers-backend-aarch64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 bugzilla Issues migrated from bugzilla llvm:globalisel wontfix Issue is real, but we can't or won't fix it. Not invalid
Projects
None yet
Development

No branches or pull requests

5 participants