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

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!spool.mu.edu!enterpoop.mit.edu!mojo.eng.umd.edu!russotto
  3. From: russotto@eng.umd.edu (Matthew T. Russotto)
  4. Subject: Re: Why SUB when you can CLR?
  5. Message-ID: <1993Jan03.211823.2592@eng.umd.edu>
  6. Date: Sun, 03 Jan 93 21:18:23 GMT
  7. Organization: Project GLUE, University of Maryland, College Park
  8. References: <1993Jan3.205354.6419@hobbes.kzoo.edu>
  9. Lines: 32
  10.  
  11. In article <1993Jan3.205354.6419@hobbes.kzoo.edu> k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  12. >I've seen a lot of 680x0 code that clears registers by subtracting
  13. >them from themselves, i.e.
  14. >   SUB.L  D3, D3
  15. >instead of
  16. >   CLR.L  D3
  17. >Even my C compiler produces code like this;  there must be a
  18. >good reason.  But I can't figure out what it is.  According to
  19. >my 68000 book, "SUB.L <ea>, Rx" takes six cycles, or "eight, if
  20. >the effective address mode is register direct," which it is
  21. >in the example.  So eight;  that's for either address or data
  22. >registers.  "CLR.L Rx" takes six.
  23. >
  24. >And they're both one-word instructions.
  25. >So why not use CLR?  This doesn't have anything to do with
  26. >incredibly obscure 68020+ pipelining timings, does it?
  27.  
  28. How about MOVEQ #0, D3?  That's FOUR cycles.  And 'IL'ing at random, I
  29. do see a lot of that.
  30.  
  31. SUB.L D0,D0 sure seems inappropriate, though I do remember certain
  32. Intel processors liking it (but my 80x86 reference and my plumbing
  33. didn't get along, and the plumbing won.....
  34. Anyone want a soggy and mildewed 80x86 reference?)
  35.  
  36. -- 
  37. Matthew T. Russotto    russotto@eng.umd.edu    russotto@wam.umd.edu
  38. Some news readers expect "Disclaimer:" here.
  39. Just say NO to police searches and seizures.  Make them use force.
  40. (not responsible for bodily harm resulting from following above advice)
  41.