public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Alexey Salmin <alexey.salmin@gmail.com>
Cc: Tristan Gingold <gingold@adacore.com>,
	"H.J. Lu" <hjl.tools@gmail.com>,
	        Pawe? Sikora <pluto@agmk.net>,
	gcc@gcc.gnu.org
Subject: Re: (un)aligned accesses on x86 platform.
Date: Tue, 16 Mar 2010 18:31:00 -0000	[thread overview]
Message-ID: <20100316161539.GA3601@sunsite.ms.mff.cuni.cz> (raw)
In-Reply-To: <87a8dc11003160904p678114cbj9522a62613f184f9@mail.gmail.com>

On Tue, Mar 16, 2010 at 10:04:04PM +0600, Alexey Salmin wrote:
> >> Wow. What for?
> >
> > Well, simply because it is not compiled with strict alignment.  There might also be some optimization in
> > memory operation that does unaligned accesses.
> 
> I always thought that unaligned access is much slower than aligned
> one. You mean code-size optimizations?

It is, but if you need to choose between doing say an unaligned 32-bit
read access and reading it in 4 8-bit reads and assembling those together,
on many targets that do allow unaligned accesses the former is much faster.
Especially if in most cases the read is actually aligned and only in rare
cases it is unaligned...

	Jakub

  parent reply	other threads:[~2010-03-16 16:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-08 15:37 Paweł Sikora
2010-03-08 15:45 ` Andrew Pinski
2010-03-08 15:46 ` Richard Guenther
2010-03-08 21:11   ` Paweł Sikora
2010-03-16 15:05 ` H.J. Lu
2010-03-16 15:11   ` Tristan Gingold
2010-03-16 15:48     ` Alexey Salmin
2010-03-16 16:02       ` Tristan Gingold
2010-03-16 16:08         ` Alexey Salmin
2010-03-16 16:16           ` Piotr Wyderski
2010-03-16 18:31           ` Jakub Jelinek [this message]
2010-03-17 15:43   ` Mikael Pettersson

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=20100316161539.GA3601@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=alexey.salmin@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gingold@adacore.com \
    --cc=hjl.tools@gmail.com \
    --cc=pluto@agmk.net \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).