Article View: comp.arch
Article #879Re: Large constants in RISC
From: Terje Mathisen
Date: Sun, 22 Nov 2026 08:14
Date: Sun, 22 Nov 2026 08:14
65 lines
4456 bytes
4456 bytes
MitchAlsup wrote: > Michael S <already5chosen@yahoo.com> posted: > >> On Fri, 20 Nov 2026 15:23:23 GMT >> scott@slp53.sl.home (Scott Lurndal) wrote: >> >>> Michael S <already5chosen@yahoo.com> writes: >>>> On Thu, 19 Nov 2026 23:19:31 GMT >>>> scott@slp53.sl.home (Scott Lurndal) wrote: >>>> >>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes: >>>>>> aph@littlepinkcloud.invalid [2026-11-19 09:42:51] wrote: >>>>>>> In a way, it does. Most large constants I see are addresses. >>>>>>> AArch64 (almost) always has a 48-bit user space, so except for >>>>>>> floating-point doubles and the very occasional large integer, >>>>>>> constant loads look like >>>>>>> >>>>>>> mov x0, 42857; movk x0, 0x60b8, lsl 16; movk x0, 0xaaaa, lsl >>>>>>> 32 >>>>>> >>>>>> Interesting. I would have expected that most AArch64 code is >>>>>> position independent (e.g. for address space randomization >>>>>> purposes), so I wonder in which circumstances we end up with such >>>>>> instruction sequences to build hardcoded addresses. >>>>> >>>>> Consider the case where one is creating the 64-bit address >>>>> (virtual or physical) of a hardware component, or a VDSO. >>>> >>>> The vast majority of hardware addresses are not absolute addresses, >>>> but offsets relative to dynamically assigned PCI BARs. Therefore, >>>> constants larger than 30 bits are rare. Even 24 bits are uncommon. >>> >>> I work today with systems that support > 32-bit PCI express BARs. >>> >>> Note that from the host perspective, the base address programmed in >>> the PCI-Express/PCI BARs is 64-bit. While the _offset_ to a register >>> may be smaller than 32-bits (I've worked with devices that have larger >>> BARs), the absoluate host address once the BAR has been mapped into >>> the physical address space is 64-bits. >> >> Of course, it's 64-bit. >> But host does not know upper bits at compile time. Except for deeply >> embedded hosts. But in 64-bit land those are rarity. >> >> I read that back in previous century, esp. before 1990, people >> regenerated their OSes after every change in HW configuration. I did so well into the 2000s, when I recompiled FreeBSD for the kernel pulse per second input into the core OS hardware clock. This was crucial for optimal performance with a local GPS timing receiver like the Oncore or (a few years later) the SURE evaluation board. This was before spread spectrum system clocks, getting sub-50 ns was absolutely doable. > > We don't do it now, do we? No, the PPS module is just that, a module, these days. Terje -- - <Terje.Mathisen at tmsw.no> "almost all programming can be viewed as an exercise in caching"
Technical Details
Message-ID:
<11du89b$p9ao$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11d76uq$11cdc$1@paganini.bofh.team> <11d7ct8$17akn$1@dont-email.me> <11d7ih2$11orr$1@paganini.bofh.team> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <2026Nov14.201017@mips.complang.tuwien.ac.at> <6af911ea.18530156@news.eternal-september.org> <SYScnWsR3rgGWWP3nZ2dnZfqn_WdnZ2d@supernews.com> <jwv1p8hhqmy.fsf-monnier+comp.arch@gnu.org> <7uLLS.701$b6r7.107@fx16.iad> <20261120122630.000017cb@yahoo.com> <LBZLS.2021$mfg4.1482@fx36.iad> <20261121195356.00001dd1@yahoo.com> <1795310482-5857@newsgrouper.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Terje Mathisen <terje.mathisen@tmsw.no> Newsgroups: comp.arch Subject: Re: Large constants in RISC Date: Sun, 22 Nov 2026 09:14:34 +0100 Organization: A noiseless patient Spider Lines: 65 Message-ID: <11du89b$p9ao$1@dont-email.me> References: <11d76uq$11cdc$1@paganini.bofh.team> <11d7ct8$17akn$1@dont-email.me> <11d7ih2$11orr$1@paganini.bofh.team> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <2026Nov14.201017@mips.complang.tuwien.ac.at> <6af911ea.18530156@news.eternal-september.org> <SYScnWsR3rgGWWP3nZ2dnZfqn_WdnZ2d@supernews.com> <jwv1p8hhqmy.fsf-monnier+comp.arch@gnu.org> <7uLLS.701$b6r7.107@fx16.iad> <20261120122630.000017cb@yahoo.com> <LBZLS.2021$mfg4.1482@fx36.iad> <20261121195356.00001dd1@yahoo.com> <1795310482-5857@newsgrouper.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 22 Nov 2026 08:14:36 +0000 (UTC) Injection-Info: dont-email.me; logging-data="828760"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3Gvx8ik4zDmm3MOlxBRqwFSHJKxixfPtU4wOYbhUcLA=="; posting-host="c16fb8cbf89ecedbb3532930f0f50d31" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0 SeaMonkey/2.53.24 Cancel-Lock: sha1:FG3VfC03HYxpxHi0oaYSREKyJFo= sha256:tTZqttE98LWiEagRen+T91Me+2BQWmSWzT0eraDRSVU= sha1:/MRT8do0Zx9q/5jemT9/FmfpcDQ= sha256:FelIccRXrZYieHwPhdjQks/BT6Ilki4jMW0jELnyYlQ= In-Reply-To: <1795310482-5857@newsgrouper.org>