🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #46

Re: Pairwise dot product

#46
From: marcel hendrix
Date: Fri, 09 Oct 2026 08:46
74 lines
3736 bytes
Strange. I changed fourth and third to what I suppose is worse code, but
\ V*          : 2,598,357,958 clock ticks
\ naive-V*    : 2,596,436,412 clock ticks
\ pairwise-V* : 2,286,386,056 clock ticks

Now pairwise-V* wins.

fourth and third became:

: fourth ( a b c d -- a b c d a ) >S >S OVER S>  S> ROT ;
: third  ( a b c -- a b c a )        >S OVER S>  SWAP ;

... which looks bad, but which generates

FORTH> ' v*2 idis
$01344740  : v*2
$0134474A  pop           rbx
$0134474B  pop           rdi
$0134474C  fld           [rbx] qword
$0134474E  fld           [rdi] qword
$01344750  fmulp         ST(1), ST
$01344752  pop           rax
$01344753  pop           rdx
$01344754  fld           [rbx rax*1] qword
$01344757  fld           [rdx rdi*1] qword
$0134475A  fmulp         ST(1), ST
$0134475C  faddp         ST(1), ST
$0134475E  fpush,
$01344768  push          rdx
$01344769  push          rax
$0134476A  lea           rdi, [rdi rdx*2] qword
$0134476E  push          rdi
$0134476F  lea           rbx, [rbx rax*2] qword
$01344773  push          rbx
$01344774  ;

instead of

$01341F80  : v*2
$01341F8A  pop           rbx
$01341F8B  pop           rdi
$01341F8C  fld           [rbx] qword
$01341F8E  fld           [rdi] qword
$01341F90  fmulp         ST(1), ST
$01341F92  push          rdi
$01341F93  mov           rcx, rbx
$01341F96  mov           rbx, [rsp #16 +] qword
$01341F9B  pop           rdi
$01341F9C  lea           rbx, [rbx rdi*1] qword
$01341FA0  push          rbx
$01341FA1  push          rcx
$01341FA2  mov           rbx, [rsp #16 +] qword
$01341FA7  pop           rdi
$01341FA8  pop           rax
$01341FA9  fld           [rdi rbx*1] qword
$01341FAC  fld           [rax] qword
$01341FAE  fmulp         ST(1), ST
$01341FB0  push          rax
$01341FB1  lea           rbx, [rdi rbx*1] qword
$01341FB5  mov           rcx, rbx
$01341FB8  mov           rbx, [rsp #16 +] qword
$01341FBD  pop           rdi
$01341FBE  lea           rbx, [rbx rdi*1] qword
$01341FC2  push          rbx
$01341FC3  push          rcx
$01341FC4  mov           rbx, [rsp #16 +] qword
$01341FC9  pop           rdi
$01341FCA  faddp         ST(1), ST
$01341FCC  fpush,
$01341FD6  lea           rbx, [rdi rbx*1] qword
$01341FDA  push          rbx
$01341FDB  ;

-marcel
Technical Details
Message-ID: <11aa9kv$9va2$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: Fri, 9 Oct 2026 10:46:21 +0200
Organization: A noiseless patient Spider
Lines: 74
Message-ID: <11aa9kv$9va2$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: Fri, 09 Oct 2026 08:46:23 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="326978"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19EMXhcmoBsfa9YW16/2wOZvzXQc8LPWlo="; posting-host="6d6e46262c1d841f326e811fcc4b05dc"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:6jQ2kywi2W/MyW3W5go0WiwVW+8= sha256:bfyvl8h+5tZc0HqBsm7uCJHZ28iUJG8kEsTQlMFD8lA=
	sha1:3rsi+AP+0i3I0SYTLlYss9hF+Rs= sha256:PoOoKDtzEc85rZ7que7J/iYYHth2AvZhihH2mZ+bA7w=
In-Reply-To: <2026Oct9.092016@mips.complang.tuwien.ac.at>
Content-Language: en-US