Article View: comp.arch
Article #761Re: Large constants in RISC
From: MitchAlsup
Date: Sun, 15 Nov 2026 18:50
Date: Sun, 15 Nov 2026 18:50
37 lines
2421 bytes
2421 bytes
John Levine <johnl@taugh.com> posted: > It appears that BGB <cr88192@gmail.com> said: > >> I read what he wrote and I do not doubt that code having constants > >> in instructions is faster. What is not clear how frequently > >> code with explicit constants appears in real life. > >> > > > >It depends, for 3RI forms IME: > > ~ 93% .. 96% fit in 10 bits; > > ~ 95% .. 98% fit into 12 bits. > > > >Of those that miss, there is a clustering patters: > > Big spike near 16 bits; > > Another smaller spike near 32 bits; > > Very little else up until around 64 bits. > > > >The vast majority fall along a "near zero" curve, with a fairly steep > >falloff. ... > > That tells me that it's not a good use of instruction bits to try to > encode large constants. For the 3% of constants that can't be encoded > in 12 bits, use a constant pool. In a constant pool, one still suffers the latency of the LD and the sacrifice of a register (hurts 16-register ISA more than 32-register ISA). Whereas, with constants in the instruction stream, you suffer neither. > FYI, that's basically what S/360 did. The load address instruction > has a 12 bit immediate field you can use to load 12 bit constants, > other than that you're on your own. S/390 added a load immediate with > a 16 bit signed value, z added load immediates with a 32 bit operand, > and versions that load the high or low halves of a regster, so with > two 48-bit instructions you can load any 64 bit value. > >
Technical Details
Message-ID:
<1794768602-5857@newsgrouper.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <11dabct$26fdl$1@dont-email.me> <11dahac$2t74$1@gal.iecc.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <11dabct$26fdl$1@dont-email.me> <11dahac$2t74$1@gal.iecc.com> Date: Sun, 15 Nov 2026 18:50:02 GMT Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-ID: <1794768602-5857@newsgrouper.org> Injection-Info: newsgrouper.org; mail-complaints-to="newsgrouper@yahoo.com"; posting-account=user5857 Injection-Date: Sun, 15 Nov 2026 18:50:02 GMT User-Agent: Newsgrouper/0.9.0