Closed blackgeorge-boom closed 9 months ago
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:
lastcol
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
Since
lastcol
is a global variable, the comparison in the 2nd loop requires addressing a global address. X86 allows that:but AArch64 doesn't, so it leverages an extra register: