lkml.org 
[lkml]   [2007]   [Jul]   [23]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 24 Jul 2007 13:57:21 +1000
FromNick Piggin <>
SubjectRe: [PATCH 6/8] i386: bitops: Don't mark memory as clobbered unnecessarily
Satyam Sharma wrote:
> From: Satyam Sharma <ssatyam@cse.iitk.ac.in>
> 
> [6/8] i386: bitops: Don't mark memory as clobbered unnecessarily
> 
> The goal is to let gcc generate good, beautiful, optimized code.
> 
> But test_and_set_bit, test_and_clear_bit, __test_and_change_bit,
> and test_and_change_bit unnecessarily mark all of memory as clobbered,
> thereby preventing gcc from doing perfectly valid optimizations.
> 
> The case of __test_and_change_bit() is particularly surprising, given
> that it's a variant where we don't make any guarantees at all.

__test_and_change_bit is one that you could remove the memory clobber
from.

> ---
> 
>  include/asm-i386/bitops.h |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
> index 0f5634b..f37b8a2 100644
> --- a/include/asm-i386/bitops.h
> +++ b/include/asm-i386/bitops.h
> @@ -254,7 +254,7 @@ static inline int __test_and_change_bit(int nr, unsigned long *addr)
>  	__asm__ __volatile__(
>  		"btcl %2,%1\n\tsbbl %0,%0"
>  		:"=r" (oldbit),"=m" (*addr)
> -		:"r" (nr) : "memory");
> +		:"r" (nr));
>  	return oldbit;
>  }
> 


-- 
SUSE Labs, Novell Inc.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-24 03:59    [from the cache]
©2003-2008