🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #406

128/64 division (was: interrupt handling latency and weird register use)

#406
From: Anton Ertl
Date: Wed, 28 Oct 2026 08:34
44 lines
3369 bytes
Michael S <already5chosen@yahoo.com> writes:
>An interesting question here is "Do one has to include 128b / 64b
>division in the ISA or it's better to leave it off?".
>AMD decided that it was needed, but it seems that nobody else followed
>the suit.

The same can be seen already in the 32-bit relatives.  Most (all?)
RISCs just have 32/32 division, if they have division at all, IA-32
has 64/32.  So they continue that in 64-bit RISCs and AMD64.

Given the existing programming languages, the need for 128/64 bit
division is rare (Forth has UM/MOD and SM/REM, which correspond to
AMD64 DIV and IDIV instructions, respectively), and three source
registers does not fit in usual instruction encodings, so most
architectures leave 128/64 to software.

About software implementations: Implementing 128/64 when you only have
64/64 is messy, however.  And general long division is messy in any
case (but I expect that 128/64 helps in that case; certainly n/64 for
arbitrary n is easy with 128/64 and messy with 64/64).

Let's see how expensive they are on a Ryzen 8700G (Zen4, with 128/64
support) and Power8 (without):

Invocations:

# 64/64
time ./gforth-fast -e ': foo #1_000_000_000_000 {: addend :} 1_000_000_000 {: divisor :} addend 100000000 0 do divisor /mod + addend + loop . ; foo bye'
# 128/64
time ./gforth-fast -e ': foo #1_000_000_000_000_000_000_000_000. 1_000_000_000 {: divisor :} divisor 2/ 1- {: dmax :} 100000000 0 do divisor sm/rem swap dmax min loop d. ; foo bye'

64/64  128/64
0.385s 0.424s Ryzen 8700G
1.176s 2.115s Power8

Given the rarity of 128/64, a factor of 2 looks acceptable.  But if
the division was as fast as on Power8 as on the Ryzen 8700G, the
overhead of 128/64 might be a larger factor (that would probably still
be considered acceptable).

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID: <2026Oct28.093427@mips.complang.tuwien.ac.at>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <87qzk0nejz.fsf@nightsong.com> <116d89d$27baf$1@paganini.bofh.team> <87ecfcagiw.fsf_-_@debian> <2026Sep1.225146@mips.complang.tuwien.ac.at> <11bpfm8$190ap$1@dont-email.me> <2026Oct27.171414@mips.complang.tuwien.ac.at> <1793120789-5857@newsgrouper.org> <20261027191746.00005584@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!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: 128/64 division (was: interrupt handling latency and weird register use)
Date: Wed, 28 Oct 2026 08:34:27 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 44
Message-ID: <2026Oct28.093427@mips.complang.tuwien.ac.at>
References: <87qzk0nejz.fsf@nightsong.com> <116d89d$27baf$1@paganini.bofh.team> <87ecfcagiw.fsf_-_@debian> <2026Sep1.225146@mips.complang.tuwien.ac.at> <11bpfm8$190ap$1@dont-email.me> <2026Oct27.171414@mips.complang.tuwien.ac.at> <1793120789-5857@newsgrouper.org> <20261027191746.00005584@yahoo.com>
Injection-Date: Wed, 28 Oct 2026 09:23:39 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2411406"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX190+hbQkVzk+vlLs13nNIsi"; posting-host="d1527703a046cefc58c437d7f92a69e3"
Cancel-Lock: sha1:boVTw/iTVOI1iS10AjsoKrD/TbU= sha256:VMCK2bFmkrIcM/d/rkHMSVN2+N11vY3tRd4EB4GsdTQ=
	sha1:CP3MFu+dq4h/4xm+lgxP7girHY0= sha256:Px87Tuw1VUdigHx3rCon9+Ey+AlV9SMcgYdaKMRW3mc=
X-newsreader: xrn 10.11