Re: Mersenne: Re: register usage

1999-10-08 Thread Guillermo Ballester Valor

[EMAIL PROTECTED] wrote:

  And (according to a local computer scientist, who I think knows what
 he's talking about) with modern processors making extensive use of
 register renaming, it's not usually sensible to use the "register"
 keyword _at all_. The theory is that the instruction scheduler can do
 at least as good a job as the programmer 
 
Before the beginning of FFTW thread, this was the thinking I had about
'register' keyword. I had never used it in my programs. When I was
learning C the use of register keyword made the programs slower and so I
left to the compiler the good use of them (I remember the compiler was
Borland Turbo-C under DOS).

 On the other hand, I was under the impression that the C "register"
 keyword was intended as a suggestion to the compiler, not an absolute,
 i.e. that compilers should be free to heed or ignore the programmer's
 advice on this point. Looks like whether that's true depends on the compiler.
Yes, I've compiled MacLucasUNIX in my pentium 166-MMX (linux/gcc) and it
doesn't give  any error or warning about 'register'.   

My question is still why works so different FFTW on modern RISC
processors?. Likely, the use of register is not the answer. The code of
FFTW tries to minimize the memory accesses, the mul and add operations
and stack temporary variables. Perhaps the weight assigned to every of
this task is the correct to intel machines but not for alphas or mips, I
don't know.

By the way, the memory accesses in FFTW seems very good for intel but
I've not seen any similar in Mlucas or MaclucasUNIX. FFTW uses the
memory access in the form  

X[i*iostride]

where iostride is not necessary a power of two. I don't know a word
about assembler on alpha's or other machine than x86 but perhaps is
better to store the offset on a register and then use X[offset] when is
needed. Again, a good compiler would have to do it. 

Regards

| Guillermo Ballester Valor   |  
| [EMAIL PROTECTED]  |  
| c/ cordoba, 19  |
| 18151-Ogijares (Spain)  |
| (Linux registered user 1171811) |
_
Unsubscribe  list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ  -- http://www.tasam.com/~lrwiman/FAQ-mers



Mersenne: Re: register usage

1999-10-08 Thread Steinar H. Gunderson

On Fri, Oct 08, 1999 at 11:32:34PM +1000, Simon Burge wrote:
From what I understand of gcc (the GNU C compiler), the only thing
that using "register" affects is what variables are retained by
setjmp()/longjmp()

From the gcc manpage:

  gcc, g++ - GNU project C and C++ Compiler (gcc-2.95)
  [...]
  Without  `-O',  only variables declared register are allocated in registers.

/* Steinar *
-- 
Homepage: http://members.xoom.com/sneeze/
_
Unsubscribe  list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ  -- http://www.tasam.com/~lrwiman/FAQ-mers



Re: Mersenne: Re: register usage

1999-10-08 Thread Brian J. Beesley

On 7 Oct 99, at 18:07, [EMAIL PROTECTED] wrote:

 On the other hand, I was under the impression that the C "register"
 keyword was intended as a suggestion to the compiler, not an absolute,
 i.e. that compilers should be free to heed or ignore the programmer's
 advice on this point. Looks like whether that's true depends on the compiler.

This is indeed true.

MS VC++ for Intel (at least up to v5.1) dedicates the ESI  EDI 
registers for register variables, they are assigned to the first two 
(integer) variables to be allocated in each block. It _does_ make 
sense to use the 'register' keyword for the two innermost loop 
counters (or pointers) because otherwise the object code generated by 
the compiler doesn't use these registers at all (without pushing 
their values to the stack  popping them off again, and only then for 
those peculiar Intel instructions like MOVSB which implicitly use ESI 
 EDI as pointers). If you declare more than two register variables 
in a block, the (MS VC++) compiler ignores the register modifier for 
the third  subsequent declarations.

This actually makes sense for a CPU architecture like 486 or "plain" 
Pentium, but, for P6 architecture chips, experiments indicate that 
the effects of the use of the "register" keyword in MS VC++ code are 
variable, but (on average) about neutral.


Regards
Brian Beesley
_
Unsubscribe  list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ  -- http://www.tasam.com/~lrwiman/FAQ-mers