Article View: comp.arch
Article #911Re: Large constants in RISC
From: MitchAlsup
Date: Mon, 23 Nov 2026 20:35
Date: Mon, 23 Nov 2026 20:35
47 lines
3649 bytes
3649 bytes
EricP <ThatWouldBeTelling@thevillage.com> posted: > 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 While most ISAs naturally support IP-relative PIC, most ISAs do not support PIC switches with dense CASEs. These are generally done with tables of pointers, relocated at link time. My 66000 supports PIC switches directly. Our experiments have shown that the very vast majority (98%+) of these can use 16-bit tables (±17-bits of displacement) > 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:
<1795466138-5857@newsgrouper.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!newsgrouper.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> <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> <e_%MS.40267$v954.6680@fx47.iad>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!newsgrouper.org!.POSTED!not-for-mail From: MitchAlsup <user5857@newsgrouper.org.invalid> Newsgroups: comp.arch Subject: Re: Large constants in RISC 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> <e_%MS.40267$v954.6680@fx47.iad> Date: Mon, 23 Nov 2026 20:35:38 GMT Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-ID: <1795466138-5857@newsgrouper.org> Injection-Info: newsgrouper.org; mail-complaints-to="newsgrouper@yahoo.com"; posting-account=user5857 Injection-Date: Mon, 23 Nov 2026 20:35:38 GMT User-Agent: Newsgrouper/0.9.0