🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #1026

hardware reassociation (was: reassociation and undefined behaviour)

#1026
From: Anton Ertl
Date: Wed, 02 Dec 2026 18:09
52 lines
3295 bytes
MitchAlsup <user5857@newsgrouper.org.invalid> writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:
>> In any case, the best association depends on the latencies of how the
>> operands are computed.  If I don't know that, I would go for
>> (a+b)+(c+d), where the latencies are the same for all operands.
>
>This is an argument that HW (not SW) should be the one to reassociate.

Yes.  But how to do it?

One problem with register machines is that you usually don't know if a
register actually lives after the register has been read.  So if the
hardware sees

t1=a+b
t2=c+d
t3=t1+t2

... it does not know that t1 and t2 are dead and the whole thing can
be reassociated.  But if we limit the reassociation to sequences of

t =  a+b
t += c
t += d

Then the hardware would know that there is no intermediate result it
has to preserve, except if there can be an exception between these
operations; let's exclude that eventuality, too.  The whole sequece
has to only deal with registers and is combined into a macro-op

t = a+b+c+d

Ok, now we have this macro-op in the scheduler.  We wait until two
operands are ready, and add them.  Then wait until a third is ready,
and add it.  Then wait until a fourth is ready, and add it.  Now t is
ready for its consumers and the macro-op can enter the retirement
queue.

One probably wants to limit the number of inputs to such a macro-op to
3 or 4.

At least for + & | ^, I wonder if one cannot do a single-cycle 3-wide
or 4-wide adder and spare oneself the worry of partially-done
macro-ops.  For *, that's probably too expensive.

And the other question is if these things occur often enough to merit
this hardware expense.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID: <2026Dec2.190958@mips.complang.tuwien.ac.at>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11cpqih$acf5$1@dont-email.me> <86o6b6kaqf.fsf@linuxsc.com> <11ejr5e$nk8$1@reader2.panix.com> <11ejtoe$eoj7$1@dont-email.me> <11el2c1$q43$1@reader2.panix.com> <11emcgn$1k681$1@dont-email.me> <11emvbp$1sc68$3@dont-email.me> <2026Dec2.084013@mips.complang.tuwien.ac.at> <1796233819-5857@newsgrouper.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: hardware reassociation (was: reassociation and undefined behaviour)
Date: Wed, 02 Dec 2026 18:09:58 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 52
Message-ID: <2026Dec2.190958@mips.complang.tuwien.ac.at>
References: <11cpqih$acf5$1@dont-email.me> <86o6b6kaqf.fsf@linuxsc.com> <11ejr5e$nk8$1@reader2.panix.com> <11ejtoe$eoj7$1@dont-email.me> <11el2c1$q43$1@reader2.panix.com> <11emcgn$1k681$1@dont-email.me> <11emvbp$1sc68$3@dont-email.me> <2026Dec2.084013@mips.complang.tuwien.ac.at> <1796233819-5857@newsgrouper.org>
Injection-Date: Wed, 02 Dec 2026 18:25:48 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3520296"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18OGbYdwN5XRkaH/Sf9qHl6"; posting-host="9e58e1045521d54b1b4af042e3ed402f"
Cancel-Lock: sha1:bMIrxodyx7S+D12TwxGJGePM8sE= sha256:/6VpdSuaRRh3frE8FP2bquOU+2GqeWUaE1rwWYoZZac=
	sha1:C62W7HQlU7SHWZYx4OpcBSv/es8= sha256:9+7T8CDdLfnVWGLGb48FViEayQfpN9fuMU9CVG5LYIA=
X-newsreader: xrn 10.11