[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070206.131908.13769204.davem@davemloft.net>
Date: Tue, 06 Feb 2007 13:19:08 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: dada1@...mosbay.com
Cc: mchan@...adcom.com, netdev@...r.kernel.org
Subject: Re: [PATCH] tg3 : avoid an expensive divide
From: Eric Dumazet <dada1@...mosbay.com>
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists