🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #951

Re: Pentium 4

#951
From: Anton Ertl
Date: Wed, 25 Nov 2026 16:45
62 lines
4355 bytes
Terje Mathisen <terje.mathisen@tmsw.no> writes:
>Anton Ertl wrote:
>> Terje Mathisen <terje.mathisen@tmsw.no> writes:
>>> Also, every switch between a sequence of inner core double-speed opcodes
>>> and anything else caused a significant bubble.
>> 
>> This is the first time I read about that.  And I have not seen it in
>> my own measurements, but then, maybe I did not measure the right
>> things.  Can you elaborate: E.g., give a sequence, and explain how big
>> the bubble for that sequence is.
>
>I don't remember exactly, but believe it was on the order of 1-3 
>(external) clock cycles either way. Even at the lower limit, this meant 
>losing 4 double-clocked ops in overhead to execute a single slow opcode 
>like SHR.

AFAIK SHR was not just slow because it was not executed in the
double-clocked ALU, but because it was executed in the mmxsh subunit
according to Agner Fog's instruction tables.  His tables list latency
4+1 for shifts by immediate values and 6+0 for shifts by cl; the +1 or
+0 happens if the execution unit of the next instruction is different
from the current one.

From what I read, shift and multiply shipped the operands over to
functional units elsewhere (mmxsh in this case), losing a cycles or so
each time a clock domain is crossed.  So let's see how fast the MMX
shifts are: An instruction like PSRLD with a mmx register operand and
an immediate operand costs 2+1 cycles.  So apparently shipping the GPR
value over to the MMX shift unit costs 1 cycle there and 1 cycle back.
For PSRLD xmm, xmm the cost is also 2+1; apparently SHR reg, CL has to
do something extra.

>All the fast opcodes did half the register (16 bits) in each half-cycle, 
>so any instruction like shift right which needed access to the high bits 
>before it could start had to wait for that before the full-size result 
>could be sent out of the inner core, then do the intended instruction, 
>then move the result back into the inner core.

The most common instructions that are not in the double-speed ALU are
loads, and for MOV r32,m Agner Fog lists 2+0 cycles of latency.  For
an ALU instruction like ADD r,r Agner Fog lists 0.5 + 0.5..1 cycles of
latency.

So for sequences of n repetitions of ADD r,r; MOV r,(r) the total
latency is 3*n cycles.

And for sequences of n repetitions of ADD r,r; ADD r,r; MOV r,(r) the
total latency of n*4 cycles.  Neither is worse than if there was no
double-clocked ALU.

Looking up Prescott (later Pentium 4s without double-clocked ALU and
partially with AMD64 support) numbers, Agner Fog lists 1+0 cycles
latency for SHR r32,imm and 2+0 for SHR r32,CL, and alu1 as the unit,
so the integer ALU now can shift.  ADD r,r has a latency of 1+0, and
MOV r32,m has a latency of 2+0.  So for Prescott these latencies are
quite ok.  What is strange is that the LEA latencies are listed as 2.5
and 3.5.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID: <2026Nov25.174522@mips.complang.tuwien.ac.at>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <6aff95fd.2756312@news.eternal-september.org> <6b02f61c.2940750@news.eternal-september.org> <11dvql5$1cfvl$1@dont-email.me> <6b038fcc.42284937@news.eternal-september.org> <1795459538-5857@newsgrouper.org> <11e6gul$3mjp5$1@dont-email.me> <2026Nov25.135403@mips.complang.tuwien.ac.at> <11e6tbb$3rh80$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!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: Pentium 4
Date: Wed, 25 Nov 2026 16:45:22 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 62
Message-ID: <2026Nov25.174522@mips.complang.tuwien.ac.at>
References: <6aff95fd.2756312@news.eternal-september.org> <6b02f61c.2940750@news.eternal-september.org> <11dvql5$1cfvl$1@dont-email.me> <6b038fcc.42284937@news.eternal-september.org> <1795459538-5857@newsgrouper.org> <11e6gul$3mjp5$1@dont-email.me> <2026Nov25.135403@mips.complang.tuwien.ac.at> <11e6tbb$3rh80$1@dont-email.me>
Injection-Date: Wed, 25 Nov 2026 17:43:44 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="4180174"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+mEV+uH82OWF7am9eRnY3g"; posting-host="59481ed96d0418bef989dc9aba7a2119"
Cancel-Lock: sha1:iPE2Uuwh7ikZ1qUZ/Z/xFl2XG4w= sha256:M9NkRFIy3B4VXeloQ/b30Tz9in2ye/pmDD87LebsMy4=
	sha1:wKNrhcmtr9IkHMuVAvrKjyDp+w4= sha256:cPqcCpC3EUITQhoVwcT3R44jYhnii2vg0YWUwW5p79A=
X-newsreader: xrn 10.11