🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #732

Re: Large constants in RISC

#732
From: BGB
Date: Sat, 14 Nov 2026 19:26
62 lines
3294 bytes
On 11/14/2026 12:04 PM, Theo wrote:
> BGB <cr88192@gmail.com> wrote:
>> On 11/13/2026 10:12 AM, Terje Mathisen wrote:
>>> Waldek Hebisch wrote:
>>>
>>> Why not just have a prefix opcode that says that the next 32 or 64 bits
>>> is a constant?
>>>
>>
>> I agree.
>>
>>
>> I went the prefix route, it works well in practice, and less bad than
>> most other options.
>>
>> Even if yes, a prefix means the value is a bit chewed. But, this is
>> hardly a new thing in most RISC style designs.
> 
> On aarch32 it could be something simple like:
> 
> LDR rN, [pc,#4]!
> DCD 0xdeadbeef
> ; code continues here
> 
> although on small designs that might create a pipeline bubble.  It wouldn't
> with a branch predictor.
> 
> That would be harder on ISAs where the pc is hidden away, but the prefix
> instruction could have a similar effect.
> 

Yeah, basically.

Can note that in my current ISA, there is neither a directly accessible 
PC nor an auto increment mode; so couldn't go that route. PC as a base 
register can be encoded indirectly though.

However, without special magic in the decoder, such a memory load would 
have higher latency than using a prefix. And the "magic" needed to make 
prefixes fast would less than that needed to deal with special cases 
like "PC-auto-increment load".


While the ancestor ISA had auto-increment, my own ISA efforts had 
dropped it mostly as it tended not to offer enough of a performance 
advantage to be worthwhile, and I was typically more focused on 
performance than on strictly optimizing code density (where 
auto-increment would still have some merit).

Big issue is basically that auto-increment was basically almost never 
faster than a separate Load/Store + ADD sequence in practice. And, in 
certain cases (like PUSH/POP) actually slower than the "adjust stack 
once and use a sequence of Loads/Stores" route.

So, a direct equivalent of PUSH/POP also got thrown out.

...


> Theo

Technical Details
Message-ID: <11dackl$26fdl$2@dont-email.me>
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!.POSTED!not-for-mail
References: <11d76uq$11cdc$1@paganini.bofh.team> <11d7ct8$17akn$1@dont-email.me> <11d7nf3$1b064$1@dont-email.me> <cJi*YIIVA@news.chiark.greenend.org.uk>

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!.POSTED!not-for-mail
From: BGB <cr88192@gmail.com>
Newsgroups: comp.arch
Subject: Re: Large constants in RISC
Date: Sat, 14 Nov 2026 13:26:12 -0600
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <11dackl$26fdl$2@dont-email.me>
References: <11d76uq$11cdc$1@paganini.bofh.team>
 <11d7ct8$17akn$1@dont-email.me> <11d7nf3$1b064$1@dont-email.me>
 <cJi*YIIVA@news.chiark.greenend.org.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 14 Nov 2026 19:26:13 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2309557"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX198RwsIEUNCJLSoA30Vt3GPPZ9v+D3aSqo="; posting-host="7ae1d57c66f0e466bf10769bbb72476f"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:WAsehJ9kPQHroG648JhslnqmFiA= sha256:HxZzyOPuIfINICv4FIeiMv+PJCjDW9KsP0RLDh7jOBE=
	sha1:4+CSCnDkdydIBH+K7MxzUrt9qyY= sha256:3E2avuo9/AJTTFMZwqIXpl7Ha95eq5nB27xcfNPqg00=
Content-Language: en-US
In-Reply-To: <cJi*YIIVA@news.chiark.greenend.org.uk>