Article View: comp.arch
Article #909Re: Large constants in RISC
From: EricP
Date: Mon, 23 Nov 2026 18:55
Date: Mon, 23 Nov 2026 18:55
36 lines
3212 bytes
3212 bytes
On 2026-Nov-23 05:47, Thomas Koenig wrote: > EricP <ThatWouldBeTelling@thevillage.com> schrieb: > >> As both absolute and PC-rel methods are possible on all cpu's, > > It is possible in principle for Power previous to version 3.1, but > it was painful. The system has a TOC pointer in r2, which points > to local data and the GOT, restricted to 64k. If you really wanted > to do pc-relative, you had to get the PC via a branch and link > instruction into the link register, then transfer it from there to > a general register. Power version 3.0 added a add PC immediate > + shifted instruction. V3.1 finally allows for pc-relative with > 34-bit offset, in a 64-bit instruction. > The 32b x86 also does not have native PC-rel addressing, just absolute, register relative, with optional scaled-index. To get the PC into a register one calls a two instruction routine, which pushes the incremented PC on the stack, loads the bottom of stack dword into a register and returns. This routine could be positioned after a basic block near by. To make that perform well the core needs store-to-load forwarding so it can pull the PC from the store queue and not wait for the value to hit memory, and a branch predictor so the call does not cause a stall. A "MOVPC Rd" instruction would have been simpler. An OS could support shared DLLs without PC-rel position independent code but the OS image loader's job is more complicated as it must decide whether to reuse an existing image already located at an absolute address, or make a new relocated version of that image file. It gets complicated because each loaded DLL can depend on many other DLLs loaded at their currently assigned absolute address. Doing that optimally sounds like a bin packing problem which are NP-hard, and since sharing isn't strictly required then probably a "best effort" at reuse would do.
Technical Details
Message-ID:
<e_%MS.40267$v954.6680@fx47.iad>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx47.iad.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> <4m2MS.132607$Lt64.106487@fx41.iad> <jwvo6bidgit.fsf-monnier+comp.arch@gnu.org> <5yFMS.36883$gOr4.31829@fx08.iad> <11e15kh$1pgpm$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx47.iad.POSTED!not-for-mail MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: EricP <ThatWouldBeTelling@thevillage.com> Subject: Re: Large constants in RISC Newsgroups: comp.arch 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> <4m2MS.132607$Lt64.106487@fx41.iad> <jwvo6bidgit.fsf-monnier+comp.arch@gnu.org> <5yFMS.36883$gOr4.31829@fx08.iad> <11e15kh$1pgpm$1@dont-email.me> Content-Language: en-CA In-Reply-To: <11e15kh$1pgpm$1@dont-email.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Lines: 36 Message-ID: <e_%MS.40267$v954.6680@fx47.iad> X-Complaints-To: abuse@UsenetServer.com NNTP-Posting-Date: Mon, 23 Nov 2026 18:55:06 UTC Date: Mon, 23 Nov 2026 13:55:02 -0500 X-Received-Bytes: 3002