🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #642

Re: vector length CSR?

#642
From: Robert Finch
Date: Wed, 11 Nov 2026 09:10
94 lines
4243 bytes
On 2026-11-10 4:44 p.m., Terje Mathisen wrote:
> MitchAlsup wrote:
>> Robert Finch <robfi680@gmail.com> posted:
>>
>>> On 2026-11-08 11:37 p.m., Lawrence D’Oliveiro wrote:
>>>> On Sun, 8 Nov 2026 23:11:46 -0500, Robert Finch wrote:
>>>>
>>>>> On 2026-11-08 7:01 p.m., Lawrence D’Oliveiro wrote:
>>>>>>
>>>>>> The RISC-V designers quite rightly criticize this combinatorial
>>>>>> explosion of instruction variants as going completely against the
>>>>>> whole idea of a *reduced* instruction set computer (which is what
>>>>>> “RISC” is supposed to stand for).
>>>>>
>>>>> It is partly a representation issue. IDK how it would be avoided,
>>>>> scratched my head over this one.
>>>>
>>>> I think they do it by specifying the data type of the operands in
>>>> another control register.
>>>
>>> I went with the hoards of instructions approach. But the size of the
>>> operand is specified in a config register.
>>
>> How would you vectorize:
>>
>>        LOOP on i
>>        {
>>             DoubleWord[i] = WORD[i] × HalfWord[i] + Byte[i+2];
>>        }
>>
> 
> Relatively easy:
> 
> 
> Unroll by 16:
> 
>     load 4 W entries into ymm0
>     load 4 W entries into ymm1
>     load 4 W entries into ymm2
>     load 4 W entries into ymm3
> 
>     load 8 HW entries into ymm4
>     load 8 HW entries into ymm5
> 
>     load 16 B entries into ymm6
> 
> //
>     expand low half of ymm4 into ymm7
>     expand high half of ymm4 in place
> 
> // Ditto for ymm5/ymm8
> 
> //
> //   expand ymm6 into ymm9, ymm6, then both of these into two more regs.
> 
> After all inputs have been expanded into the final DW element size, do 
> the muls and adds.
> 
> With a total of ~20 size expansion operations, they might well end up as 
> a very significant part of the total runtime.
> 
> If the architecture has doubling parallel MULs, then that would save 
> quite a few operations.
> 
> Terje
> 
> 
> 
>
; Qupls code (in theory)
not as bad as I thought because the vectors are accessible in chunks
it’s about 36 instructions assuming a max vector length of eigth regs.

;       LOOP on i
;       {
;            DoubleWord[i] = WORD[i] × HalfWord[i] + Byte[i+2];
;       }
; four double words in DoubleWord = {r25…r18}
; four words in WORD = {r11...r8}
; four half word in HalfWord = {r7,r6}
; four bytes in Byte[i+2] = lower half of {r5}
; temp = {r4,r3}
; temp double word = {r35…r28}

MOVSXT r28,r6,$tetra0   ; r28 = sign extend (halfword[i])
MUL %r3,%r28,%r8
MULH %r4,%r28,%r8   ; {r4,r3} = word[i] * halfword[i]
MOVSXB %r28,%r5         ;
ASR %r29,%r28,$64          ; {r29,r28} = byte[i+2]
ADD %r18,%r3,%r28     ; add low half
ADD_GCY %r2,%r3,%r28
ADD %r19,%r4,%r29,%r2 ; {r19,18} = result
; unroll three more times
Technical Details
Message-ID: <11d1bej$2st21$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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> <11cr2g5$q796$2@dont-email.me> <11crh64$ug0s$1@dont-email.me> <11crili$ur2d$1@dont-email.me> <11crrs5$118ll$1@dont-email.me> <1794339152-5857@newsgrouper.org> <11d037b$2hgkl$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Robert Finch <robfi680@gmail.com>
Newsgroups: comp.arch
Subject: Re: vector length CSR?
Date: Wed, 11 Nov 2026 04:10:39 -0500
Organization: A noiseless patient Spider
Lines: 94
Message-ID: <11d1bej$2st21$1@dont-email.me>
References: <11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me>
 <11crh64$ug0s$1@dont-email.me> <11crili$ur2d$1@dont-email.me>
 <11crrs5$118ll$1@dont-email.me> <1794339152-5857@newsgrouper.org>
 <11d037b$2hgkl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 11 Nov 2026 09:10:43 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3044417"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+vsB0SDO4QFsU1Zl4tuzyt7sqgnUbLkxE="; posting-host="3cbe58922e084c0cbe70fb5cbe85ff31"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:LE/7LFPdmV/rdWRjSNXlVACt6kE= sha256:ttBc6UVjnpxHLaz1v6PhN/B4w+ViBlOU+YrSKHHhy8E=
	sha1:KYU8gJ/oBSDwJ9we1Uaj1HBSVQA= sha256:aVL8YOx/bPQInfbZNAkNSZ0n94f3h6E4hleChDzX4lk=
Content-Language: en-US
In-Reply-To: <11d037b$2hgkl$1@dont-email.me>