Ilya Zakharevich on Tue, 4 Mar 2003 17:04:08 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: linker warning


On Wed, Mar 05, 2003 at 12:19:00AM +0100, Karim BELABAS wrote:
> > Now when hiremainder and friends are never in a register, why not take
> > them via a pointer supplied to the assembler routines?  I do not see
> > how this can make a difference (IIUC, this is a pointer on stack
> > instead of a pointer in the code segment).

> > This would remove the need for globals at all.

> If CC = gcc, all the micro kernel is macroified [ about 20% faster ].
> This doesn't mix well with pointers [ without adding extra ugliness ]

Hmm, I thought that the kernel is inlined on gcc, not macroized...
Anyway, why macroization would lead to problems?  gcc produces the
same assembler for

int
f(int a, int b)
{
  int *c = &a;
  return b + *c;
}

int
ff(int a, int b)
{
  int c = a;
  return b + c;
}

> Note that with  conventional build environments (gcc:-), they are not really
> globals, only used as
> 
> // no assembler kernel; same things exist with asm() statements
> #define LOCAL_HIREMAINDER ulong hiremainder
> #define divll(a,b) ({    \
>   ulong __q, __r         \
>   ...
>   hiremainder = __r;     \
>   __q;                   \
> })
> 
> blah()
> {
>   ulong q, r;
>   LOCAL_HIREMAINDER;
> 
>   hiremainder = 0;
>   q = divll(a, b);
>   r = hiremainder;
> }

This is especially silly if we could give &hiremainder to divll.

> kernel=none + new macroified (portable) divll.h (need CC = gcc)
> +++ Total bench for gp-sta is 1550
> +++ Total bench for gp-dyn is 1566

> ix86 kernel. Beats gmp kernel ] currently yields
> +++ Total bench for gp-sta is 1072
> +++ Total bench for gp-dyn is 1096

Do not think "Total bench" is an appropriate benching tool.

I think bench spends a lot of time for bookkeeping (process startup
overhead, file read/write, etc).  I would think the actual (i.e.,
tight-loop) difference between these two cases may be as high as 3x.

Ilya