home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / gnu / gcc / help / 2728 < prev    next >
Encoding:
Text File  |  1992-12-12  |  1.3 KB  |  46 lines

  1. Newsgroups: gnu.gcc.help
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!news.claremont.edu!jarthur!jason
  3. From: jason@jarthur.claremont.edu (Jason Merrill)
  4. Subject: asm syntax in gcc?
  5. Message-ID: <JASON.92Dec12163621@it.claremont.edu>
  6. Sender: news@muddcs.claremont.edu (The News System)
  7. Organization: Minimal
  8. Date: 12 Dec 92 16:36:21
  9. Lines: 35
  10.  
  11. Some of the system headers on our machine (Sequent Symmetry, Dynix 3.1.2)
  12. seem to use a different syntax for "asm" directives.  For instance:
  13.  
  14. asm void S_LOCK(laddr)
  15. {
  16. %reg laddr; lab loop, spin, done;
  17. /PEEPOFF
  18. loop:    movb    $L_LOCKED, %al
  19.     xchgb    %al, (laddr)        /* an atomic "test and set" */
  20.     cmpb    $L_UNLOCKED, %al
  21.     je    done            /* if equal, we got the lock */
  22. spin:    cmpb    $L_UNLOCKED, (laddr)    /* spin in cache until unlocked */
  23.     je    loop            /* then, try get lock again */
  24.     jmp    spin
  25. done:
  26. /PEEPON
  27. %mem laddr; lab loop, spin, done;
  28. /PEEPOFF
  29. loop:    movb    $L_LOCKED, %al
  30.     movl    laddr, %ecx
  31.     xchgb    %al, (%ecx)        /* an atomic "test and set" */
  32.     cmpb    $L_UNLOCKED, %al
  33.     je    done            /* if equal, we got the lock */
  34. spin:    cmpb    $L_UNLOCKED, (%ecx)    /* spin in cache until unlocked */
  35.     je    loop            /* then, try get lock again */
  36.     jmp    spin
  37. done:
  38. /PEEPON
  39. }
  40.  
  41. How does this differ from the gcc asm syntax?  What would be equivalent
  42. code that gcc would accept?
  43.  
  44. --
  45. Jason Merrill                    jason@jarthur.claremont.edu
  46.