mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i386: optimize swab64
Date: 25 Apr 2005 17:53:07 +0200	[thread overview]
Date: Mon, 25 Apr 2005 17:53:07 +0200	[thread overview]
Message-ID: <20050425155307.GB65287@muc.de> (raw)
In-Reply-To: <200504251019.30173.vda@port.imtp.ilyichevsk.odessa.ua>

On Mon, Apr 25, 2005 at 10:19:30AM +0300, Denis Vlasenko wrote:
> I noticed that swab64 explicitly swaps 32-bit halves, but this is
> not really needed because CPU is 32-bit anyway and we can
> just tell GCC to treat registers as being swapped.

No, we went through this exactly when the code was originally done.
gcc puts long long only into aligned register pairs, and with 
register swap you need at least 4 registers which blows near
all possible registers away and completely breaks register
allocation in the function. Dont apply this!

-Andi

> 
> Example of resulting code:
> 
>        mov    0x20(%ecx,%edi,8),%eax
>        mov    0x24(%ecx,%edi,8),%edx
>        lea    0x1(%edi),%esi
>        mov    %esi,0xfffffdf4(%ebp)
>        mov    %eax,%ebx
>        mov    %edx,%esi
>        bswap  %ebx
>        bswap  %esi
>        mov    %esi,0xffffff74(%ebp,%edi,8)
>        mov    %ebx,0xffffff78(%ebp,%edi,8)
> 
> As you can see, swap is achieved simply by using
> appropriate registers in last two insns.
> 
> (Why does gcc do extra register moves just before bswaps
> is another question. No regression here, old code had them too)

  reply	other threads:[~2005-04-25 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-25  7:19 Denis Vlasenko
2005-04-25 15:53 ` Andi Kleen [this message]
2005-04-26 11:12   ` Denis Vlasenko

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=20050425155307.GB65287@muc.de \
    --to=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /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®