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

Different legal addressing modes - global variables #309

Closed
blackgeorge-boom opened this issue Oct 26, 2023 · 0 comments · Fixed by #310
Closed

Different legal addressing modes - global variables #309

blackgeorge-boom opened this issue Oct 26, 2023 · 0 comments · Fixed by #310

Comments

@blackgeorge-boom
Copy link
Collaborator

blackgeorge-boom commented Oct 26, 2023

int main(int argc, char *argv[])
{
  int i, j, k, it;

  double rnorm;

  firstrow = 0;
  lastrow  = NA-1;
  lastcol  = NA-1;

  printf(" Size: %11d\n", NA);

  naa = NA;
  nzz = NZ;

  //---------------------------------------------------------------------
  // set starting vector to (1, 1, .... 1)
  //---------------------------------------------------------------------
  for (i = 0; i < NA+1; i++) {
    x[i] = 1.0;
  }
  for (j = 0; j < lastcol - firstcol + 1; j++) {
    q[j] = 0.0;
    z[j] = 0.0;
    r[j] = 0.0;
    p[j] = 0.0;
  }

  for (it = 1; it <= 1; it++) {
    conj_grad(colidx, rowstr, x, z, a, p, q, r, &rnorm);
  }


  return 0;
}

Since lastcol is a global variable, the comparison in the 2nd loop requires addressing a global address. X86 allows that:

501076:	mov    QWORD PTR [rax+rcx*1+0x927c8],rdx <- the hex number is the global address

but AArch64 doesn't, so it leverages an extra register:

  501088:      	mov	w19, #0x27c0
  50108c:      	movk	w19, #0x9, lsl #16
@blackgeorge-boom blackgeorge-boom changed the title Different legal immediates - comparison case Different legal immediates - addressing case Oct 26, 2023
@blackgeorge-boom blackgeorge-boom changed the title Different legal immediates - addressing case Different legal addressing modes Oct 26, 2023
@blackgeorge-boom blackgeorge-boom changed the title Different legal addressing modes Different legal addressing modes - global variables Oct 26, 2023
blackgeorge-boom added a commit to blackgeorge-boom/llvm-unifico that referenced this issue Oct 26, 2023
AArch64 does not support this, so we add a flag to disable it in X86 as
well.

Addresses: systems-nuts/unifico#309
blackgeorge-boom added a commit to blackgeorge-boom/llvm-unifico that referenced this issue Oct 26, 2023
AArch64 does not support this, so we add a flag to disable it in X86 as
well.

Addresses: systems-nuts/unifico#309
blackgeorge-boom added a commit that referenced this issue Oct 26, 2023
Uses `-mattr=aarch64-legal-addr`.

Closes: #309
blackgeorge-boom added a commit that referenced this issue Oct 26, 2023
Uses `-mattr=aarch64-legal-addr`.

Closes: #309
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

Successfully merging a pull request may close this issue.

1 participant