From: KOCHI Takayoshi <t-kouchi@mvf.biglobe.ne.jp>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] rwlock and atomic_sub on ia64
Date: Wed, 15 Aug 2001 22:29:19 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590698805084@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590698805063@msgid-missing>
On Wed, 15 Aug 2001 15:30:17 -0500
Noah Romer <nromer@lsil.com> wrote:
> On another note, I'm still a little puzzled by the warnings I got when
> using atomic_sub. I was passing a u8 value in as the amount to be
> subtracted, and got four
>
> mptlan.c:1135: warning: comparison is always false due to limited
> range of data type
>
> Now, I can make the warning go away by changing the variable to an int
> (but not by casting the u8 to an int), but it seems odd that gcc would
> complain about the size of a u8 variable making the comparison always
> false. I started poking around in the output for other drivers, and
> found the above warning for all sorts of code (a lot of it involving bh
> data types). This is probably a question for the gcc folks, but . . . ;)
This is because atomic_sub is actually a macro defined in
asm-ia64/atomic.h and it compares value against negative values
to get optimized code.
So, four comparison against negative numbers makes four warnings
for the single atomic_sub.
Here is the quote of atomic_sub
#define atomic_sub_return(i,v) \
((__builtin_constant_p(i) && \
( ( i = 1) || ( i = 4) || ( i = 8) || ( i = 16) \
|| ( i = -1) || ( i = -4) || ( i = -8) || ( i = -16))) \
? ia64_fetch_and_add(-(i), &(v)->counter) \
: ia64_atomic_sub(i, v))
#define atomic_sub(i,v) atomic_sub_return((i), (v))
--
KOCHI Takayoshi <t-kouchi@cq.jp.nec.com/t-kouchi@mvf.biglobe.ne.jp>
next prev parent reply other threads:[~2001-08-15 22:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-13 13:55 [Linux-ia64] rwlock and atomic_sub on ia64 Noah Romer
2001-08-13 17:02 ` Jes Sorensen
2001-08-13 20:40 ` Noah Romer
2001-08-13 20:48 ` Jes Sorensen
2001-08-13 20:54 ` Noah Romer
2001-08-13 20:55 ` David Mosberger
2001-08-14 21:00 ` Noah Romer
2001-08-15 18:37 ` David Mosberger
2001-08-15 20:30 ` Noah Romer
2001-08-15 22:29 ` KOCHI Takayoshi [this message]
2001-08-16 0:25 ` David Mosberger
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=marc-linux-ia64-105590698805084@msgid-missing \
--to=t-kouchi@mvf.biglobe.ne.jp \
--cc=linux-ia64@vger.kernel.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