🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #58

Re: Pairwise dot product

#58
From: marcel hendrix
Date: Sat, 10 Oct 2026 19:07
38 lines
3409 bytes
On 10/9/2026 9:20 AM, Anton Ertl wrote:
> marcel hendrix <mhx@iae.nl> writes:
>> On 10/9/2026 7:32 AM, Anton Ertl wrote:
[..]> VFX generates good code for v*1...v*64, e.g., v*2:
> 
> ( 0050AB40    DD03 )                  FLD     DOUBLE 0 [RBX]
> ( 0050AB42    488B5500 )              MOV     RDX, [RBP]
> ( 0050AB46    DD02 )                  FLD     DOUBLE 0 [RDX]
> ( 0050AB48    DEC9 )                  FMULP   ST(1), ST
> ( 0050AB4A    488B5500 )              MOV     RDX, [RBP]
> ( 0050AB4E    48035510 )              ADD     RDX, [RBP+10]
> ( 0050AB52    48035D08 )              ADD     RBX, [RBP+08]
> ( 0050AB56    DD03 )                  FLD     DOUBLE 0 [RBX]
> ( 0050AB58    DD02 )                  FLD     DOUBLE 0 [RDX]
> ( 0050AB5A    DEC9 )                  FMULP   ST(1), ST
> ( 0050AB5C    48035510 )              ADD     RDX, [RBP+10]
> ( 0050AB60    48035D08 )              ADD     RBX, [RBP+08]
> ( 0050AB64    DEC1 )                  FADDP   ST(1), ST
> ( 0050AB66    48895500 )              MOV     [RBP], RDX
> ( 0050AB6A    C3 )                    RET/NEXT
> ( 43 bytes, 15 instructions )
[..]> VFX compiles 18 Forth words into 15 instructions in this case.  For
> v*64, it compiles 576 Forth words into 387 instructions.  It may or
> may not be helpful for performance to load the values that it accesses
> at [RBP+10] and [RBP+08] into registers, too, to reduce the usage of
> load ports, which may limit the performance of this code.

VFX is about 3 times faster for paired-v*, which reeks of some magical 
loophole in the x86 instruction set ... It benefits from (1) not 
push/popping RBX and RBX (assuming the FADDP doesn't swamp that) and (2) 
not saving FTOS to memory after the FADDP . I wonder if (2) is by 
design, or if it simply assumes (or makes sure) the FP-stack will be 
deep enough for further iterations. (I found "making sure" too difficult 
without interrupts.)
With VFX64 5.43, was FPSYSTEM value == 1?

> - anton
Technical Details
Message-ID: <11ae2e7$bv4s$1@dont-email.me>
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: <2026Oct8.175513@mips.complang.tuwien.ac.at> <11a9aah$19g75$1@dont-email.me> <2026Oct9.073240@mips.complang.tuwien.ac.at> <11aa44u$9s7j$1@dont-email.me> <2026Oct9.092016@mips.complang.tuwien.ac.at>

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: marcel hendrix <mhx@iae.nl>
Newsgroups: comp.lang.forth
Subject: Re: Pairwise dot product
Date: Sat, 10 Oct 2026 21:07:50 +0200
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <11ae2e7$bv4s$1@dont-email.me>
References: <2026Oct8.175513@mips.complang.tuwien.ac.at>
 <11a9aah$19g75$1@dont-email.me> <2026Oct9.073240@mips.complang.tuwien.ac.at>
 <11aa44u$9s7j$1@dont-email.me> <2026Oct9.092016@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 10 Oct 2026 19:07:52 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="392348"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18N68BlwHpXvsOT82dKZGur7vm0t9nuC00="; posting-host="28a78ccd61dc650a84c5b0a4b743199a"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:W9LYo/dxK6ExM7hbRpjc06mYVbM= sha256:tfp7KgP3lnoqnAwStjOuU/SWYlY1TJSiTAkYFZT5SDg=
	sha1:l+kyr8PAo6lNAXMsQhWsWZNbvKE= sha256:YFgkTEfZc2gzn8ej/xYBrABUYJlQ6EcvfGhNdUfoUmI=
In-Reply-To: <2026Oct9.092016@mips.complang.tuwien.ac.at>
Content-Language: en-US