🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #859

Re: vector length CSR?

#859
From: David Brown
Date: Sat, 21 Nov 2026 15:15
49 lines
3683 bytes
On 21/11/2026 15:54, Thomas Koenig wrote:
> David Brown <david.brown@hesbynett.no> schrieb:
>> On 21/11/2026 15:01, Thomas Koenig wrote:
>>> David Brown <david.brown@hesbynett.no> schrieb:
>>>> On 20/11/2026 19:57, Thomas Koenig wrote:
>>>>> Anton Ertl <anton@mips.complang.tuwien.ac.at> schrieb:
>>>>>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>>>>>>> On 11/19/2026 10:00 AM, Thomas Koenig wrote:
>>>>>>>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> schrieb:
>>>>>>>>> On 11/11/2026 10:53 PM, Thomas Koenig wrote:
>>>>>>>>>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> schrieb:
>>>>>>>>>>        s = 0;
>>>>>>>>>>        for (long int i=0; i<n; i++)
>>>>>>>>>>          s = s + a[i];
> 
> [...]
> 
>> Without additional effort from the compiler user, a loop like this can
>> be re-arranged using commutative and associative laws and any other
>> information the compiler has.  I would not expect the compiler to handle
>> this differently for signed or unsigned types.
> 
> gcc treats wrapping and non-wrapping differently.  Here's a function
> from gcc/tree-ssa-reassoc.cc:
> 
> /* Returns true if we can reassociate operations of TYPE.
>     That is for integral or non-saturating fixed-point types, and for
>     floating point type when associative-math is enabled.  */
> 
> static bool
> can_reassociate_type_p (tree type)
> {
>    if ((ANY_INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_WRAPS (type))
>        || NON_SAT_FIXED_POINT_TYPE_P (type)
>        || (flag_associative_math && FLOAT_TYPE_P (type)))
>      return true;
>    return false;
> }
> 
> Reassociation is possible with -frwapv, not possible with
> normal semantics.
> 

That surprises me, but okay.  There is certainly no reason why signed 
integer types cannot be treated as wrapping if it results in better code 
(assuming, of course, you don't have "-ftrapv" or relevant sanitizer 
flags in effect).

Technical Details
Message-ID: <11dschm$5rju$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11cpqih$acf5$1@dont-email.me> <sgu0flpndaqltpdbft40fghmi7vk78q2hs@4ax.com> <11cq2v7$dh5b$1@dont-email.me> <8jk1fl182pskj3fsmp4ju6qf420pgl0htg@4ax.com> <11csull$1ef6e$1@dont-email.me> <2026Nov9.230104@mips.complang.tuwien.ac.at> <11cvcr4$28k7g$1@dont-email.me> <11d3npt$3mmho$1@dont-email.me> <11dn936$2ebc2$1@dont-email.me> <11dndfd$2fr9j$1@dont-email.me> <11dngb5$2he51$1@dont-email.me> <2026Nov19.203832@mips.complang.tuwien.ac.at> <11dq56a$3f094$1@dont-email.me> <11ds0io$12f8$1@dont-email.me> <11ds88c$46jd$1@dont-email.me> <11ds95m$4co4$1@dont-email.me> <11dsbag$5a43$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.arch
Subject: Re: vector length CSR?
Date: Sat, 21 Nov 2026 16:15:02 +0100
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <11dschm$5rju$1@dont-email.me>
References: <11cpqih$acf5$1@dont-email.me>
 <sgu0flpndaqltpdbft40fghmi7vk78q2hs@4ax.com> <11cq2v7$dh5b$1@dont-email.me>
 <8jk1fl182pskj3fsmp4ju6qf420pgl0htg@4ax.com> <11csull$1ef6e$1@dont-email.me>
 <2026Nov9.230104@mips.complang.tuwien.ac.at> <11cvcr4$28k7g$1@dont-email.me>
 <11d3npt$3mmho$1@dont-email.me> <11dn936$2ebc2$1@dont-email.me>
 <11dndfd$2fr9j$1@dont-email.me> <11dngb5$2he51$1@dont-email.me>
 <2026Nov19.203832@mips.complang.tuwien.ac.at> <11dq56a$3f094$1@dont-email.me>
 <11ds0io$12f8$1@dont-email.me> <11ds88c$46jd$1@dont-email.me>
 <11ds95m$4co4$1@dont-email.me> <11dsbag$5a43$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 21 Nov 2026 15:15:02 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="192126"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+1Bx2P1CgeRtKlYaUiUg7SFacuUEPtnJU="; posting-host="e9cc8568760c122c84a8bb7d362e291d"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:S0P40+tbV3M4c+Fzdme0CZDfUgI= sha256:9G3Sn/YN2Vc6UScd+Y9BvCLxn+nRurlFh8G8oA49bpc=
	sha1:Ez9UD4z5qlyIZ0bcO9YKOsP0C/Q= sha256:kAqVYReg7qtxxbdQDHwd72vjlcu3VOuNf+30KVw42SE=
Content-Language: en-GB
In-Reply-To: <11dsbag$5a43$1@dont-email.me>