home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20561 < prev    next >
Encoding:
Text File  |  1993-01-03  |  1.2 KB  |  31 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!wupost!gumby!kzoo!k044477
  3. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  4. Subject: Why SUB when you can CLR?
  5. Message-ID: <1993Jan3.205354.6419@hobbes.kzoo.edu>
  6. Organization: Kalamazoo College
  7. Date: Sun, 3 Jan 1993 20:53:54 GMT
  8. Lines: 21
  9.  
  10. I've seen a lot of 680x0 code that clears registers by subtracting
  11. them from themselves, i.e.
  12.    SUB.L  D3, D3
  13. instead of
  14.    CLR.L  D3
  15.  
  16. Even my C compiler produces code like this;  there must be a
  17. good reason.  But I can't figure out what it is.  According to
  18. my 68000 book, "SUB.L <ea>, Rx" takes six cycles, or "eight, if
  19. the effective address mode is register direct," which it is
  20. in the example.  So eight;  that's for either address or data
  21. registers.  "CLR.L Rx" takes six.
  22.  
  23. And they're both one-word instructions.
  24.  
  25. So why not use CLR?  This doesn't have anything to do with
  26. incredibly obscure 68020+ pipelining timings, does it?
  27. -- 
  28.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  29.  "This sounds like a semantico-psychological backwardization of the
  30.   real world image."   - Dave Bloom (bloomda@ctrvax.vanderbilt.edu)
  31.