Article View: comp.arch
Article #649Re: vector length CSR?
From: BGB
Date: Wed, 11 Nov 2026 21:20
Date: Wed, 11 Nov 2026 21:20
103 lines
5441 bytes
5441 bytes
On 11/10/2026 6:34 PM, MitchAlsup wrote:
> anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:
>
>> /ERROR "unexpected byte sequence starting at index 590: '\xC3'" while decoding/:
>>
>> MitchAlsup <user5857@newsgrouper.org.invalid> writes:
>>> anton@mips.complang.tuwien.ac.at (Anton Ertl) posted:
>>>> Mashey (and IIRC also Patterson) also discuss the technical background
>>>> behind the commonalities in RISCs, so while you may consider the way
>>>> that the criteria were derived to be circular, they are not
>>>> accidental.
>>>
>>> Don't leave out Mark Horowitz
>>
>> Duckduckgo does not give me any papers, or web pages about RISC
>> definition when I ask it for "Mark Horowitz RISC", unlike for "John
>> Mashey RISC". Do you have a specific paper or web page in mind?
>
> "Architectural Tradeoffs in the Design of MIPS-X" Horowitz and Chow
>
>>> Given {signed, Unsigned}Ã{Byte, halfword, word, doubleword} one has
>>> 8 integer ADDs,
>>
>> SPARC and Power have only one add instruction. With a load-store
>> architecture, you need only one, the full-width one.
>
> If you like LLVM compilers having to constrain ADD results with
> SEXT/ZEXT, sure, and you also don't get integer overflow performed
> properly (assuming you want it done at all).
>
> LLVM takes the (somewhat convoluted) vision that a result in a
> register is range limited to the exact value-set as one stored
> in memory.
>
That is "safe", and mostly matches C.
One trick though in a compiler is to flag intermediate values for cases
where they may be out of range, and then lazily enforce range if the
variable is used in a way where this matters.
Say, adding two char or short variables may produce a temporarily
out-of-range result, but this can be ignored if it is being immediately
stored to memory, but the compiler needs to add-in the sign/zero
extension if it then goes into an arithmetic operation or would flow out
of the current basic block.
Otherwise one would need some rarely-used 8 and 16 bit ADD variants.
Sign and zero extension ops for the common sizes is a solid "nice to
have" though (using a pair of shifts kinda sucks).
>> Only with
>> load-and-add instructions, you need to specify the width in the
>> addition, and whether you want the loaded value to be sign-extended or
>> zero-extended (although I think most have only one variant of every
>> length). You also then have to ask yourself if you want to perform
>> the addition to the full width of the register, or just the width of
>> the loaded value, and sign- or zero-extend the result. I see no good
>> reason to add only to the width of the loaded value, but that's how
>> AMD64 works.
>
> Any language that requires the register-allocated variable to be range
> constrained exactly like those residing in memory has that property.
>
This is a place where pure RISC-V kinda sucks:
int x, y, z;
...
z=x+y; //fine, ADDW so all is good.
...
But:
unsigned int ux, uy, uz;
...
uz=ux+uy; //worse.
...
Standard ABI makes this operation cheaper than it would have been
otherwise, but in a stupid way that makes more problems than it solves.
Then:
short sx, sy, sz;
...
sz=sx+sy; //well, crap.
...
This case is going to kinda suck in RV.
>> The nice thing about load/store architectures is that you can separate
>> these concerns.
>
> There are side effects wrt HLLs that are not addresses with that view point.
>
>> Have all 7 variants of loads (lbu lbs lsu lss lmu lms ll), four
>> variants of store (sb ss sm sl), do addition at full width, and have
>> various zero- and sign-extending instructions in the cases where they
>> are needed (usually not in connection with addition).
>>
>> - anton
Technical Details
Message-ID:
<11d2m77$3cijo$2@dont-email.me>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me> <2026Nov9.071302@mips.complang.tuwien.ac.at> <11cru1e$11qpi$1@dont-email.me> <2026Nov9.091404@mips.complang.tuwien.ac.at> <11cti0c$1lilf$4@dont-email.me> <2026Nov10.084131@mips.complang.tuwien.ac.at> <1794340629-5857@newsgrouper.org> <2026Nov10.221543@mips.complang.tuwien.ac.at> <1794357251-5857@newsgrouper.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: BGB <cr88192@gmail.com> Newsgroups: comp.arch Subject: Re: vector length CSR? Date: Wed, 11 Nov 2026 15:20:39 -0600 Organization: A noiseless patient Spider Lines: 103 Message-ID: <11d2m77$3cijo$2@dont-email.me> References: <11cpqih$acf5$1@dont-email.me> <11cr2g5$q796$2@dont-email.me> <2026Nov9.071302@mips.complang.tuwien.ac.at> <11cru1e$11qpi$1@dont-email.me> <2026Nov9.091404@mips.complang.tuwien.ac.at> <11cti0c$1lilf$4@dont-email.me> <2026Nov10.084131@mips.complang.tuwien.ac.at> <1794340629-5857@newsgrouper.org> <2026Nov10.221543@mips.complang.tuwien.ac.at> <1794357251-5857@newsgrouper.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 11 Nov 2026 21:20:40 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3558008"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5y/4z/5uofGTcVDpK7kQSg0tE4oxzvq0="; posting-host="8da352e2486819299afcf87d88700199" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:6zJs55lPmwXT0UHp3EQsEEaX4DA= sha256:AdzC18tL+K+5nZ8KnT8uWKNlQaP3b0YdEWSpXFiXAO0= sha1:ARSjKWTXhvOIxT6/DeuFqRsrxqM= sha256:i1Jomb+USKjqy4En/5pkzlD6+ygb8ugu4AqgwOMva0w= In-Reply-To: <1794357251-5857@newsgrouper.org> Content-Language: en-US