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

Global array and global index #176

Open
Tracked by #175
blackgeorge-boom opened this issue Jul 19, 2022 · 1 comment
Open
Tracked by #175

Global array and global index #176

blackgeorge-boom opened this issue Jul 19, 2022 · 1 comment
Assignees

Comments

@blackgeorge-boom
Copy link
Collaborator

blackgeorge-boom commented Jul 19, 2022

#include <stdio.h>
#include <stdlib.h>


int nx[6];
int ny[6];
int nz[6];
int lt;

int main()
{
    FILE *fp;

    fscanf(fp, "%d%d", &nx[lt], &ny[lt]);
}
@blackgeorge-boom
Copy link
Collaborator Author

blackgeorge-boom commented Jul 19, 2022

The first important difference is that AArch64 spills the value of lt.

AArch64:

32B	  %1:gpr64temp = ADRP target-flags(aarch64-page) @lt, debug-location !30; main.c:14:28
48B	  %14:gpr64 = LDRSWui killed %1:gpr64temp, target-flags(aarch64-pageoff, aarch64-nc) @lt, debug-location !30 :: (dereferenceable load 4 from @lt); main.c:14:28
56B	  STRXui %14:gpr64, %stack.1, 0 :: (store 8 into %stack.1)

X86:

32B	  %1:gr64_nosp = MOVSX64rm32 $rip, 1, $noreg, @lt, $noreg, debug-location !30 :: (dereferenceable load 4 from @lt); main.c:14:28

This introduces maybe the other changes to the register allocator.

AArch64:

  • fp, lt <-> spilled
  • nx + lt <-> x20
  • ny + lt <-> x19

X86:

  • nx +lt, fp <-> spilled
  • lt <-> r15
  • ny + lt <-> rbx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant