
$> /usr/local/arm/bin/arm-linux-gcc -c -S -O2 gcd.c -o gcd.s$> /usr/local/arm/bin/arm-linux-gcc -O2 gcd.c -o gcd

$> /usr/local/arm/bin/arm-linux-objdump -d gcd


bgeid Branch Immediate if Greater or Equal with Delay, bgei is Branch Immediate if Greater or Equal


typedef struct {char a; int b;} test_t. test_t test;

Pg 208 code listing showing example of pulling data from memory to registers, operating on them , and then sending data back to memory. As can be seen by the disassembly, the use of memory for an accumulator is very inefficient.
void accumulate (int *c, int a[10]) { int i; *c = 0; for (i=0; i<10; i++) *c += a[i]; }
/usr/local/arm/bin/arm-linux-gcc -02 -c -S accumulate.c



/usr/local/arm/bin/arm-linux-gcc -O2 -c accumulate.c -o accumulate.o /usr/local/arm/bin/arm-linux-objdump -d accumulate.o
C
int accumulate (int a[10]) { int i; int c = 0; for (i=0; i<10;i++) c += a[i]; return c; } int a[10]; int one = 1; int main() { return one + accumulate(a); }
text pg 210: (slightly modified)
/usr/local/arm/bin/arm-linux-gcc -c -S accumulate.c











https://en.wikipedia.org/wiki/Application_binary_interface
https://en.wikipedia.org/wiki/Application_binary_interface

int gcd (int a, int b){ while (!=b) { if (a > b) a = a - b; else b = b - a; } return a; } void instructiontrace(unsigned a){} asm("swi 514"); } int main() { instructiontrace(1); a = gcd(6, 8); instructiontrace(0); printf("GCD = \%d\n", a); return 0; }
/usr/local/arm/bin/arm-linux-gcc -static -S gcd.c -o gcd.S

Fig 7.12 Mapping of address 0x8524 in a 32-set, 16-line, 32-bytes-per-line set-associative cache