The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] arithmetic IF (was origin of string.h and ctype.h)
@ 2017-08-17 15:14 Doug McIlroy
  0 siblings, 0 replies; 7+ messages in thread
From: Doug McIlroy @ 2017-08-17 15:14 UTC (permalink / raw)


> [Fortran's optimization]  worked so well that the results that came out of the compiler
> sometimes suprised the compiler writers!

Except when it didn't. They gave particular attention to nested
loops with subscripted variables, exemplified by linear-algebra
computations. But their algorithms behaved quite wildly on
nonstandard loops. Vic Vyssotsky cooked up a nest of loops
surrounding a single awful statement that filled up the
maximum 10 continuation lines with triple subscripts in all
permutations of several variables. That statement compiled
into thousands of instructions, far more than a naively
written compiler would have produced.

doug


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [TUHS] arithmetic IF (was origin of string.h and ctype.h)
@ 2017-08-17 13:38 Doug McIlroy
  0 siblings, 0 replies; 7+ messages in thread
From: Doug McIlroy @ 2017-08-17 13:38 UTC (permalink / raw)


> According to the Wikipedia article on FORTRAN, CAS was usually not the
> most efficient way to implement arithmetic IF anyway.  CAS takes up
> four words of memory and takes three cycles to execute, whereas you
> can do it in two words and two cycles with the transfer instructions.

Though the article's conclusion was right, its numbers were wrong. 
As a correct discussion of possible implementations of arithmetic-IF
would be long and essentially off topic, I have chopped most of it
out of the article.

doug


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [TUHS] arithmetic IF (was origin of string.h and ctype.h)
@ 2017-08-16 18:04 Paul Winalski
  2017-08-16 23:54 ` Greg 'groggy' Lehey
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Winalski @ 2017-08-16 18:04 UTC (permalink / raw)


On 8/16/17, Doug McIlroy <doug at cs.dartmouth.edu> wrote:
>>> the 709 added CAS
>
>> It was my understanding that the 704 had this instruction too
>
> Yes. It's in the manual.
>
> (I searched in vain for an online manual. A quick trip to the
> attic turned up the real thing in less time.)
>
> Doug
>
From what I've been able to determine, FORTRAN came out shortly after
the IBM 704.  Undoubtedly both were under development at the same
time.  So the question is, was arithmetic IF put in FORTRAN to take
advantage of the CAS instruction, or was CAS added to the IBM 704
instruction set to provide hardware support for arithmetic IF?  Or
maybe neither?

According to the Wikipedia article on FORTRAN, CAS was usually not the
most efficient way to implement arithmetic IF anyway.  CAS takes up
four words of memory and takes three cycles to execute, whereas you
can do it in two words and two cycles with the transfer instructions.

-Paul W.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-08-18 10:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.921.1502995544.3779.tuhs@minnie.tuhs.org>
2017-08-17 22:19 ` [TUHS] arithmetic IF (was origin of string.h and ctype.h) Paul McJones
2017-08-18 10:49   ` arnold
2017-08-17 15:14 Doug McIlroy
  -- strict thread matches above, loose matches on Subject: below --
2017-08-17 13:38 Doug McIlroy
2017-08-16 18:04 Paul Winalski
2017-08-16 23:54 ` Greg 'groggy' Lehey
2017-08-17 14:04   ` arnold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).