Article View: comp.arch
Article #887Re: vector length CSR?
From: Tim Rentsch
Date: Sun, 22 Nov 2026 15:45
Date: Sun, 22 Nov 2026 15:45
30 lines
2854 bytes
2854 bytes
Michael S <already5chosen@yahoo.com> writes: > On Sat, 21 Nov 2026 14:54:08 -0000 (UTC) > Thomas Koenig <tkoenig@netcologne.de> wrote: [...] >>>>>>>>>> On 11/11/2026 10:53 PM, Thomas Koenig wrote: >>>>>>>>>> >>>>>>>>>>> [considering whether code like this can be rearranged] >>>>>>>>>>> s = 0; >>>>>>>>>>> for (long int i=0; i<n; i++) >>>>>>>>>>> s = s + a[i]; [...] >> Reassociation is possible with -frwapv, not possible with >> normal semantics. > > I don't know what exactly this flag means, but it does not mean > what you think it does. Whatever it is that gcc does, the basic point is correct. If signed integer arithmetic is implemented as producing the same bit patterns as though done using unsigned arithmetic, then a compiler may take advantage of that property and rearrange terms of the sum, without being in conflict with the C standard. Alternatively, the variable s could be declared as an unsigned type of appropriate size, and the result converted to the appropriate signed type after the loop completes, which allows rearrangement regardless of the rules for signed arithmetic.
Technical Details
Message-ID:
<86h5h8lvk1.fsf@linuxsc.com>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> <11dsbag$5a43$1@dont-email.me> <20261121225025.000010a7@yahoo.com>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: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.arch Subject: Re: vector length CSR? Date: Sun, 22 Nov 2026 07:45:02 -0800 Organization: A noiseless patient Spider Lines: 30 Message-ID: <86h5h8lvk1.fsf@linuxsc.com> 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> <20261121225025.000010a7@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sun, 22 Nov 2026 15:45:05 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1124441"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/MtLXZgtqbJqvr4hD9/ua1uL2HdfOmLc="; posting-host="b2feea73d099697996dc22c6cc93281e" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:vlk0BZNxmlQwaL+/9J7ePsj4Npk= sha1:5zaFnyUuhPPZhV5bAD73f+XjStk= sha256:5JxIbhsqyPt8EGSecL8os2DOrYRfdAXNuEq6F/d7O6o= sha1:/B+60H/HHgHEC3m9V6twPdolIRg= sha256:A8ntViCsQISz1nLAGyM558x5iuFz1MSaxJCXCvaqErs=