[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <caa22904d2d7469595dcc5cb1f11be89@AcuMS.aculab.com>
Date: Wed, 4 Oct 2023 14:10:40 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Clément Léger' <cleger@...osinc.com>,
Conor Dooley <conor@...nel.org>
CC: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Atish Patra <atishp@...osinc.com>,
Andrew Jones <ajones@...tanamicro.com>,
Evan Green <evan@...osinc.com>,
Björn Topel <bjorn@...osinc.com>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Ron Minnich <rminnich@...il.com>,
Daniel Maslowski <cyrevolt@...glemail.com>
Subject: RE: [PATCH 0/7] Add support to handle misaligned accesses in S-mode
...
> Saying that you support misaligned access does not mean that they are
> going to be efficient, just that they are supported (in fact, the uABI
> state that they may perform poorly). The compiler is actually not so
> stupid and will try to do as much aligned access as possible in what it
> generates (unless forced by some assembly, cast or whatever that can
> screw up alignment accesses). This is already the case and it will most
> probably not change.
I did a quick check.
https://godbolt.org/z/j3e9drv4e
The code generated by both clang and gcc for misaligned reads is horrid.
Gcc does a better job if the alignment is known but generates much
the same as the clang code when it isn't.
The C code is much shorter.
Even though both gcc and clang add a (different) instruction to it
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists