CSC 314 Notes
Friday Nov 21, 2003
Topics:
Inline Assembly Code
__asm statement
__asm {
stmts
}
Linking to C++ Programs
Generated and Optimized Code
Very simple, small example - but it works
#include <stdio.h>
int main()
{
int x;
x = 5;
asm("ld [%fp-12], %g1");
asm("add %g1, %g1, %g1");
asm("add %g1, %g1, %g1");
asm("st %g1, [%fp-12]");
printf("X is %d\n", x);
return 0;
}
|