Subject: Using current gcc & binutils and NetBSD -current speeds
To: None <simonb@wasabisystems.com>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: port-pc532
Date: 11/26/2002 17:18:40
Simon Burge <simonb@wasabisystems.com> writes:

  > Hi folks (and inparticular Ian(!)),

Thats me!

  > I have managed to build a kernel with current gcc and binutils.  Most
  > files built with -O2, but I needed a build a couple with -O1 to avoid

  > 	internal compiler error: in general_operand, at recog.c:1023

  > type errors.

What FSF Version does this correspond to? The NetBSD CVS repository
still seems to be at 2.95.3.

  > I also needed to change <machine/cpufunc.h> in the movs macro:

  > -               : "r0", "memory" \
  > +               : /* XXX "r0", XXX */ "memory" \

I wonder if that is valid? R0 has zero in after a movs instruction. If
you don't tell the compiler it has been clobbered, the optimiser can
assume it still has "n" in it. Now it looks like one should get away
with it because movs is always used in a "do { ... } while (0);"
construct and the r0 local variable is never used again within
scope. But, it is not clear to me that that is effectively telling the
compiler the variable is clobbered.

Suppose r0 already had the value n in it as follows: 

  int count;	  /* Happens to allocate r0 */

  ...

  do {
           /* Expand movs macro */
	    register int r0 __asm ("r0") = count;  /* becomes a no-op */
           ...
  } while 0;

  /* Use "count", which now has zero in it, expecting to be unchanged */

I compiled the kernel on a later gcc without changing this macro.


  > Jason Thorpe mentioned that he thought there was still one codegen problem
  > outstanding ("Hard registers in RTL templates, -fomit-frame-pointer" on
  > the gcc lists?).

That was fixed. I haven't had the time to work on this lately, but I
am not aware of any outstanding ns32k specific bugs in the FSF current
gcc as of a several months ago. Most of the changes could be
backported to earlier versions fairly easily though this would have to
be tested and is not the most rewarding thing in the world to do. I
was going to do it myself, but it took a long time to get my
"developer" paperwork, and I still haven't returned it.

Ian