🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #990

Re: CISC are not "unreduced"

#990
From: Waldek Hebisch
Date: Mon, 30 Nov 2026 17:33
74 lines
5116 bytes
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>Anton Ertl [2026-11-12 06:21:21] wrote:
>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>>>Yeah, if we take CISC as motivated by the desire to provide an assembly
>>>>language that is comfortable for humans, we can also take RISC as
>>>>motivated by the desire to provide an assembly language that's
>>>>convenient for compilers (which would rather not need to worry about
>>>>tradeoffs between using LD+ADD+ST vs using some fancy addressing mode
>>>>on ADD).
>>> The fancy addressing mode is the same whether you use it with a LD, a
>>> ST, or an ADD.
>>
>>That's beside the point.  With a load/store architecture you don't need
>>to choose between using the ADD-with-addressing mode or using explicit
>>loads and stores.  Makes life simpler for the compiler.
> 
> No.  With an architecture like the VAX, RISC is actually harder:
> 
> VAX: If operand src1 is in memory, accessed with d(SP), use the ADD
> instruction with d(SP) as second operand.  Likewise for src2 and dst.
> 
> RISC: If operand src2 is in memory, allocate a register for it (but
> why is it in memory? Probably because there are no registers
> available, so first spill some other value); then load the operand
> from d(SP) into the register; possibly do the same for the other
> source operand (but don't spill the register for src2). If the
> destination is in memory, allocate a register for storing it in the
> meantime (again with the potential for spilling).  Finally do the add.
> Store the result if necessary.  And now refill all the spilled values.
> 
> It's all doable, but simpler?  No.

Partially playing devil's advocate: if you reserve registers for
arguments and for handlinig addressing modes, then all one has
to do is generating code for loads.  But some loads seem to be
neccessary even for VAX, so you need function which generates
loads in the compiler anyway.  For RISC, you generate much more
loads than for VAX, but decision when to generate a load is
quite simple.  I estimate that for typical instructions one
needs to reserve between 3 and 8 registers, that is 2 for
arguments, one for result and additional registers to handle
addressing modes.  IIUC Risc-V and ARM need at least one
register to generate large constants which may be needed for
addressing.  Now, with 4 registers reserved on 32 bit ARM
there remain 11 general purpose registers (plus PC), that is
significantly less than 15 general purpose registers on VAX.
But Risc-V and 64 bit ARM even after reserving a few still
have more usable general purpose registers than VAX.

Of course, that assumes out of order RISC.  For superscalar
in-order RISC one needs to schedule instructions and that
significantly complicates register allocation.
 
> For the more common CISC style with load-and-op and read-modify-write,
> things are harder than on the VAX, but RISC still is not simpler.

In simple (almost naive) compiler main issue is how much you
care about possibly redundant temporary registers.  Due to
software conventions, it seems that one actually does not
need to care much.  That is, there is limited supply of
registers usable for local variables.  More precisely,
to avoid excessive spill code around calls variables that
need to persists after function call need to be allocated
in call-preserved registers, and those are relatively small
fraction of all registers.  And in a simple compiler it
is reasonable to assume that all variables that are allocated
to registers should survive after function call (otherwise
compiler need to do some real work like livenes ananlysis,
rage splitting etc.).  So there are plenty of registers that
are usable only for temporaries.

-- 
                              Waldek Hebisch
Technical Details
Message-ID: <11ekc0r$2dni3$1@paganini.bofh.team>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
References: <11cpqih$acf5$1@dont-email.me> <2026Nov9.071302@mips.complang.tuwien.ac.at> <11cru1e$11qpi$1@dont-email.me> <2026Nov9.091404@mips.complang.tuwien.ac.at> <11cti0c$1lilf$4@dont-email.me> <11cuoa4$21279$1@dont-email.me> <jwvcxscsjsa.fsf-monnier+comp.arch@gnu.org> <1794357499-5857@newsgrouper.org> <jwvik23o10u.fsf-monnier+comp.arch@gnu.org> <2026Nov12.072121@mips.complang.tuwien.ac.at> <jwvy0axmx8f.fsf-monnier+comp.arch@gnu.org> <2026Nov13.192642@mips.complang.tuwien.ac.at>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: antispam@fricas.org (Waldek Hebisch)
Newsgroups: comp.arch
Subject: Re: CISC are not "unreduced"
Date: Mon, 30 Nov 2026 17:33:17 -0000 (UTC)
Organization: bofh.team Usenet service
Message-ID: <11ekc0r$2dni3$1@paganini.bofh.team>
References: <11cpqih$acf5$1@dont-email.me>   <2026Nov9.071302@mips.complang.tuwien.ac.at> <11cru1e$11qpi$1@dont-email.me> <2026Nov9.091404@mips.complang.tuwien.ac.at> <11cti0c$1lilf$4@dont-email.me> <11cuoa4$21279$1@dont-email.me> <jwvcxscsjsa.fsf-monnier+comp.arch@gnu.org> <1794357499-5857@newsgrouper.org> <jwvik23o10u.fsf-monnier+comp.arch@gnu.org> <2026Nov12.072121@mips.complang.tuwien.ac.at> <jwvy0axmx8f.fsf-monnier+comp.arch@gnu.org> <2026Nov13.192642@mips.complang.tuwien.ac.at>
Injection-Date: Mon, 30 Nov 2026 17:33:17 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="2547267"; mail-complaints-to="usenet@bofh.team"; posting-host="d028f9ad2fa2c51f22dbfed0d81d7daf"; posting-account="69e66f1681224ab92235b464ce7a90b6"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Postfilter: Postfilter-NG 2026.10.2