From: Eric Dumazet <[EMAIL PROTECTED]>
Date: Tue, 06 Feb 2007 21:53:24 +0100

> I am using gcc-4.1.1, so the following comment from drivers/net/tg3.c seems 
> over-optimistic :
> 
> /* Do not place this n-ring entries value into the tp struct itself,
>   * we really want to expose these constants to GCC so that modulo et
>   * al.  operations are done with shifts and masks instead of with
>   * hw multiply/modulo instructions.  Another solution would be to
>   * replace things like '% foo' with '& (foo - 1)'.
>   */
> #define TG3_RX_RCB_RING_SIZE(tp)        \
>          ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ?  512 : 1024)

Because I've seen gcc optimize this properly before (at least on
sparc64), it means that either:

1) There is a GCC bug where the properties of the constants
   do not propagate.

2) GCC really thinks the divide is cheaper (code density vs.
   cycle count tradeoffs etc.)

Anyways, we should probably apply your patch in any event.

Michael, any objections?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to