linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/bitops.h: use IS_IMMEDIATE instead of dirrect call of __builtin_constant_p
@ 2016-02-26 13:00 Alexander Kuleshov
  2016-02-27 11:44 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kuleshov @ 2016-02-26 13:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ingo Molnar, x86, linux-kernel, Alexander Kuleshov

The arch/x86/include/asm/bitops.h provides IS_IMMEDIATE macro which expands to
the call of the __builtin_constant_p(). Let's use this macro in the test_bit()
to be more clear.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 arch/x86/include/asm/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index cfe3b95..8cfbd2b 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -333,7 +333,7 @@ static int test_bit(int nr, const volatile unsigned long *addr);
 #endif
 
 #define test_bit(nr, addr)			\
-	(__builtin_constant_p((nr))		\
+	(IS_IMMEDIATE((nr))			\
 	 ? constant_test_bit((nr), (addr))	\
 	 : variable_test_bit((nr), (addr)))
 
-- 
2.7.2.335.g3476f70

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/bitops.h: use IS_IMMEDIATE instead of dirrect call of __builtin_constant_p
  2016-02-26 13:00 [PATCH] x86/bitops.h: use IS_IMMEDIATE instead of dirrect call of __builtin_constant_p Alexander Kuleshov
@ 2016-02-27 11:44 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2016-02-27 11:44 UTC (permalink / raw)
  To: Alexander Kuleshov; +Cc: Thomas Gleixner, Ingo Molnar, x86, linux-kernel


* Alexander Kuleshov <kuleshovmail@gmail.com> wrote:

> The arch/x86/include/asm/bitops.h provides IS_IMMEDIATE macro which expands to
> the call of the __builtin_constant_p(). Let's use this macro in the test_bit()
> to be more clear.
> 
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---
>  arch/x86/include/asm/bitops.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
> index cfe3b95..8cfbd2b 100644
> --- a/arch/x86/include/asm/bitops.h
> +++ b/arch/x86/include/asm/bitops.h
> @@ -333,7 +333,7 @@ static int test_bit(int nr, const volatile unsigned long *addr);
>  #endif
>  
>  #define test_bit(nr, addr)			\
> -	(__builtin_constant_p((nr))		\
> +	(IS_IMMEDIATE((nr))			\
>  	 ? constant_test_bit((nr), (addr))	\
>  	 : variable_test_bit((nr), (addr)))

Why? In the kernel there's more than 200 uses of __builtin_constant_p(), while 
only 6 uses of IS_IMMEDIATE() ...

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-27 11:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 13:00 [PATCH] x86/bitops.h: use IS_IMMEDIATE instead of dirrect call of __builtin_constant_p Alexander Kuleshov
2016-02-27 11:44 ` Ingo Molnar

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).