Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site watcgl.UUCP
Path: utzoo!watmath!watcgl!dmmartindale
From: dmmartindale@watcgl.UUCP (Dave Martindale)
Newsgroups: net.lang.c
Subject: Re: Can ANSI Standard C be "Optimized"
Message-ID: <2267@watcgl.UUCP>
Date: Sun, 18-Mar-84 13:01:35 EST
Article-I.D.: watcgl.2267
Posted: Sun Mar 18 13:01:35 1984
Date-Received: Mon, 19-Mar-84 07:22:54 EST
References: <404@decvax.UUCP>
Organization: U of Waterloo, Ontario
Lines: 15

The "no optimization across statement boundaries" certainly wasn't part
of the language spec before the ANSI committee.

For as long as I can remember, the Ritchie C compiler for the PDP11
(actually c2, the optimizer) was happy to generate a SOB instruction
if it could be done.  You'll see some C code that contains loops of the
form
	if (n > 0)
		do {
			
		} while (--n);

By putting the loop termination condition in exactly that form, you got
a SOB (Subtract One and Branch if non-zero) inserted.  Writing the code
using a while loop would have been clearer but slower.