Deutsch English Français Italiano |
<2024Dec22.120626@mips.complang.tuwien.ac.at> 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: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.arch Subject: Re: unaligned load/store Date: Sun, 22 Dec 2024 11:06:26 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 32 Message-ID: <2024Dec22.120626@mips.complang.tuwien.ac.at> 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> <vk8o2c$in5m$1@dont-email.me> Injection-Date: Sun, 22 Dec 2024 12:35:47 +0100 (CET) Injection-Info: dont-email.me; posting-host="885e4e6d52c05c7d84d625a997c57f33"; logging-data="634879"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HgL1jTCWQ8bWfC7TD6KcN" Cancel-Lock: sha1:7iMnYmGCzpPoTFmmLtC/u+aL06w= X-newsreader: xrn 10.11 Bytes: 2642 Thomas Koenig <tkoenig@netcologne.de> writes: >ABIs, however, generally require natural alignment for types, so >the point is somehwat moot, at least where user code is concerned. Let's weaken this to "good ABIs require natural alignment for basic types". Intel has erred in both directions: * In its IA32 ABI, they required 4-byte alignment for 8-byte FP data, while their hardware traps (with the AC flag set) when accessing an 8-byte FP value on a 4-byte-aligned address that is not 8-byte-aligned. This makes the AC flag useless. * They made SSE/SSE2 instructions require 16-byte alignment irrespective of the basic data type; as a result, at leas one AMD64 ABI requires 16-byte alignment of the stack on call boundaries, which means that many functions have to adjust the stack pointer in order to reach that alignment (the CALL instruction changes the stack pointer by 8). That's apparently based on the theory that using load and op and movdqa is faster than movdqu, which is questionable <https://www.complang.tuwien.ac.at/anton/autovectors/>. >I think >the VAX was the last major architecture which specified unaligned >struct access. The 4-byte alignment for 8-byte floats on IA-32 also holds for struct fields. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>