mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "John Anthony Kazos Jr." <jakj@j-a-k-j.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Matthieu CASTET <castet.matthieu@free.fr>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ubi: kill homegrown endian macros
Date: Fri, 18 May 2007 07:52:39 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.0.99.0705180750550.8830@sigma.j-a-k-j.com> (raw)
In-Reply-To: <1179458274.2859.538.camel@shinybook.infradead.org>

On Fri, 18 May 2007, David Woodhouse wrote:
> On Thu, 2007-05-17 at 22:57 -0400, John Anthony Kazos Jr. wrote:
> > Wouldn't the appropriate test be to demonstrate that the same program text 
> > opcodes are generated in both cases for all architectures? 
> 
> No, empirical testing with the compiler is never the _correct_ thing to
> do. It's just expedient.
> 
> > If that's not the case, even if the generation isn't -worse-, it shows
> > that the compiler is doing different things with each, which means
> > different versions of the compiler could do different things with it,
> 
> Well yes, but even it _is_ generating precisely the same output today,
> there's no reason why the compiler shouldn't behave differently under a
> different phase of the moon.
> 
> The _correct_ thing to do is act upon my mutterings at the time I
> removed the '__attribute__((packed))' from various JFFS2 structures to
> improve the generated code on ARM -- actually implement an attribute for
> GCC which has the same "don't insert any padding" meaning, but without
> the unwanted "assume arbitrary alignment" implications.

Out of curiosity, why would a compiler ever insert padding in a structure 
that has all its elements properly-aligned?

> It'd actually be nice if GCC knew about endianness too. I don't want to
> have to do:
> 
>    *x = le32_to_cpu(cpu_to_le32(*x) + 5);
> 
> I just want 
> 
>   uint32_t __attribute__((littleendian)) *x;
> 
>   *x += 5;
> 
> I know we can hack around it for masks, with '*x |= cpu_to_le32(X_BAR);'
> and such like, and we can load it into local native-endian variables and
> then copy it back again later -- but it's better just to let the
> compiler know what's going on and do its own optimisation. Especially on
> architectures which have 'load-and-swap' or 'store-and-swap'
> instructions.

  reply	other threads:[~2007-05-18 11:53 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17 14:32 Christoph Hellwig
2007-05-17 14:50 ` Artem Bityutskiy
2007-05-17 14:56   ` Christoph Hellwig
2007-05-17 15:09     ` Artem Bityutskiy
2007-05-17 17:29       ` Andrew Morton
2007-05-17 17:46         ` Artem Bityutskiy
2007-05-17 18:18           ` Andrew Morton
2007-05-17 20:32             ` Artem Bityutskiy
2007-05-17 20:30         ` Matthieu CASTET
2007-05-18  2:39           ` David Woodhouse
2007-05-18  2:57             ` John Anthony Kazos Jr.
2007-05-18  3:17               ` David Woodhouse
2007-05-18 11:52                 ` John Anthony Kazos Jr. [this message]
2007-05-18 14:52                   ` David Woodhouse
2007-05-18 22:00                     ` Segher Boessenkool
2007-05-19  2:07                       ` David Woodhouse
2007-05-19 12:24                         ` Segher Boessenkool
2007-05-20 11:29                           ` David Woodhouse
2007-05-18 19:55             ` matthieu castet
2007-05-19  1:29               ` David Woodhouse
2007-05-18 20:30             ` matthieu castet
2007-05-17 20:42         ` Al Viro
2007-05-17 20:53           ` Al Viro
2007-05-18  6:58             ` Artem Bityutskiy
2007-05-18  8:38               ` Al Viro
2007-05-17 21:14           ` Dmitry Torokhov
2007-05-17 21:29             ` Al Viro
2007-05-17 21:33             ` David Miller
2007-05-17 21:47               ` Al Viro
2007-05-17 21:26           ` Al Viro
2007-05-17 20:56   ` David Miller
2007-05-17 21:03     ` Al Viro
2007-05-17 15:50 ` David Woodhouse
2007-05-17 18:12   ` Christoph Hellwig
2007-05-17 18:23     ` Sam Ravnborg
2007-05-17 18:36       ` Christoph Hellwig
2007-05-17 20:18         ` Jeremy Fitzhardinge
2007-05-17 20:27 ` Matthieu CASTET

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=alpine.DEB.0.99.0705180750550.8830@sigma.j-a-k-j.com \
    --to=jakj@j-a-k-j.com \
    --cc=castet.matthieu@free.fr \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®