Article View: comp.arch
Article #858Re: vector length CSR?
From: Thomas Koenig
Date: Sat, 21 Nov 2026 14:54
Date: Sat, 21 Nov 2026 14:54
45 lines
3291 bytes
3291 bytes
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.
--
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Technical Details
Message-ID:
<11dsbag$5a43$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!srv.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> <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>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Thomas Koenig <tkoenig@netcologne.de> Newsgroups: comp.arch Subject: Re: vector length CSR? Date: Sat, 21 Nov 2026 14:54:08 -0000 (UTC) Organization: A noiseless patient Spider Lines: 45 Message-ID: <11dsbag$5a43$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> Injection-Date: Sat, 21 Nov 2026 14:54:09 +0000 (UTC) Injection-Info: dont-email.me; logging-data="174211"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UZh3crpnRVJXI3e4c5Kl512VAaCsNy/s="; posting-host="5e74d6d8398cbd6755052d4645bce983" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:47RnJf67/pZz2EgC/jcbnBiiLpU= sha256:ukp15fNP75z/Grj8AqZWRq9PPgnGh0ILfk07DYsu27Q= sha1:e8+W6Xlkanj0W2olPChrGt3Bnl8= sha256:U09N4FwanlBlC2N8K7ScjWGzXje1jpnrrKoCe2NI4SY=