🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #10437

Re: Loop instructions

#10437
From: Mark Lord
Date: Wed, 24 Apr 1991 17:30
27 lines
1950 bytes
In article <1991Apr21.210031.16749@leland.Stanford.EDU> dhinds@elaine18.Stanford.EDU (David Hinds) writes:
<In article <12739@pt.cs.cmu.edu> lindsay@gandalf.cs.cmu.edu (Donald Lindsay) writes:
<>In article <1991Apr16.152438.3445@waikato.ac.nz> 
<>>On the 68000 family, the DBcc loop instructions decrement the 16-bit count
<>>register and stop looping when it reaches -1 (or 65535), not 0.
<>
<>Compiler writers dislike this instruction, but not because of the
<>test semantics. The killer is that the count is 16 bits, on a machine
<>where variables and expressions are naturally 32 bits. This means
<>that the compiler can only use the instruction when it possesses
<>range information. 
<
<    I'm not familiar with the 68000 instruction set, but couldn't this
<instruction be adapted to 32-bit counts by just splitting the count into
<upper and lower half-words and using a nested pair of 16-bit loops?  This
<would have minimal overhead - a few instructions in loop setup - but would
<have essentially the same performance as the 16 bit count for long loops.

This is exactly how I code it manually.  Pretty easy for a compiler to do also.
Note that the outer loop consists of a single DBcc instruction!
-- 
MLORD@BNR.CA  Ottawa, Ontario *** Personal views only ***
begin 644 NOTSHARE.COM ; Free MS-DOS utility - use instead of SHARE.EXE
MZQ.0@/P/=`J`_!9T!2[_+H``L/_/+HX&+`"T2<TAO@,!OX0`N1(`C,B.P/.DS
<^K@A-<TAB1Z``(P&@@"ZA`"X(27-(?NZE@#-)P#-5
``
end
Technical Details
Message-ID: <6566@bwdls58.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!bwdls58!mlord
References: <1991Apr16.152438.3445@waikato.ac.nz> <12739@pt.cs.cmu.edu> <1991Apr21.210031.16749@leland.Stanford.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!bwdls58!mlord
From: mlord@bwdls58.bnr.ca (Mark Lord)
Newsgroups: comp.arch
Subject: Re: Loop instructions
Message-ID: <6566@bwdls58.bnr.ca>
Date: 24 Apr 91 17:30:24 GMT
References: <1991Apr16.152438.3445@waikato.ac.nz> <12739@pt.cs.cmu.edu> <1991Apr21.210031.16749@leland.Stanford.EDU>
Sender: mlord@bwdls58.bnr.ca
Reply-To: mlord@bwdls58.bnr.ca (Mark Lord)
Organization: Bell-Northern Research, Ottawa, Canada
Lines: 27