🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #10464

Re: Loop instructions

#10464
From: Ian Kemmish
Date: Thu, 25 Apr 1991 18:11
32 lines
1947 bytes
lindsay@gandalf.cs.cmu.edu (Donald Lindsay) writes:

>In article <1991Apr16.152438.3445@waikato.ac.nz> 
>	ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
>>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. 

>A sophisticated compiler (with optimization enabled) can often deduce
>ranges. However, when that machine came out, the instruction was
>essentially only usable by assembler programmers.
>-- 
>Don		D.C.Lindsay 	Carnegie Mellon Robotics Institute
The Sun compiler seemed to have a hack that let people use that
instruction.  The sources to NeWS 1.0 included bits of the
pixrect library.  The *second* register variable in a proc.
was a short, and was fudged so that loops ran to -1, and the
grotty code that did this was always surrounded by comments to
the effect that this ``let the compiler use dbra''.....

And yes, it did seem to matter whether it was the *second* or not:->

-- 
Ian D. Kemmish                    Tel. +44 767 601 361
18 Durham Close                   uad1077@dircon.UUCP
Biggleswade                       ukc!dircon!uad1077
Beds SG18 8HZ United Kingdom    uad1077@dircon.co.uk
Technical Details
Message-ID: <1991Apr25.181104.5293@dircon.co.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!slxsys!dircon!uad1077
References: <1991Apr16.152438.3445@waikato.ac.nz> <12739@pt.cs.cmu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!slxsys!dircon!uad1077
From: uad1077@dircon.co.uk (Ian Kemmish)
Newsgroups: comp.arch
Subject: Re: Loop instructions
Message-ID: <1991Apr25.181104.5293@dircon.co.uk>
Date: 25 Apr 91 18:11:04 GMT
References: <1991Apr16.152438.3445@waikato.ac.nz> <12739@pt.cs.cmu.edu>
Organization: The Direct Connection, UK
Lines: 32