Includeasmalphaatomich

static _inline_ void atomic_add(int i, atomic_t * v)

unsigned long temp;

"1: ldl_l %0,%1\n" 11 addl %0,%2,%0\n"

".subsection 2\n" "2: br 1b\n"

".previous"

:"=&r" (temp), "=m" (v->counter) :"Ir" (i), "m" (v->counter));

This appendix does not discuss why so much code is needed because that would necessitate an excursion into the characteristics of Alpha processors. The sole aim of the example is to demonstrate that comparatively complicated operations that do not just use single assembler statements can be implemented in inline assembler.

Continue reading here: C18 builtin Functions

Was this article helpful?

0 0