linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Remus <jremus@linux.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	Fangrui Song <maskray@sourceware.org>
Cc: Indu Bhagat <indu.bhagat@oracle.com>,
	Jan Beulich <jbeulich@suse.com>,
	Rainer Orth <ro@cebitec.uni-bielefeld.de>,
	"linux-toolchains@vger.kernel.org"
	<linux-toolchains@vger.kernel.org>,
	Sterling Augustine <saugustine@google.com>,
	Pavel Labath <labath@google.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Serhei Makarov <smakarov@redhat.com>,
	Binutils <binutils@sourceware.org>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>
Subject: Re: Unaligned access trade-offs for SFrame FRE layout
Date: Thu, 18 Sep 2025 12:39:18 +0200	[thread overview]
Message-ID: <7549e3bb-a956-4706-8735-415df61ea1a1@linux.ibm.com> (raw)
In-Reply-To: <20250916115801.622c629b@batman.local.home>

On 9/16/2025 5:58 PM, Steven Rostedt wrote:
> On Mon, 15 Sep 2025 23:05:09 -0700
> Fangrui Song <maskray@sourceware.org> wrote:
> 
>> From a linker and binary utilities perspective, I'd even suggest  
>> adopting a universal little-endian format regardless of the target
>> system's native endianness.
>> This would eliminate the need for endianness templates in the C++ code
>> and simplify toolchain implementation across platforms.
>>
>> On the big-endian z/Architecture, this is efficient: the LOAD REVERSED
>> instructions are used by the bswap versions in the following program,
>> not even requiring extra instructions.
>> #define WIDTH(x) \
>> typedef __UINT##x##_TYPE__ [[gnu::aligned(1)]] uint##x; \
>> uint##x load_inc##x(uint##x *p) { return *p+1; } \
>> uint##x load_bswap_inc##x(uint##x *p) { return __builtin_bswap##x(*p)+1; }; \
>> uint##x load_eq##x(uint##x *p) { return *p==3; } \
>> uint##x load_bswap_eq##x(uint##x *p) { return __builtin_bswap##x(*p)==3; }; \
>>
>> WIDTH(16);
>> WIDTH(32);
>> WIDTH(64);
> 
> I would like to hear the comments from Jens on this, as he's adapting
> SFrames for the s390 which I believe is big-endian.

This would allow for endianness bugs for the native case only on s390
(and other big-endian architectures).

Load Reversed takes longer than a normal Load, as it obviously needs to
reverse the register contents.

Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/


  reply	other threads:[~2025-09-18 10:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12 17:34 Unaligned access trade-offs for SFrame FRE layout Indu Bhagat
2025-09-12 18:19 ` Segher Boessenkool
2025-09-12 19:18 ` Steven Rostedt
2025-09-13  7:56   ` Indu Bhagat
2025-09-15 16:04     ` Steven Rostedt
     [not found]   ` <CAEG7qUxk_cZYv3X_VM6+ZGaVFAD-7jdPd3xA92xYHUAqyzb2Xw@mail.gmail.com>
2025-09-13  8:01     ` Indu Bhagat
2025-09-14 14:14 ` Jan Beulich
2025-09-14 14:39   ` Rainer Orth
2025-09-14 15:23     ` Jan Beulich
2025-09-14 16:18       ` Rainer Orth
2025-09-14 18:10         ` Jan Beulich
2025-09-15  5:42           ` Indu Bhagat
2025-09-15 16:07             ` Steven Rostedt
2025-09-15 17:22               ` Segher Boessenkool
2025-09-16  6:05               ` Fangrui Song
2025-09-16 15:58                 ` Steven Rostedt
2025-09-18 10:39                   ` Jens Remus [this message]
2025-09-16 16:03                 ` Indu Bhagat
2025-09-16 16:32                   ` Fangrui Song
2025-09-16 16:44                     ` Segher Boessenkool
2025-09-16 17:05                       ` Fangrui Song
2025-09-16 17:54                       ` Segher Boessenkool
2025-09-16 17:33                     ` Indu Bhagat
2025-09-17 21:12                 ` Steven Rostedt
2025-09-17 23:55                   ` Alan Modra
2025-09-15  9:08       ` Segher Boessenkool

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=7549e3bb-a956-4706-8735-415df61ea1a1@linux.ibm.com \
    --to=jremus@linux.ibm.com \
    --cc=andrii@kernel.org \
    --cc=binutils@sourceware.org \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=indu.bhagat@oracle.com \
    --cc=jbeulich@suse.com \
    --cc=jpoimboe@kernel.org \
    --cc=labath@google.com \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=maskray@sourceware.org \
    --cc=ro@cebitec.uni-bielefeld.de \
    --cc=rostedt@goodmis.org \
    --cc=saugustine@google.com \
    --cc=smakarov@redhat.com \
    /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).