From: Ivo van Doorn <ivdoorn@gmail.com>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
rt2400-devel@lists.sourceforge.net,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH 01/11 v3] rt2x00: Calculate register offset during compile time
Date: Wed, 4 Jun 2008 00:10:46 +0200 [thread overview]
Message-ID: <200806040010.46530.IvDoorn@gmail.com> (raw)
In-Reply-To: <1212527937.6340.18.camel@brick>
On Tuesday 03 June 2008, Harvey Harrison wrote:
> On Tue, 2008-06-03 at 22:45 +0200, Ivo van Doorn wrote:
> > By using __ffs() the register offsets were always calculated
> > at run-time which all FIELD32/FIELD16 definitions were builtin
> > constants. This means we can heavily optimize the register handling
> > by allowing GCC to do all the work during compilation.
> >=20
> > Add some compile_ffs() macros to perform the calculation at
> > compile time. After this each rt2x00 module size is reduced
> > by ~2500 bytes. And the stack size of several functions is reduced
> > as well which further limits the number of rt2x00 results in
> > 'make checkstack'.
> > +/*
> > + * Macro's to find first set bit in a variable.
> > + * These macro's behaves the same as the __ffs() function with
> > + * the most important difference that this is done during
> > + * compile-time rather then run-time.
> > + */
>=20
> #define const_ffs8(__x) ( \
> BUILD_BUG_ON(!__builtin_constant_p(__x)); \
> __builtin_choose_expr((__x) & 0x01, 0, \
> =EF=BB=BF__builtin_choose_expr((__x) & 0x02, 1, \
> =EF=BB=BF__builtin_choose_expr((__x) & 0x04, 2, \
> =EF=BB=BF__builtin_choose_expr((__x) & 0x08, 3, \
> =EF=BB=BF__builtin_choose_expr((__x) & 0x10, 4, \
> =EF=BB=BF__builtin_choose_expr((__x) & 0x20, 5, \
> =EF=BB=BF__builtin_choose_expr((__x) & 0x40, 6, \
> =EF=BB=BF__builtin_choose_expr((__x) & 0x80, 7, \
> 8)))))))); )
>=20
> #define const_ffs16(__x) ( \
> __builtin_choose_expr((__x) & 0xff, \
> const_ffs8(__x), \
> const_ffs8((__x) >> 8) + 8); )
>=20
> =EF=BB=BF
> #define const_ffs32(__x) ( \
> __builtin_choose_expr((__x) & 0xffff, \
> const_ffs16(__x), \
> const_ffs16((__x) >> 16) + 16); )
>=20
>=20
> Just a thought.
Thanks for the tipe, that does sound a lot cleaner then the ? : stateme=
nts,
I did a quick compilation check and it doesn't seem to have any influen=
ce.
I'll move the __builtin_choose_expr into rt2x00.git for testing and mov=
e
that patch upstream to wireless-2.6 later.
Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-06-03 22:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200806032024.52931.IvDoorn@gmail.com>
2008-06-03 18:29 ` [PATCH 01/11] rt2x00: Calculate register offset during compile time Ivo van Doorn
2008-06-03 20:05 ` [PATCH 01/11 v2] " Ivo van Doorn
2008-06-03 20:32 ` Johannes Berg
2008-06-03 20:44 ` Ivo van Doorn
2008-06-03 20:45 ` [PATCH 01/11 v3] " Ivo van Doorn
2008-06-03 20:41 ` Johannes Berg
2008-06-03 21:18 ` Harvey Harrison
2008-06-03 22:10 ` Ivo van Doorn [this message]
[not found] ` <200806032025.45029.IvDoorn@gmail.com>
2008-06-03 18:29 ` [PATCH 02/11] rt2x00: Fix compile-time ffs calculation macros Ivo van Doorn
2008-06-03 18:52 ` Johannes Berg
2008-06-03 20:02 ` Ivo van Doorn
[not found] ` <200806032026.16128.IvDoorn@gmail.com>
2008-06-03 18:29 ` [PATCH 03/11] rt2x00: Make rt2x00_set/get_field macros Ivo van Doorn
[not found] ` <200806032026.40506.IvDoorn@gmail.com>
2008-06-03 18:29 ` [PATCH 04/11] rt2x00: Restrict DMA to 32-bit addresses Ivo van Doorn
[not found] ` <200806032027.06094.IvDoorn@gmail.com>
2008-06-03 18:29 ` [PATCH 05/11] rt2x00: Don't kill guardian_urb when it wasn't created Ivo van Doorn
2008-06-03 20:02 ` Stefanik Gábor
[not found] ` <200806032027.27540.IvDoorn@gmail.com>
2008-06-03 18:29 ` [PATCH 06/11] rt2x00: Removed unused descriptor read in txdone Ivo van Doorn
[not found] ` <200806032027.47342.IvDoorn@gmail.com>
2008-06-03 18:29 ` [PATCH 07/11] rt2x00: Remove CTS/RTS check in tx() Ivo van Doorn
[not found] ` <200806032028.03154.IvDoorn@gmail.com>
2008-06-03 18:30 ` [PATCH 08/11] rt2x00: Move led initialization into function Ivo van Doorn
[not found] ` <200806032028.21795.IvDoorn@gmail.com>
[not found] ` <200806032028.39575.IvDoorn@gmail.com>
2008-06-03 18:29 ` [PATCH 10/11] rt2x00: Fix queue initialization Ivo van Doorn
2008-06-03 18:29 ` [PATCH 11/11] rt2x00: Release rt2x00 2.1.7 Ivo van Doorn
2008-06-03 18:30 ` [PATCH 09/11] rt2x00: Cleanup/optimize set_state() function callback function Ivo van Doorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200806040010.46530.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=harvey.harrison@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=rt2400-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).