Deutsch English Français Italiano |
<vk8o2c$in5m$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Thomas Koenig <tkoenig@netcologne.de> Newsgroups: comp.arch Subject: Re: unaligned load/store Date: Sun, 22 Dec 2024 10:01:48 -0000 (UTC) Organization: A noiseless patient Spider Lines: 52 Message-ID: <vk8o2c$in5m$1@dont-email.me> References: <memo.20241128153105.12904U@jgd.cix.co.uk> <jwvcyi87lva.fsf-monnier+comp.arch@gnu.org> <vini47$sgi$1@gal.iecc.com> <jwvldww6253.fsf-monnier+comp.arch@gnu.org> <vio4ge$1eka$1@gal.iecc.com> <jwvmshc49i0.fsf-monnier+comp.arch@gnu.org> <9534a1cd1364f2127a1951cc85002f29@www.novabbs.org> <lsp0tqFs7aoU1@mid.individual.net> <cadda24092db49d26e62096c589fbf9c@www.novabbs.org> Injection-Date: Sun, 22 Dec 2024 11:01:48 +0100 (CET) Injection-Info: dont-email.me; posting-host="dac7c968c376fb8da72d8bd888237552"; logging-data="613558"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dgsd5AbiNw8T5VWNvnKTYAPqxlgUfPWY=" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:njMhKqz/qFzpt2TCGGPwhB+ADnc= Bytes: 2891 MitchAlsup1 <mitchalsup@aol.com> schrieb: > On Sat, 21 Dec 2024 23:22:35 +0000, Jonathan Thornburg wrote: > Any competent programmer will ALIGN his data to the extend possible > there is no reason to penalize {Compiler, assembler, linker, ld.so,...} > just because you want to take 5 days out of design. These days, the competence of many programmers can be called into question :-) ABIs, however, generally require natural alignment for types, so the point is somehwat moot, at least where user code is concerned. Consider typedef struct { unsigned char a; unsigned long b; } mytype; unsigned long add (mytype *x) { return x->a + x->b; } which gets translated into ldub r2,[r1] ldd r1,[r1,8] add r1,r1,r2 ret so the cost for the tool chain is already spent (or is spent again and again if people use structs like the above). I think the VAX was the last major architecture which specified unaligned struct access. > On Sat, 21 Dec 2024 23:22:35 +0000, Jonathan Thornburg wrote: >> So yes, allowing unaligned access does help "dusty deck" Fortran code... >> but it comes at a significant cost. Fortran compilers, even on machines which allow misalignment, use ABIs which specify alignment for COMMON blocks, in violation of the Fortran standard. They usually have a flag for when the user actually needs to have no padding. Code which which would not work with padding would have to be dusty indeed (fossilized?) if it used COMMON blocks that way. It would never have run on early RISCs, so it would likely have had a time of non-use in the 1990s when RISCs ruled in price/performance after mainframes and the VAX fell behind.