Re: Loop Optimizations and Gotos

cliffc@ami.sps.mot.com (Cliff Click)
Mon, 13 Nov 1995 14:00:29 GMT

          From comp.compilers

Related articles
Loop Optimizations and Gotos jra@gensym.com (1995-11-08)
Re: Loop Optimizations and Gotos burley@cygnus.com (1995-11-12)
Loop Optimizations and Gotos dave@occl-cam.demon.co.uk (Dave Lloyd) (1995-11-12)
Re: Loop Optimizations and Gotos cliffc@ami.sps.mot.com (1995-11-13)
Re: Loop Optimizations and Gotos cdg@nullstone.com (1995-11-13)
Re: Loop Optimizations and Gotos faiman@zko.dec.com (1995-11-16)
Re: Loop Optimizations and Gotos hrubin@stat.purdue.edu (1995-11-17)
Re: Loop Optimizations and Gotos j-grout@glibm9.cen.uiuc.edu (1995-11-17)
Re: Loop Optimizations and Gotos baynes@ukpsshp1.serigate.philips.nl (1995-11-20)
Re: Loop Optimizations and Gotos plong@perf.com (Paul Long) (1995-11-21)
[7 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: cliffc@ami.sps.mot.com (Cliff Click)
Keywords: optimize, C
Organization: none
References: 95-11-076
Date: Mon, 13 Nov 1995 14:00:29 GMT

jra@gensym.com (Jim Allard) writes:


> [will our machine generated C code run faster if we use for and while
> loops rather than equivalent if and goto loops?]


All the compilers I've worked for come in 2 flavors: C/etc & Fortran.
The C guys know that loops come in a huge variety, and will find them
no matter how loops look. They then do loop things, but standard C
pointer semantics restrict how far they can go. The Fortran guys
follow arrays, array references, and DO loops, and then they really go
to town on the loops, but they are less likely to pick up on a GOTO
loop. Very few compilers will take generic pointer loads and reverse
them into array references. Nobody can insert into C code the missing
Fortran "no aliasing" semantics.




> The compilers we care the most about are for NT. Anyone have any insights?


Write easy code; most C compilers will spot the loops and go as far as
they can. Write array references instead of pointer dereferences
where possible, because not everybody can do this. If you have large
data structures and small regular kernals, write Fortran instead of C.


Cliff
--
Cliff Click Compiler Researcher & Designer
RISC Software, Motorola PowerPC Compilers
cliffc@risc.sps.mot.com (512) 891-7240
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.