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