🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #955

Re: Large constants in RISC

#955
From: MitchAlsup
Date: Wed, 25 Nov 2026 18:57
47 lines
3221 bytes
Terje Mathisen <terje.mathisen@tmsw.no> posted:

> EricP wrote:
> > 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.
> 
> We asm programmers didn't use that function call, we just did
> 
>   call next
> next:
>   pop bx
> 
> Two instructions, 4 bytes
> 
> but when return predictors turned up having a CALL without the expected 
> RET caused mispredicts.

Which is why the proper thing to do _NOW_ is to make IP available as
a base register in memory reference instructions. {It is the predictor
friendly way forward}
 
> Terje
> 
Technical Details
Message-ID: <1795633050-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-mail
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> <11e6h61$3mml2$1@dont-email.me>

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> <11e6h61$3mml2$1@dont-email.me>
Date: Wed, 25 Nov 2026 18:57:30 GMT
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Message-ID: <1795633050-5857@newsgrouper.org>
Injection-Info: newsgrouper.org; mail-complaints-to="newsgrouper@yahoo.com"; posting-account=user5857
Injection-Date: Wed, 25 Nov 2026 18:57:30 GMT
User-Agent: Newsgrouper/0.9.0