From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: torvalds@osdl.org
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: [PATCH 4/8] AVR32: Fix oversize immediates in atomic.h
Date: Tue, 24 Oct 2006 10:12:42 +0200 [thread overview]
Message-ID: <11616775661978-git-send-email-hskinnemoen@atmel.com> (raw)
In-Reply-To: <11616775661390-git-send-email-hskinnemoen@atmel.com>
When calling e.g. atomic_sub_return with a large constant, the
compiler may output an immediate that is too large for the sub
instruction in the middle of the loop.
Fix this by explicitly specifying the number of bits allowed in the
constraint. Also stop atomic_add_return() and friends from falling
back to their respective "sub" variants if the constant is too large
to fit in an immediate.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
include/asm-avr32/atomic.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index e0b9c44..c40b603 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -41,7 +41,7 @@ static inline int atomic_sub_return(int
" stcond %1, %0\n"
" brne 1b"
: "=&r"(result), "=o"(v->counter)
- : "m"(v->counter), "ir"(i)
+ : "m"(v->counter), "rKs21"(i)
: "cc");
return result;
@@ -58,7 +58,7 @@ static inline int atomic_add_return(int
{
int result;
- if (__builtin_constant_p(i))
+ if (__builtin_constant_p(i) && (i >= -1048575) && (i <= 1048576))
result = atomic_sub_return(-i, v);
else
asm volatile(
@@ -101,7 +101,7 @@ static inline int atomic_sub_unless(atom
" mov %1, 1\n"
"1:"
: "=&r"(tmp), "=&r"(result), "=o"(v->counter)
- : "m"(v->counter), "ir"(a), "ir"(u)
+ : "m"(v->counter), "rKs21"(a), "rKs21"(u)
: "cc", "memory");
return result;
@@ -121,7 +121,7 @@ static inline int atomic_add_unless(atom
{
int tmp, result;
- if (__builtin_constant_p(a))
+ if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576))
result = atomic_sub_unless(v, -a, u);
else {
result = 0;
--
1.4.1.1
next prev parent reply other threads:[~2006-10-24 8:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-24 8:12 [PATCH 0/8] AVR32 update Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 1/8] AVR32: Minor Makefile cleanup Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 2/8] AVR32: Silence some compile warnings Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 3/8] AVR32: Don't try to iounmap P2 segment addresses Haavard Skinnemoen
2006-10-24 8:12 ` Haavard Skinnemoen [this message]
2006-10-24 8:12 ` [PATCH 5/8] AVR32: add io{read,write}{8,16,32}{be,} support Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 6/8] AVR32: Implement and export __raw_{read,write}s[bwl] Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 7/8] AVR32: Use __raw MMIO access for internal peripherals Haavard Skinnemoen
2006-10-24 8:12 ` [PATCH 8/8] AVR32: Update defconfig Haavard Skinnemoen
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=11616775661978-git-send-email-hskinnemoen@atmel.com \
--to=hskinnemoen@atmel.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/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
all inboxes | Powered by JetHome®