On Thu, Feb 18, 2021 at 11:51:43PM +0100, Rasmus Villemoes wrote:
On 18/02/2021 05.05, Yury Norov wrote:
BITMAP_{LAST,FIRST}_WORD_MASK() in linux/bitmap.h duplicates the
functionality of GENMASK(). The scope of there macros is wider
than just bitmap. This patch defines 4 new macros: BITS_FIRST(),
BITS_LAST(), BITS_FIRST_MASK() and BITS_LAST_MASK() in linux/bits.h
on top of GENMASK() and replaces BITMAP_{LAST,FIRST}_WORD_MASK()
to avoid duplication and increase the scope of the macros.
Please include some info on changes in generated code, if any. When the
parameter to the macro is a constant I'm sure it all folds to a
compile-time constant either way, but when it's not, I'm not sure gcc
can do the same optimizations when the expressions become more complicated.
After applying all patches till "tools: introduce SMALL_CONST() macro",
there's no visible changes in code generation:
scripts/bloat-o-meter vmlinux.before vmlinux
add/remove: 1/2 grow/shrink: 2/0 up/down: 17/-16 (1)
Function old new delta
ethtool_get_drvinfo 900 908 +8
e843419@0cf2_0001309d_7f0 - 8 +8
vermagic 48 49 +1
e843419@0d45_000138bb_f68 8 - -8
e843419@0cc9_00012bce_198c 8 - -8
Total: Before=26092016, After=26092017, chg +0.00%
The build is arm64, and the compilerr is:
aarch64-linux-gnu-gcc (Linaro GCC 7.3-2018.05) 7.3.1 20180425