summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2020-05-27 12:32:36 +0200
committerWill Deacon <will@kernel.org>2020-06-05 11:38:58 +0100
commit1fd76043ecb04b8567a76b106db09ac778e1e2b8 (patch)
treea29c94b5c48cbd75aca9a9a04a324dca7a7b054d /scripts
parentb16d8ecf4fa17e16fff20638364f9bd2205615e7 (diff)
compiler_types.h: Optimize __unqual_scalar_typeof compilation time
If the compiler supports C11's _Generic, use it to speed up compilation times of __unqual_scalar_typeof(). GCC version 4.9 or later and all supported versions of Clang support the feature (the oldest supported compiler that doesn't support _Generic is GCC 4.8, for which we use the slower alternative). The non-_Generic variant relies on multiple expansions of __pick_integer_type -> __pick_scalar_type -> __builtin_choose_expr, which increases pre-processed code size, and can cause compile times to increase in files with numerous expansions of READ_ONCE(), or other users of __unqual_scalar_typeof(). Summary of compile-time benchmarking done by Arnd Bergmann: <baseline normalized time> clang-11 gcc-9 this patch 0.78 0.91 ideal 0.76 0.86 See https://lkml.kernel.org/r/CAK8P3a3UYQeXhiufUevz=rwe09WM_vSTCd9W+KvJHJcOeQyWVA@mail.gmail.com Further compile-testing done with: gcc 4.8, 4.9, 5.5, 6.4, 7.5, 8.4; clang 9, 10. Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Peter Zijlstra <peterz@infradead.org> Tested-by: Arnd Bergmann <arnd@arndb.de> Link: https://lkml.kernel.org/r/20200527103236.148700-1-elver@google.com Link: https://lkml.kernel.org/r/CAK8P3a0RJtbVi1JMsfik=jkHCNFv+DJn_FeDg-YLW+ueQW3tNg@mail.gmail.com [will: tweak new macros to make them a bit more readable] Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions