source: src/examples/asm.c @ 08a40fd

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 08a40fd was 097e2b0, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

constructor/destructor, more example programs

  • Property mode set to 100644
File size: 552 bytes
Line 
1int fred() {
2    int src;
3    int dst;
4
5    asm volatile ( "mov %1, %0\n\t"
6                   "add $1, %0" : : : );
7
8    asm volatile ( "mov %1, %0\n\t"
9                   "add $1, %0"
10                   : "=" "r" (dst));
11
12    asm volatile ( "mov %1, %0\n\t"
13                   "add $1, %0"
14                   : "=r" (dst)
15                   : "r" (src));
16
17    asm ( "mov %1, %0\n\t"
18          "add $1, %0"
19          : "=r" (dst), "=r" (src)
20          : [src] "r" (dst)
21          : "r0");
22
23  L1: L2:
24    asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5"
25               : /* No outputs. */
26               : "r"(src), "r"(&dst)
27               : "r5", "memory"
28               : L1, L2 );
29}
Note: See TracBrowser for help on using the repository browser.