From: Denis Vlasenko <vda@ilport.com.ua>
To: acx100-devel@lists.sourceforge.net
Cc: Andreas Mohr <andi@rhlx01.fht-esslingen.de>, netdev@vger.kernel.org
Subject: Re: [PATCH] acx: make firmware statistics parsing more intelligent
Date: Fri, 3 Feb 2006 14:39:14 +0200 [thread overview]
Message-ID: <200602031439.14467.vda@ilport.com.ua> (raw)
In-Reply-To: <20060203105857.GB11173@rhlx01.fht-esslingen.de>
On Friday 03 February 2006 12:58, Andreas Mohr wrote:
> - adev->tx_head = (head + 1) % TX_CNT;
> + /* slower: adev->tx_head = (head + 1) % TX_CNT; */
> + adev->tx_head = head + 1;
> + if (adev->tx_head >= TX_CNT)
> + adev->tx_head = 0;
struct a {
int tx_head;
};
#define TX_CNT 16
void f(struct a *adev, int head) {
adev->tx_head = (head + 1) % TX_CNT;
}
void g(struct a *adev, int head) {
adev->tx_head = head + 1;
if (adev->tx_head >= TX_CNT)
adev->tx_head = 0;
}
gcc -Os -S t.c -fomit-frame-pointer -falign-functions=1 -falign-labels=1 -falign-loops=1 -falign-jumps=1 -mtune=i386 -march=i386
produces:
f:
movl 8(%esp), %eax
incl %eax
movl $16, %edx
movl %edx, %ecx
cltd
idivl %ecx
movl 4(%esp), %eax
movl %edx, (%eax)
ret
.size f, .-f
.globl g
.type g, @function
g:
movl 4(%esp), %edx
movl 8(%esp), %eax
incl %eax
movl %eax, (%edx)
cmpl $15, %eax
jle .L6
movl $0, (%edx)
.L6:
ret
.size g, .-g
.ident "GCC: (GNU) 4.0.0"
Well, gcc obviously failed to realize that "% 16" == "& 15".
I'll file a bug. Meanwhile, with & 15 f() is better:
f:
movl 8(%esp), %eax
incl %eax
andl $15, %eax
movl 4(%esp), %edx
movl %eax, (%edx)
ret
.size f, .-f
.globl g
.type g, @function
g:
movl 4(%esp), %edx
movl 8(%esp), %eax
incl %eax
movl %eax, (%edx)
cmpl $15, %eax
jle .L6
movl $0, (%edx)
.L6:
ret
.size g, .-g
.ident "GCC: (GNU) 4.0.0"
--
vda
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x103432&bid#0486&dat\x121642
next prev parent reply other threads:[~2006-02-03 12:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-03 10:58 [PATCH] acx: make firmware statistics parsing more intelligent Andreas Mohr
2006-02-03 12:39 ` Denis Vlasenko [this message]
2006-02-03 13:28 ` Denis Vlasenko
2006-02-03 13:56 ` Andreas Mohr
2006-02-04 11:31 ` Denis Vlasenko
2006-02-08 12:54 ` Andreas Mohr
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=200602031439.14467.vda@ilport.com.ua \
--to=vda@ilport.com.ua \
--cc=acx100-devel@lists.sourceforge.net \
--cc=andi@rhlx01.fht-esslingen.de \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).