CSC 314 Notes 
Friday Nov 21, 2003

Topics: 


Embedding ASM in C/C++

Inline Assembly Code

Linking to C++ Programs

Generated and Optimized Code


Example on the Sun250 using gcc -- presented in class

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;
}