Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Chemist who falls in acid will be tripping for weeks.


devel / comp.arch / Re: Compact representation for common integer constants

SubjectAuthor
* Compact representation for common integer constantsJohnG
+* Re: Compact representation for common integer constantsIvan Godard
|+- Re: Compact representation for common integer constantsDavid Brown
|`* Re: Compact representation for common integer constantsJohnG
| `* Re: Compact representation for common integer constantsBGB
|  `* Re: Compact representation for common integer constantsMitchAlsup
|   `* Re: Compact representation for common integer constantsBGB
|    `* Re: Compact representation for common integer constantsThomas Koenig
|     +- Re: Compact representation for common integer constantsMitchAlsup
|     `* Re: Compact representation for common integer constantsBGB
|      `* Re: Compact representation for common integer constantsMitchAlsup
|       `* Re: Compact representation for common integer constantsIvan Godard
|        +- Re: Compact representation for common integer constantsMarcus
|        +* Re: Compact representation for common integer constantsBGB
|        |`* Re: Compact representation for common integer constantsMitchAlsup
|        | +* Clamping. was: Compact representation for common integer constantsIvan Godard
|        | |+* Re: Clamping. was: Compact representation for common integer constantsMitchAlsup
|        | ||`* Re: Clamping. was: Compact representation for common integerIvan Godard
|        | || `- Re: Clamping. was: Compact representation for common integer constantsMitchAlsup
|        | |`* Re: Clamping. was: Compact representation for common integerBGB
|        | | `* Re: Clamping. was: Compact representation for common integerIvan Godard
|        | |  `- Re: Clamping. was: Compact representation for common integer constantsMitchAlsup
|        | +* Re: Compact representation for common integer constantsMarcus
|        | |`* Re: Compact representation for common integer constantsMitchAlsup
|        | | `* Re: Compact representation for common integer constantsDavid Brown
|        | |  `* Re: Compact representation for common integer constantsMitchAlsup
|        | |   +- Re: Compact representation for common integer constantsThomas Koenig
|        | |   `* Re: Compact representation for common integer constantsDavid Brown
|        | |    `- Re: Compact representation for common integer constantsMitchAlsup
|        | `* Re: Compact representation for common integer constantsThomas Koenig
|        |  +- Re: Compact representation for common integer constantsAnton Ertl
|        |  `* Re: Compact representation for common integer constantsMitchAlsup
|        |   `* Re: Compact representation for common integer constantsThomas Koenig
|        |    +* Re: Compact representation for common integer constantsAnton Ertl
|        |    |`* Re: Compact representation for common integer constantsBrian G. Lucas
|        |    | +* Re: Compact representation for common integer constantsThomas Koenig
|        |    | |`- Re: Compact representation for common integer constantsBrian G. Lucas
|        |    | +- Re: Compact representation for common integer constantsStefan Monnier
|        |    | `* Re: Compact representation for common integer constantsAnton Ertl
|        |    |  `* Re: Compact representation for common integer constantsThomas Koenig
|        |    |   +* Re: Compact representation for common integer constantsAnton Ertl
|        |    |   |`* Re: Compact representation for common integer constantsThomas Koenig
|        |    |   | `- Re: Compact representation for common integer constantsAnton Ertl
|        |    |   `* Re: Compact representation for common integer constantsTerje Mathisen
|        |    |    `- Re: Compact representation for common integer constantsAnton Ertl
|        |    `* Re: Compact representation for common integer constantsMitchAlsup
|        |     `* Re: Compact representation for common integer constantsThomas Koenig
|        |      `* Re: Compact representation for common integer constantsBrian G. Lucas
|        |       `* Re: Compact representation for common integer constantsThomas Koenig
|        |        +* Re: Compact representation for common integer constantsMitchAlsup
|        |        |`- Re: Compact representation for common integer constantsThomas Koenig
|        |        +* Re: Compact representation for common integer constantsAnton Ertl
|        |        |+* Re: Compact representation for common integer constantsThomas Koenig
|        |        ||+* Re: Compact representation for common integer constantsMitchAlsup
|        |        |||`* Re: Compact representation for common integer constantsThomas Koenig
|        |        ||| `- Re: Compact representation for common integer constantsMitchAlsup
|        |        ||`* Re: Compact representation for common integer constantsAnton Ertl
|        |        || +* Re: Compact representation for common integer constantsMitchAlsup
|        |        || |+* Re: Compact representation for common integer constantsEricP
|        |        || ||+* Re: Compact representation for common integer constantsThomas Koenig
|        |        || |||+- Re: Compact representation for common integer constantsMitchAlsup
|        |        || |||+* Re: Compact representation for common integer constantsEricP
|        |        || ||||`* Re: Compact representation for common integer constantsTerje Mathisen
|        |        || |||| `* Re: Compact representation for common integer constantsDavid Brown
|        |        || ||||  `* Re: Compact representation for common integer constantsTerje Mathisen
|        |        || ||||   `* Re: Compact representation for common integer constantsDavid Brown
|        |        || ||||    `- Re: Compact representation for common integer constantsTerje Mathisen
|        |        || |||`* Re: Compact representation for common integer constantsStephen Fuld
|        |        || ||| `* Re: Compact representation for common integer constantsMitchAlsup
|        |        || |||  +- Re: Compact representation for common integer constantsStephen Fuld
|        |        || |||  `* Re: Compact representation for common integer constantsBill Findlay
|        |        || |||   `* Re: Compact representation for common integer constantsMitchAlsup
|        |        || |||    `- Re: Compact representation for common integer constantsBill Findlay
|        |        || ||+* Re: Compact representation for common integer constantsThomas Koenig
|        |        || |||+* Re: Compact representation for common integer constantsStephen Fuld
|        |        || ||||`- Re: Compact representation for common integer constantsThomas Koenig
|        |        || |||`- Re: Compact representation for common integer constantsEricP
|        |        || ||`* Re: Compact representation for common integer constantsStephen Fuld
|        |        || || +* Re: Compact representation for common integer constantsNiklas Holsti
|        |        || || |`* Re: Compact representation for common integer constantsStephen Fuld
|        |        || || | `* Re: Compact representation for common integer constantsMitchAlsup
|        |        || || |  `* Re: Compact representation for common integer constantsStephen Fuld
|        |        || || |   `* Re: Compact representation for common integer constantsEricP
|        |        || || |    +* Re: Compact representation for common integer constantsMitchAlsup
|        |        || || |    |`* Re: Compact representation for common integer constantsEricP
|        |        || || |    | `* Re: Compact representation for common integer constantsMitchAlsup
|        |        || || |    |  `* Re: Compact representation for common integer constantsThomas Koenig
|        |        || || |    |   +- Re: Compact representation for common integer constantsMitchAlsup
|        |        || || |    |   `* Re: Compact representation for common integer constantsTerje Mathisen
|        |        || || |    |    `* Re: Compact representation for common integer constantsMitchAlsup
|        |        || || |    |     +- Re: Compact representation for common integer constantsTerje Mathisen
|        |        || || |    |     `* Re: Compact representation for common integer constantsMitchAlsup
|        |        || || |    |      `- Re: Compact representation for common integer constantsTerje Mathisen
|        |        || || |    `* Re: Compact representation for common integer constantsStephen Fuld
|        |        || || |     `* Re: Compact representation for common integer constantsMitchAlsup
|        |        || || |      +- Re: Compact representation for common integer constantsBill Findlay
|        |        || || |      +* Re: Compact representation for common integer constantsThomas Koenig
|        |        || || |      |+* Re: Compact representation for common integer constantsAnton Ertl
|        |        || || |      ||`* Re: Compact representation for common integer constantsThomas Koenig
|        |        || || |      || `- Re: Compact representation for common integer constantsAnton Ertl
|        |        || || |      |`* Re: Compact representation for common integer constantsMitchAlsup
|        |        || || |      +* Re: Compact representation for common integer constantsTerje Mathisen
|        |        || || |      `* Re: Compact representation for common integer constantsStephen Fuld
|        |        || || `* Re: Compact representation for common integer constantsEricP
|        |        || |`- Re: Compact representation for common integer constantsAnton Ertl
|        |        || `* Re: Compact representation for common integer constantsThomas Koenig
|        |        |`* Re: Compact representation for common integer constantsMitchAlsup
|        |        `* Re: Compact representation for common integer constantsBrian G. Lucas
|        `* Re: Compact representation for common integer constantsQuadibloc
+* Re: Compact representation for common integer constantsBGB
`* Re: Compact representation for common integer constantsJohn Levine

Pages:123456789101112131415
Re: Compact representation for common integer constants

<s7vn9p$bfu$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16847&group=comp.arch#16847

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 06:36:41 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <s7vn9p$bfu$1@newsreader4.netcologne.de>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s6udkp$hs5$1@dont-email.me>
<6a45a966-9d86-40ed-9b16-67766956d46fn@googlegroups.com>
<s74akj$siq$1@dont-email.me>
<f94d31bd-ae99-4d0a-84d3-d16e9ba71c6fn@googlegroups.com>
<s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de>
<s7a8u7$mui$1@dont-email.me>
<9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
Injection-Date: Tue, 18 May 2021 06:36:41 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:2862:0:7285:c2ff:fe6c:992d";
logging-data="11774"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 18 May 2021 06:36 UTC

Brian G. Lucas <bagel99@gmail.com> schrieb:
> On 5/17/21 10:45 AM, Thomas Koenig wrote:

[...]

>> unsigned int foo(unsigned int *a, int n)
>> {
>> int i;
>> unsigned int res = 0;
>> for (i=0; i<n; i++)
>> res += a[i];
>>
>> return res;
>> }

> The compiler is currently based on LLVM 9. There is no mask in the loop.

So, at least there's that.

> (I do wish that the loop counter and limit were "unsigned", but that also
> seems to be a problem with legacy code.)

Unsigned loops can cause a headache, because it is often
not possible to prove they actually terminate...

>However, there is some other
> stupidness in the compiled code (compiled without VVM enabled:
> foo: ; @foo
> sra r3,r2,<32:0>
> cmp r3,r3,#1
> blt r3,.LBB0_1
> srl r3,r2,<32:0>
> mov r2,#0
> .LBB0_3: ; =>This Inner Loop Header: Depth=1
> lduw r4,[r1]
> add r2,r4,r2
> add r3,r3,#-1
> add r1,r1,#4
> bne0 r3,.LBB0_3
> mov r1,r2
> ret
> .LBB0_1:
> mov r2,#0
> mov r1,r2
> ret

A few points that I notice here.

There does not seem to be a mask added to the result at all.
Is this correct code for this platform to return the extra
bits in case of overflow? This seems to contradict what
Mitch wrote earlier.

A minor thing - why not use r1 from the start for the sum? The two
"mov r1,r2" instructions should be eliminated. Possibly, the
function epilogue is added too late for register allocation.

The other point I am not sure about. On x86_64 with gcc
with "-O2 -funroll-loops", the inner loop is compiled to

..L3:
addl (%rdi), %eax
addq $4, %rdi
cmpq %rdx, %rdi
jne .L3

where %rdx has been set up previously as the upper limit.

On a load-store architecture, the first addl would of course
be a load to a register, followed by the add.

IIRC, My 66000 has no condition registers. Unless it
has a "branch if two registers are equal" instruction,
then precomputing the upper limit probably does not
offer any advantages, is that correct?

Re: Compact representation for common integer constants

<7cacaaaf-72f0-4ea3-97dc-bbd884fb3caen@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16848&group=comp.arch#16848

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:6084:: with SMTP id u126mr5550352qkb.294.1621354201121; Tue, 18 May 2021 09:10:01 -0700 (PDT)
X-Received: by 2002:aca:b856:: with SMTP id i83mr1943784oif.157.1621354200850; Tue, 18 May 2021 09:10:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 18 May 2021 09:10:00 -0700 (PDT)
In-Reply-To: <s7vn9p$bfu$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:5109:875e:894e:4394; posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:5109:875e:894e:4394
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com> <s6udkp$hs5$1@dont-email.me> <6a45a966-9d86-40ed-9b16-67766956d46fn@googlegroups.com> <s74akj$siq$1@dont-email.me> <f94d31bd-ae99-4d0a-84d3-d16e9ba71c6fn@googlegroups.com> <s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de> <s7a8u7$mui$1@dont-email.me> <9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com> <s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me> <1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com> <s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com> <s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com> <s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me> <s7vn9p$bfu$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7cacaaaf-72f0-4ea3-97dc-bbd884fb3caen@googlegroups.com>
Subject: Re: Compact representation for common integer constants
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Tue, 18 May 2021 16:10:01 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 82
 by: MitchAlsup - Tue, 18 May 2021 16:10 UTC

On Tuesday, May 18, 2021 at 1:36:43 AM UTC-5, Thomas Koenig wrote:
> Brian G. Lucas <bag...@gmail.com> schrieb:
> > On 5/17/21 10:45 AM, Thomas Koenig wrote:
> [...]
> >> unsigned int foo(unsigned int *a, int n)
> >> {
> >> int i;
> >> unsigned int res = 0;
> >> for (i=0; i<n; i++)
> >> res += a[i];
> >>
> >> return res;
> >> }
> > The compiler is currently based on LLVM 9. There is no mask in the loop.
> So, at least there's that.
> > (I do wish that the loop counter and limit were "unsigned", but that also
> > seems to be a problem with legacy code.)
> Unsigned loops can cause a headache, because it is often
> not possible to prove they actually terminate...
> >However, there is some other
> > stupidness in the compiled code (compiled without VVM enabled:
> > foo: ; @foo
> > sra r3,r2,<32:0>
> > cmp r3,r3,#1
> > blt r3,.LBB0_1
> > srl r3,r2,<32:0>
> > mov r2,#0
> > .LBB0_3: ; =>This Inner Loop Header: Depth=1
> > lduw r4,[r1]
> > add r2,r4,r2
> > add r3,r3,#-1
> > add r1,r1,#4
> > bne0 r3,.LBB0_3
> > mov r1,r2
> > ret
> > .LBB0_1:
> > mov r2,#0
> > mov r1,r2
> > ret
> A few points that I notice here.
>
> There does not seem to be a mask added to the result at all.
> Is this correct code for this platform to return the extra
> bits in case of overflow? This seems to contradict what
> Mitch wrote earlier.
<
Yes, now I don't understand when LLVM does its smashes !?!
and when it "lets them slide".
>
> A minor thing - why not use r1 from the start for the sum? The two
> "mov r1,r2" instructions should be eliminated. Possibly, the
> function epilogue is added too late for register allocation.
<
Notice that R1 arrives pointing at the array and that R1 leaves
with the return value. So you only end up trading the MOV at the
end for a different MOV at the beginning.
>
> The other point I am not sure about. On x86_64 with gcc
> with "-O2 -funroll-loops", the inner loop is compiled to
>
> .L3:
> addl (%rdi), %eax
> addq $4, %rdi
> cmpq %rdx, %rdi
> jne .L3
>
> where %rdx has been set up previously as the upper limit.
>
> On a load-store architecture, the first addl would of course
> be a load to a register, followed by the add.
>
> IIRC, My 66000 has no condition registers. Unless it
> has a "branch if two registers are equal" instruction,
> then precomputing the upper limit probably does not
> offer any advantages, is that correct?
<
By converting the loop from up counting to down counting
one can end up with a compare-to-zero and a branch in one
instruction. This takes a CMP out of the loop.
<
But the think I don't see is why the compiler did not use the
LDUW R4,[R1+R3<<2] form available and eliminate one of
the ADDs.

Re: Compact representation for common integer constants

<2021May18.183723@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16849&group=comp.arch#16849

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 16:37:23 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 12
Distribution: world
Message-ID: <2021May18.183723@mips.complang.tuwien.ac.at>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com> <s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me> <1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com> <s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com> <s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com> <s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me> <s7vn9p$bfu$1@newsreader4.netcologne.de>
Injection-Info: reader02.eternal-september.org; posting-host="a0b2a746f58da69300f5a33c845af5f1";
logging-data="7351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GPjxpOMaeyXt23xO0aUcM"
Cancel-Lock: sha1:quxmHNyxgvlAUkQg6K9OidQ/oto=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Tue, 18 May 2021 16:37 UTC

Thomas Koenig <tkoenig@netcologne.de> writes:
>Unsigned loops can cause a headache, because it is often
>not possible to prove they actually terminate...

And the difference to signed loops is? Note that you wrote
"actually", so pretending that signed overflow does not happen does
not count.

- anton
--
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>

Re: Compact representation for common integer constants

<s80rjn$1ci$2@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16851&group=comp.arch#16851

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 16:56:23 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <s80rjn$1ci$2@newsreader4.netcologne.de>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de>
<2021May18.183723@mips.complang.tuwien.ac.at>
Injection-Date: Tue, 18 May 2021 16:56:23 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:2862:0:7285:c2ff:fe6c:992d";
logging-data="1426"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 18 May 2021 16:56 UTC

Anton Ertl <anton@mips.complang.tuwien.ac.at> schrieb:
> Thomas Koenig <tkoenig@netcologne.de> writes:
>>Unsigned loops can cause a headache, because it is often
>>not possible to prove they actually terminate...
>
> And the difference to signed loops is? Note that you wrote
> "actually", so pretending that signed overflow does not happen does
> not count.

According to many language definitions, it does indeed not
count.

I could quote you chapter and verse from the Fortran standard, but
I hope you'll take my word for it. But then again, the Fortran
standard was probably written by evil benchmarkers :-)

Re: Compact representation for common integer constants

<s80rpu$1gq$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16852&group=comp.arch#16852

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bage...@gmail.com (Brian G. Lucas)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 11:59:41 -0500
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <s80rpu$1gq$1@dont-email.me>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s6udkp$hs5$1@dont-email.me>
<6a45a966-9d86-40ed-9b16-67766956d46fn@googlegroups.com>
<s74akj$siq$1@dont-email.me>
<f94d31bd-ae99-4d0a-84d3-d16e9ba71c6fn@googlegroups.com>
<s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de>
<s7a8u7$mui$1@dont-email.me>
<9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 May 2021 16:59:42 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="24eebaa98e64fea5131a005490b3e74d";
logging-data="1562"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9tRFgt/0tQEoJKoKkrFb4"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.10.1
Cancel-Lock: sha1:El2l1F6uHLCeMkySdY5Q9Ng/Ays=
In-Reply-To: <s7vn9p$bfu$1@newsreader4.netcologne.de>
Content-Language: en-US
 by: Brian G. Lucas - Tue, 18 May 2021 16:59 UTC

On 5/18/21 1:36 AM, Thomas Koenig wrote:
> Brian G. Lucas <bagel99@gmail.com> schrieb:
>> On 5/17/21 10:45 AM, Thomas Koenig wrote:
>
> [...]
>
>>> unsigned int foo(unsigned int *a, int n)
>>> {
>>> int i;
>>> unsigned int res = 0;
>>> for (i=0; i<n; i++)
>>> res += a[i];
>>>
>>> return res;
>>> }
>
>> The compiler is currently based on LLVM 9. There is no mask in the loop.
>
> So, at least there's that.
>
>> (I do wish that the loop counter and limit were "unsigned", but that also
>> seems to be a problem with legacy code.)
>
> Unsigned loops can cause a headache, because it is often
> not possible to prove they actually terminate...
>
>> However, there is some other
>> stupidness in the compiled code (compiled without VVM enabled:
>> foo: ; @foo
>> sra r3,r2,<32:0>
>> cmp r3,r3,#1
>> blt r3,.LBB0_1
>> srl r3,r2,<32:0>
>> mov r2,#0
>> .LBB0_3: ; =>This Inner Loop Header: Depth=1
>> lduw r4,[r1]
>> add r2,r4,r2
>> add r3,r3,#-1
>> add r1,r1,#4
>> bne0 r3,.LBB0_3
>> mov r1,r2
>> ret
>> .LBB0_1:
>> mov r2,#0
>> mov r1,r2
>> ret
>
> A few points that I notice here.
>
> There does not seem to be a mask added to the result at all.
> Is this correct code for this platform to return the extra
> bits in case of overflow? This seems to contradict what
> Mitch wrote earlier.
>

This must be a bug. I'll look into it.

brian

Re: Compact representation for common integer constants

<s80sg0$6ot$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16853&group=comp.arch#16853

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bage...@gmail.com (Brian G. Lucas)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 12:11:27 -0500
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <s80sg0$6ot$1@dont-email.me>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de>
<s7a8u7$mui$1@dont-email.me>
<9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<2021May17.144318@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 May 2021 17:11:28 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="24eebaa98e64fea5131a005490b3e74d";
logging-data="6941"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4zRfvOGjG1t0Ov3uCM8HD"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.10.1
Cancel-Lock: sha1:fMCfd+Y0w6P4AsPLBQB9TF9ALD4=
In-Reply-To: <2021May17.144318@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Brian G. Lucas - Tue, 18 May 2021 17:11 UTC

On 5/17/21 7:43 AM, Anton Ertl wrote:
> Thomas Koenig <tkoenig@netcologne.de> writes:
> [Extension woes:]
>> There is an implicit assumption that people who use the default
>> types in languages like C or Fortran get code that is not
>> sub-optimal. This violates that assumption.
>
> Choosing a 32-bit default type on a 64-bit machine is unwise.
>
> But it's interesting how stuff was adapted to this decision (of using
> I32LP64 for C on 64-bit machines):
>
So, on a machine such as My66000, in which all ALU operations are 64-bit, we
should choose ILP64 as a model? Do you know of any other architectures that
have made that choice? Are their any downsides?

brian
> C defines modulo arithmetic for unsigned overflow, but not for signed
> overflow, so instead of sign-extending the result, some people got the
> idea to pretend that overflows don't happen, and "optimize" the
> sign-extension away.
>
> For unsigned numbers, C is defined, and apparently important enough to
> merit architectural workarounds for this problem: AMD64 and Aarch64
> include 32-bit instructions that zero-extend their results (and on
> AMD64 the 32-bit versions can sometimes be encoded with fewer bytes),
> but no sign-extending variant of the 32-bit instructions; at first I
> wondered about that, but now I think that this is because the
> sign-extending variants would not provide a benefit in benchmarketing
> given C compilers that "optimize" as described above.
>
> By contrast, Alpha has only sign-extending versions of 32-bit ALU
> instructions instructions, AFAIK mainly to make porting VAX software
> easier.
>
> - anton
>

Re: Compact representation for common integer constants

<s80ulp$3ki$2@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16854&group=comp.arch#16854

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 17:48:41 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <s80ulp$3ki$2@newsreader4.netcologne.de>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de>
<s7a8u7$mui$1@dont-email.me>
<9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<2021May17.144318@mips.complang.tuwien.ac.at> <s80sg0$6ot$1@dont-email.me>
Injection-Date: Tue, 18 May 2021 17:48:41 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:2862:0:7285:c2ff:fe6c:992d";
logging-data="3730"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 18 May 2021 17:48 UTC

Brian G. Lucas <bagel99@gmail.com> schrieb:
> On 5/17/21 7:43 AM, Anton Ertl wrote:
>> Thomas Koenig <tkoenig@netcologne.de> writes:
>> [Extension woes:]
>>> There is an implicit assumption that people who use the default
>>> types in languages like C or Fortran get code that is not
>>> sub-optimal. This violates that assumption.
>>
>> Choosing a 32-bit default type on a 64-bit machine is unwise.
>>
>> But it's interesting how stuff was adapted to this decision (of using
>> I32LP64 for C on 64-bit machines):
>>
> So, on a machine such as My66000, in which all ALU operations are 64-bit, we
> should choose ILP64 as a model? Do you know of any other architectures that
> have made that choice? Are their any downsides?

The obvious downside is memory requirements, especially regarding
caches - they will fill up twice as fast if most of your variables
are twice as big.

Re: Compact representation for common integer constants

<s80uqi$3ki$3@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16855&group=comp.arch#16855

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 17:51:14 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <s80uqi$3ki$3@newsreader4.netcologne.de>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s6udkp$hs5$1@dont-email.me>
<6a45a966-9d86-40ed-9b16-67766956d46fn@googlegroups.com>
<s74akj$siq$1@dont-email.me>
<f94d31bd-ae99-4d0a-84d3-d16e9ba71c6fn@googlegroups.com>
<s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de>
<s7a8u7$mui$1@dont-email.me>
<9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de> <s80rpu$1gq$1@dont-email.me>
Injection-Date: Tue, 18 May 2021 17:51:14 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:2862:0:7285:c2ff:fe6c:992d";
logging-data="3730"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 18 May 2021 17:51 UTC

Brian G. Lucas <bagel99@gmail.com> schrieb:
> On 5/18/21 1:36 AM, Thomas Koenig wrote:

>> There does not seem to be a mask added to the result at all.
>> Is this correct code for this platform to return the extra
>> bits in case of overflow? This seems to contradict what
>> Mitch wrote earlier.
>>
>
> This must be a bug. I'll look into it.

That's one thing I love about discussions such as this. So far,
we have gotten one gcc bug report and one bug for your special
architecture out of it. Keep it going, folks :-)

Re: Compact representation for common integer constants

<s8107u$28t$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16856&group=comp.arch#16856

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bage...@gmail.com (Brian G. Lucas)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 13:15:24 -0500
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <s8107u$28t$1@dont-email.me>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de>
<s7a8u7$mui$1@dont-email.me>
<9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<2021May17.144318@mips.complang.tuwien.ac.at> <s80sg0$6ot$1@dont-email.me>
<s80ulp$3ki$2@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 May 2021 18:15:26 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="24eebaa98e64fea5131a005490b3e74d";
logging-data="2333"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eEXf523sDJg40KkQo6lXX"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.10.1
Cancel-Lock: sha1:NEOk8dkTWMlnApM2BkuxdYC2l8o=
In-Reply-To: <s80ulp$3ki$2@newsreader4.netcologne.de>
Content-Language: en-US
 by: Brian G. Lucas - Tue, 18 May 2021 18:15 UTC

On 5/18/21 12:48 PM, Thomas Koenig wrote:
> Brian G. Lucas <bagel99@gmail.com> schrieb:
>> On 5/17/21 7:43 AM, Anton Ertl wrote:
>>> Thomas Koenig <tkoenig@netcologne.de> writes:
>>> [Extension woes:]
>>>> There is an implicit assumption that people who use the default
>>>> types in languages like C or Fortran get code that is not
>>>> sub-optimal. This violates that assumption.
>>>
>>> Choosing a 32-bit default type on a 64-bit machine is unwise.
>>>
>>> But it's interesting how stuff was adapted to this decision (of using
>>> I32LP64 for C on 64-bit machines):
>>>
>> So, on a machine such as My66000, in which all ALU operations are 64-bit, we
>> should choose ILP64 as a model? Do you know of any other architectures that
>> have made that choice? Are their any downsides?
>
> The obvious downside is memory requirements, especially regarding
> caches - they will fill up twice as fast if most of your variables
> are twice as big.
>
Yep, that's true. Perhaps C programmers will start to use stdint.h more so
variables in memory can be int32_t instead of just int. Sigh.

brian

Re: Compact representation for common integer constants

<c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16858&group=comp.arch#16858

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:1493:: with SMTP id t19mr6374367qtx.147.1621363400077;
Tue, 18 May 2021 11:43:20 -0700 (PDT)
X-Received: by 2002:aca:2107:: with SMTP id 7mr4702130oiz.110.1621363399794;
Tue, 18 May 2021 11:43:19 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 18 May 2021 11:43:19 -0700 (PDT)
In-Reply-To: <2021May18.183723@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:5109:875e:894e:4394;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:5109:875e:894e:4394
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me> <1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de> <2021May18.183723@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com>
Subject: Re: Compact representation for common integer constants
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Tue, 18 May 2021 18:43:20 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: MitchAlsup - Tue, 18 May 2021 18:43 UTC

On Tuesday, May 18, 2021 at 11:39:49 AM UTC-5, Anton Ertl wrote:
> Thomas Koenig <tko...@netcologne.de> writes:
> >Unsigned loops can cause a headache, because it is often
> >not possible to prove they actually terminate...
> And the difference to signed loops is? Note that you wrote
> "actually", so pretending that signed overflow does not happen does
> not count.
<
Signed calculations that overflow raise exceptions in My 66000.
<
> - anton
> --
> 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
> Mitch Alsup, <c17fcd89-f024-40e7...@googlegroups.com>

Re: Compact representation for common integer constants

<65893af1-8002-4ea7-998d-61b27be70a0fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16860&group=comp.arch#16860

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ad4:5766:: with SMTP id r6mr7358497qvx.23.1621363486221;
Tue, 18 May 2021 11:44:46 -0700 (PDT)
X-Received: by 2002:a05:6808:1496:: with SMTP id e22mr3547217oiw.78.1621363486038;
Tue, 18 May 2021 11:44:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 18 May 2021 11:44:45 -0700 (PDT)
In-Reply-To: <s80rjn$1ci$2@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:5109:875e:894e:4394;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:5109:875e:894e:4394
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me> <1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de> <2021May18.183723@mips.complang.tuwien.ac.at>
<s80rjn$1ci$2@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <65893af1-8002-4ea7-998d-61b27be70a0fn@googlegroups.com>
Subject: Re: Compact representation for common integer constants
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Tue, 18 May 2021 18:44:46 +0000
Content-Type: text/plain; charset="UTF-8"
 by: MitchAlsup - Tue, 18 May 2021 18:44 UTC

On Tuesday, May 18, 2021 at 11:56:25 AM UTC-5, Thomas Koenig wrote:
> Anton Ertl <an...@mips.complang.tuwien.ac.at> schrieb:
> > Thomas Koenig <tko...@netcologne.de> writes:
> >>Unsigned loops can cause a headache, because it is often
> >>not possible to prove they actually terminate...
> >
> > And the difference to signed loops is? Note that you wrote
> > "actually", so pretending that signed overflow does not happen does
> > not count.
> According to many language definitions, it does indeed not
> count.
>
> I could quote you chapter and verse from the Fortran standard, but
> I hope you'll take my word for it. But then again, the Fortran
> standard was probably written by evil benchmarkers :-)
<
FORTRAN loops can have the trip count determined before the loop
begins and count to that number of iterations.

C loops do not have that property.

Re: Compact representation for common integer constants

<s8123j$6an$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16861&group=comp.arch#16861

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 18:47:15 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <s8123j$6an$1@newsreader4.netcologne.de>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s6udkp$hs5$1@dont-email.me>
<6a45a966-9d86-40ed-9b16-67766956d46fn@googlegroups.com>
<s74akj$siq$1@dont-email.me>
<f94d31bd-ae99-4d0a-84d3-d16e9ba71c6fn@googlegroups.com>
<s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de>
<s7a8u7$mui$1@dont-email.me>
<9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de>
<7cacaaaf-72f0-4ea3-97dc-bbd884fb3caen@googlegroups.com>
Injection-Date: Tue, 18 May 2021 18:47:15 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:2862:0:7285:c2ff:fe6c:992d";
logging-data="6487"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 18 May 2021 18:47 UTC

MitchAlsup <MitchAlsup@aol.com> schrieb:
> On Tuesday, May 18, 2021 at 1:36:43 AM UTC-5, Thomas Koenig wrote:

[assembler code a few level of quotations up]

>> > foo: ; @foo
>> > sra r3,r2,<32:0>
>> > cmp r3,r3,#1
>> > blt r3,.LBB0_1
>> > srl r3,r2,<32:0>
>> > mov r2,#0
>> > .LBB0_3: ; =>This Inner Loop Header: Depth=1
>> > lduw r4,[r1]
>> > add r2,r4,r2
>> > add r3,r3,#-1
>> > add r1,r1,#4
>> > bne0 r3,.LBB0_3
>> > mov r1,r2
>> > ret
>> > .LBB0_1:
>> > mov r2,#0
>> > mov r1,r2
>> > ret

>> The other point I am not sure about. On x86_64 with gcc
>> with "-O2 -funroll-loops", the inner loop is compiled to
>>
>> .L3:
>> addl (%rdi), %eax
>> addq $4, %rdi
>> cmpq %rdx, %rdi
>> jne .L3
>>
>> where %rdx has been set up previously as the upper limit.
>>
>> On a load-store architecture, the first addl would of course
>> be a load to a register, followed by the add.
>>
>> IIRC, My 66000 has no condition registers. Unless it
>> has a "branch if two registers are equal" instruction,
>> then precomputing the upper limit probably does not
>> offer any advantages, is that correct?
><
> By converting the loop from up counting to down counting
> one can end up with a compare-to-zero and a branch in one
> instruction. This takes a CMP out of the loop.

That makes sense. As a matter of fact, that is something I've
wanted for gcc since 2005, as evidenced by PR 22041 :-)

> But the think I don't see is why the compiler did not use the
> LDUW R4,[R1+R3<<2] form available and eliminate one of
> the ADDs.

That would have required reversal of the loop access, which is not
something that compilers do lightly in a basically serial language
like C.

Hmm.. come to think of it, this could be a reason for an addressing
mode for something like

LDUW R4,[R1-R3<<2]

so set up one register to pointing one past the end of the array
and then (if I get your assembler correct)

label:
LDUW R4,[R1-R3<<2]
ADD R2,R4,R2
ADD R3,-1
BNE0 R3,label

which would save an instruction without reversing the loop.

Re: Compact representation for common integer constants

<s81297$6an$2@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16863&group=comp.arch#16863

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 18:50:15 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <s81297$6an$2@newsreader4.netcologne.de>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de>
<2021May18.183723@mips.complang.tuwien.ac.at>
<s80rjn$1ci$2@newsreader4.netcologne.de>
<65893af1-8002-4ea7-998d-61b27be70a0fn@googlegroups.com>
Injection-Date: Tue, 18 May 2021 18:50:15 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:2862:0:7285:c2ff:fe6c:992d";
logging-data="6487"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 18 May 2021 18:50 UTC

MitchAlsup <MitchAlsup@aol.com> schrieb:
> On Tuesday, May 18, 2021 at 11:56:25 AM UTC-5, Thomas Koenig wrote:
>> Anton Ertl <an...@mips.complang.tuwien.ac.at> schrieb:
>> > Thomas Koenig <tko...@netcologne.de> writes:
>> >>Unsigned loops can cause a headache, because it is often
>> >>not possible to prove they actually terminate...
>> >
>> > And the difference to signed loops is? Note that you wrote
>> > "actually", so pretending that signed overflow does not happen does
>> > not count.
>> According to many language definitions, it does indeed not
>> count.
>>
>> I could quote you chapter and verse from the Fortran standard, but
>> I hope you'll take my word for it. But then again, the Fortran
>> standard was probably written by evil benchmarkers :-)
><
> FORTRAN loops can have the trip count determined before the loop
> begins and count to that number of iterations.
>
> C loops do not have that property.

Your statement is correct for a simple DO loop in Fortran.

C loops do not have that property in general. By inspecting the
loop, a compiler can sometimes determine the number of loops.

And you can also write Fortran DO loops where this is not
possible - it is legal to branch out (plus, since F90,
Fortran has the equivalent of C's while loops).

Re: Compact representation for common integer constants

<jwv7djvolun.fsf-monnier+comp.arch@gnu.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16866&group=comp.arch#16866

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: monn...@iro.umontreal.ca (Stefan Monnier)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 16:08:18 -0400
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <jwv7djvolun.fsf-monnier+comp.arch@gnu.org>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s74muh$vqf$1@dont-email.me> <s789v4$rv6$1@newsreader4.netcologne.de>
<s7a8u7$mui$1@dont-email.me>
<9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<2021May17.144318@mips.complang.tuwien.ac.at>
<s80sg0$6ot$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="554cfd5a4dae7f043ac62a09fb0f7afd";
logging-data="4658"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DLy1x5ALb/vyhubjebz98"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Cancel-Lock: sha1:qMEzwvL9hUtbMp4OWj6sk0wPywI=
sha1:whSr8SzX2i9ILGM3zUb41DonmRM=
 by: Stefan Monnier - Tue, 18 May 2021 20:08 UTC

Brian G. Lucas [2021-05-18 12:11:27] wrote:
> On 5/17/21 7:43 AM, Anton Ertl wrote:
>> Thomas Koenig <tkoenig@netcologne.de> writes:
>> [Extension woes:]
>>> There is an implicit assumption that people who use the default
>>> types in languages like C or Fortran get code that is not
>>> sub-optimal. This violates that assumption.
>> Choosing a 32-bit default type on a 64-bit machine is unwise.
>> But it's interesting how stuff was adapted to this decision (of using
>> I32LP64 for C on 64-bit machines):
> So, on a machine such as My66000, in which all ALU operations are 64-bit, we
> should choose ILP64 as a model? Do you know of any other architectures that
> have made that choice?

According to https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models,
HAL's port of Solaris to SPARC64 used ILP64.
Of course, the Crays pushed this yet further and used
64bit for the char type as well.

LP64 and LLP64 seem a lot more popular.

Stefan

Re: Compact representation for common integer constants

<7f69f917-1ee3-485c-8812-4e034dfddd72n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16870&group=comp.arch#16870

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ac8:5fd5:: with SMTP id k21mr6893354qta.231.1621369314058;
Tue, 18 May 2021 13:21:54 -0700 (PDT)
X-Received: by 2002:aca:b856:: with SMTP id i83mr2735730oif.157.1621369313848;
Tue, 18 May 2021 13:21:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 18 May 2021 13:21:53 -0700 (PDT)
In-Reply-To: <s81297$6an$2@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:5109:875e:894e:4394;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:5109:875e:894e:4394
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me> <1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de> <2021May18.183723@mips.complang.tuwien.ac.at>
<s80rjn$1ci$2@newsreader4.netcologne.de> <65893af1-8002-4ea7-998d-61b27be70a0fn@googlegroups.com>
<s81297$6an$2@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7f69f917-1ee3-485c-8812-4e034dfddd72n@googlegroups.com>
Subject: Re: Compact representation for common integer constants
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Tue, 18 May 2021 20:21:54 +0000
Content-Type: text/plain; charset="UTF-8"
 by: MitchAlsup - Tue, 18 May 2021 20:21 UTC

On Tuesday, May 18, 2021 at 1:50:17 PM UTC-5, Thomas Koenig wrote:
> MitchAlsup <Mitch...@aol.com> schrieb:
> > On Tuesday, May 18, 2021 at 11:56:25 AM UTC-5, Thomas Koenig wrote:
> >> Anton Ertl <an...@mips.complang.tuwien.ac.at> schrieb:
> >> > Thomas Koenig <tko...@netcologne.de> writes:
> >> >>Unsigned loops can cause a headache, because it is often
> >> >>not possible to prove they actually terminate...
> >> >
> >> > And the difference to signed loops is? Note that you wrote
> >> > "actually", so pretending that signed overflow does not happen does
> >> > not count.
> >> According to many language definitions, it does indeed not
> >> count.
> >>
> >> I could quote you chapter and verse from the Fortran standard, but
> >> I hope you'll take my word for it. But then again, the Fortran
> >> standard was probably written by evil benchmarkers :-)
> ><
> > FORTRAN loops can have the trip count determined before the loop
> > begins and count to that number of iterations.
> >
> > C loops do not have that property.
> Your statement is correct for a simple DO loop in Fortran.
>
> C loops do not have that property in general. By inspecting the
> loop, a compiler can sometimes determine the number of loops.
>
> And you can also write Fortran DO loops where this is not
> possible - it is legal to branch out (plus, since F90,
> Fortran has the equivalent of C's while loops).
<
One could always goto or return out of FORTRAN DO loops from
at least FORTRAN II time period.

Re: Compact representation for common integer constants

<2021May19.001113@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16873&group=comp.arch#16873

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 22:11:13 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 37
Message-ID: <2021May19.001113@mips.complang.tuwien.ac.at>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com> <s7a8u7$mui$1@dont-email.me> <9f36daff-8b8f-4550-80ad-2f75dd98f319n@googlegroups.com> <s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me> <1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com> <s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com> <s7svtl$qlt$1@newsreader4.netcologne.de> <2021May17.144318@mips.complang.tuwien.ac.at> <s80sg0$6ot$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="8969735dbe9fa8af044a5c1c27b85a2b";
logging-data="23505"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rZfmQBLvdIkXQSqTyFG0I"
Cancel-Lock: sha1:KfYl1PwS3xIRe09X3Is9QILl3HQ=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Tue, 18 May 2021 22:11 UTC

"Brian G. Lucas" <bagel99@gmail.com> writes:
>On 5/17/21 7:43 AM, Anton Ertl wrote:
>> Thomas Koenig <tkoenig@netcologne.de> writes:
>> [Extension woes:]
>>> There is an implicit assumption that people who use the default
>>> types in languages like C or Fortran get code that is not
>>> sub-optimal. This violates that assumption.
>>
>> Choosing a 32-bit default type on a 64-bit machine is unwise.
>>
>> But it's interesting how stuff was adapted to this decision (of using
>> I32LP64 for C on 64-bit machines):
>>
>So, on a machine such as My66000, in which all ALU operations are 64-bit, we
>should choose ILP64 as a model?

Yes, and on all others.

>Do you know of any other architectures that
>have made that choice?

Cray

>Are their any downsides?

The major downside is that the world has adapted to the unwise
decision to go I32LP64 for ~30 years, so any change now incurs
significant switching cost.

In C you would need something like "long short" to cover both 16-bit
and 32-bit sizes (int16_t and int32_t are typically defined in terms
of keyword-based types).

- anton
--
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>

Re: Compact representation for common integer constants

<s81q45$9d$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16877&group=comp.arch#16877

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: iva...@millcomputing.com (Ivan Godard)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Tue, 18 May 2021 18:37:09 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <s81q45$9d$1@dont-email.me>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de>
<2021May18.183723@mips.complang.tuwien.ac.at>
<c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 19 May 2021 01:37:09 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0b70e0f890b8d0851156b54f119a39ee";
logging-data="301"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JBFgORQVbOOFBQKhMvX1D"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.10.1
Cancel-Lock: sha1:gPTT3+IVssakErpVHxXinmxUB4E=
In-Reply-To: <c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com>
Content-Language: en-US
 by: Ivan Godard - Wed, 19 May 2021 01:37 UTC

On 5/18/2021 11:43 AM, MitchAlsup wrote:
> On Tuesday, May 18, 2021 at 11:39:49 AM UTC-5, Anton Ertl wrote:
>> Thomas Koenig <tko...@netcologne.de> writes:
>>> Unsigned loops can cause a headache, because it is often
>>> not possible to prove they actually terminate...
>> And the difference to signed loops is? Note that you wrote
>> "actually", so pretending that signed overflow does not happen does
>> not count.
> <
> Signed calculations that overflow raise exceptions in My 66000.
> <

Or saturate, or wrap, or produce double-width result, your choice, in Mill.

Re: Compact representation for common integer constants

<s828tb$vie$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16880&group=comp.arch#16880

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Wed, 19 May 2021 05:49:31 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <s828tb$vie$1@newsreader4.netcologne.de>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de>
<2021May18.183723@mips.complang.tuwien.ac.at>
<c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com>
Injection-Date: Wed, 19 May 2021 05:49:31 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:2862:0:7285:c2ff:fe6c:992d";
logging-data="32334"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Wed, 19 May 2021 05:49 UTC

MitchAlsup <MitchAlsup@aol.com> schrieb:
> On Tuesday, May 18, 2021 at 11:39:49 AM UTC-5, Anton Ertl wrote:
>> Thomas Koenig <tko...@netcologne.de> writes:
>> >Unsigned loops can cause a headache, because it is often
>> >not possible to prove they actually terminate...
>> And the difference to signed loops is? Note that you wrote
>> "actually", so pretending that signed overflow does not happen does
>> not count.
><
> Signed calculations that overflow raise exceptions in My 66000.

Does that also happen for signed calculations smaller than the
register width (specifically, with a 32-bit int?)

If so, count me in for the first model of your architecture
that is delivered to customers, unless the price is way
above my league.

Re: Compact representation for common integer constants

<s82dhu$51r$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16881&group=comp.arch#16881

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: iva...@millcomputing.com (Ivan Godard)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Wed, 19 May 2021 00:08:45 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <s82dhu$51r$1@dont-email.me>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de>
<2021May18.183723@mips.complang.tuwien.ac.at>
<c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com>
<s828tb$vie$1@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 19 May 2021 07:08:46 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0b70e0f890b8d0851156b54f119a39ee";
logging-data="5179"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SOm3Xc3Q6vygxSJi8IpQa"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.10.1
Cancel-Lock: sha1:fj9d5pXOMPhHHFRkE8/AQzukfKA=
In-Reply-To: <s828tb$vie$1@newsreader4.netcologne.de>
Content-Language: en-US
 by: Ivan Godard - Wed, 19 May 2021 07:08 UTC

On 5/18/2021 10:49 PM, Thomas Koenig wrote:
> MitchAlsup <MitchAlsup@aol.com> schrieb:
>> On Tuesday, May 18, 2021 at 11:39:49 AM UTC-5, Anton Ertl wrote:
>>> Thomas Koenig <tko...@netcologne.de> writes:
>>>> Unsigned loops can cause a headache, because it is often
>>>> not possible to prove they actually terminate...
>>> And the difference to signed loops is? Note that you wrote
>>> "actually", so pretending that signed overflow does not happen does
>>> not count.
>> <
>> Signed calculations that overflow raise exceptions in My 66000.
>
> Does that also happen for signed calculations smaller than the
> register width (specifically, with a 32-bit int?)
>
> If so, count me in for the first model of your architecture
> that is delivered to customers, unless the price is way
> above my league.
>

Yes for Mill. Mill scalar arithmetic is just lane zero of Mill SIMD
arithmetic, and the standard overflow detection and behavior (exception,
wrap, saturate, double-width result) apply to each lane and hence
automatically to scalars. Lanes of 8/16/32/64/128 bits are supported.
Each full-width ALU is able to break the carry chain at each 8-bit
portion, selected by the desired width; the logic required beyond that
of a monolithic full-width ALU is minor.

This seems like such an obvious thing to do that I have long wondered
why it hasn't been done many times before; instead designs duplicate the
SIMD and scalar engines. It's been suggested to me that it was an
encoding issue: not enough instruction bits available to also express
the desired width in the instruction. But I really don't know.

Re: Compact representation for common integer constants

<s82kos$5sa$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16884&group=comp.arch#16884

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Wed, 19 May 2021 09:11:56 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <s82kos$5sa$1@newsreader4.netcologne.de>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me>
<1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de>
<e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de>
<bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de>
<2021May18.183723@mips.complang.tuwien.ac.at>
<c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com>
<s828tb$vie$1@newsreader4.netcologne.de> <s82dhu$51r$1@dont-email.me>
Injection-Date: Wed, 19 May 2021 09:11:56 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2a0a-a540-2862-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2a0a:a540:2862:0:7285:c2ff:fe6c:992d";
logging-data="6026"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Wed, 19 May 2021 09:11 UTC

Ivan Godard <ivan@millcomputing.com> schrieb:
> On 5/18/2021 10:49 PM, Thomas Koenig wrote:
>> MitchAlsup <MitchAlsup@aol.com> schrieb:
>>> On Tuesday, May 18, 2021 at 11:39:49 AM UTC-5, Anton Ertl wrote:
>>>> Thomas Koenig <tko...@netcologne.de> writes:
>>>>> Unsigned loops can cause a headache, because it is often
>>>>> not possible to prove they actually terminate...
>>>> And the difference to signed loops is? Note that you wrote
>>>> "actually", so pretending that signed overflow does not happen does
>>>> not count.
>>> <
>>> Signed calculations that overflow raise exceptions in My 66000.
>>
>> Does that also happen for signed calculations smaller than the
>> register width (specifically, with a 32-bit int?)
>>
>> If so, count me in for the first model of your architecture
>> that is delivered to customers, unless the price is way
>> above my league.
>>
>
> Yes for Mill. Mill scalar arithmetic is just lane zero of Mill SIMD
> arithmetic, and the standard overflow detection and behavior (exception,
> wrap, saturate, double-width result) apply to each lane and hence
> automatically to scalars. Lanes of 8/16/32/64/128 bits are supported.
> Each full-width ALU is able to break the carry chain at each 8-bit
> portion, selected by the desired width; the logic required beyond that
> of a monolithic full-width ALU is minor.

That sounds excellent. As soon as you have an affordable system on
the market, count me in. (As a reference: My son runs a Talos II
POWER machine, for which he ordered mainbord, CPU and memory from
the US).

> This seems like such an obvious thing to do that I have long wondered
> why it hasn't been done many times before; instead designs duplicate the
> SIMD and scalar engines. It's been suggested to me that it was an
> encoding issue: not enough instruction bits available to also express
> the desired width in the instruction. But I really don't know.

POWER has a 32-bit carry and overflow bits, IIRC. If you wanted
separate bits for everything from unsigned (no overflow) up to 64
or 128 bits, you would have five or six possibilities, so three
instruction bits. That can be a lot.

Re: Compact representation for common integer constants

<2021May19.124934@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16889&group=comp.arch#16889

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Wed, 19 May 2021 10:49:34 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 47
Distribution: world
Message-ID: <2021May19.124934@mips.complang.tuwien.ac.at>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com> <s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com> <s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com> <s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me> <s7vn9p$bfu$1@newsreader4.netcologne.de> <2021May18.183723@mips.complang.tuwien.ac.at> <s80rjn$1ci$2@newsreader4.netcologne.de>
Injection-Info: reader02.eternal-september.org; posting-host="8969735dbe9fa8af044a5c1c27b85a2b";
logging-data="32085"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RRgV93gNmVgTweUVyk+5c"
Cancel-Lock: sha1:htVNciSsu7ram2JIIMIqpguBfDc=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Wed, 19 May 2021 10:49 UTC

Thomas Koenig <tkoenig@netcologne.de> writes:
>Anton Ertl <anton@mips.complang.tuwien.ac.at> schrieb:
>> Thomas Koenig <tkoenig@netcologne.de> writes:
>>>Unsigned loops can cause a headache, because it is often
>>>not possible to prove they actually terminate...
>>
>> And the difference to signed loops is? Note that you wrote
>> "actually", so pretending that signed overflow does not happen does
>> not count.
>
>According to many language definitions, it does indeed not
>count.

This sentence makes no sense.

>I could quote you chapter and verse from the Fortran standard, but
>I hope you'll take my word for it.

What do "many language definitions" and "the Fortran standard" have to
do with proving what *actually* happens?

Sure, a C compiler might "prove" that, under the assumption that no
undefined behaviour happens

int i;
for (i=0; ;i++)
printf("%d\n",i);

terminates: In general, ex falso quodlibet; in this case, the proof
could be as follows: you know that i is bounded, and you know that i
increases in every iteration, so the number of iterations is bounded
and the loop terminates.

The compiler cannot prove that if i is changed to unsigned. This does
not change the fact that this loop *actually* does not terminate in
either case; well, a C compiler might "optimize" the int loop into
anything, but my experience is that gcc tends towards "optimizing"
intended-to-be-bounded loops into endless loops, not the reverse.

You can extend this example into one where the loop terminates, but
the compiler cannot prove it for the unsigned case, while it uses the
same nonsense "proof" for the signed case.

- anton
--
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>

Re: Compact representation for common integer constants

<2021May19.142314@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16890&group=comp.arch#16890

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
Date: Wed, 19 May 2021 12:23:14 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 19
Message-ID: <2021May19.142314@mips.complang.tuwien.ac.at>
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com> <s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com> <s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com> <s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me> <s7vn9p$bfu$1@newsreader4.netcologne.de> <2021May18.183723@mips.complang.tuwien.ac.at> <c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="8969735dbe9fa8af044a5c1c27b85a2b";
logging-data="8164"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ZPHoBTeRGFklHGcL2cxvt"
Cancel-Lock: sha1:T/0SywBtVzDqxjdcu8ar2G+Vyy0=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Wed, 19 May 2021 12:23 UTC

MitchAlsup <MitchAlsup@aol.com> writes:
>Signed calculations that overflow raise exceptions in My 66000.

So does add and sub on MIPS, and addv, subv, and mulv on Alpha. No C
compiler has dared to use these instructions for signed addition in C
by default (and I read that gcc -trapv does not work properly, not
that I have tried).

There is no market for such instructions. Witness the fact that Alpha
has been killed, and MIPS is struggling. These ISAs have trapping
instructions, but nobody chooses them for these instructions and
nobody uses these instructions. RISC-V, the spiritual descendent of
MIPS, turned add and sub into non-trapping instructions (i.e., MIPS
addu became RISC-V add, with no replacement for MIPS add).

- anton
--
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>

Re: Compact representation for common integer constants

<d4f1c9ec-7c1d-4085-8008-4cb7739898cdn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16892&group=comp.arch#16892

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ac8:7f10:: with SMTP id f16mr2830029qtk.340.1621435582562;
Wed, 19 May 2021 07:46:22 -0700 (PDT)
X-Received: by 2002:a05:6830:1251:: with SMTP id s17mr7909177otp.81.1621435582355;
Wed, 19 May 2021 07:46:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 19 May 2021 07:46:22 -0700 (PDT)
In-Reply-To: <s828tb$vie$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:8827:4ed:9355:ebe6;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:8827:4ed:9355:ebe6
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7bo65$9gq$1@dont-email.me> <s7h9kc$q16$1@dont-email.me> <1b0596d8-5d9a-4a33-a4e3-ff9d34fd0fc2n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de> <2021May18.183723@mips.complang.tuwien.ac.at>
<c1210d93-4092-4eb0-a15a-a0a1950b10b1n@googlegroups.com> <s828tb$vie$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d4f1c9ec-7c1d-4085-8008-4cb7739898cdn@googlegroups.com>
Subject: Re: Compact representation for common integer constants
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 19 May 2021 14:46:22 +0000
Content-Type: text/plain; charset="UTF-8"
 by: MitchAlsup - Wed, 19 May 2021 14:46 UTC

On Wednesday, May 19, 2021 at 12:49:34 AM UTC-5, Thomas Koenig wrote:
> MitchAlsup <Mitch...@aol.com> schrieb:
> > On Tuesday, May 18, 2021 at 11:39:49 AM UTC-5, Anton Ertl wrote:
> >> Thomas Koenig <tko...@netcologne.de> writes:
> >> >Unsigned loops can cause a headache, because it is often
> >> >not possible to prove they actually terminate...
> >> And the difference to signed loops is? Note that you wrote
> >> "actually", so pretending that signed overflow does not happen does
> >> not count.
> ><
> > Signed calculations that overflow raise exceptions in My 66000.
<
> Does that also happen for signed calculations smaller than the
> register width (specifically, with a 32-bit int?)
<
All calculations are 64-bit.
>
> If so, count me in for the first model of your architecture
> that is delivered to customers, unless the price is way
> above my league.
<
Price is not for me to decide. For my part the IP is essentially free.

Re: Compact representation for common integer constants

<d5edb86e-0166-4c44-83eb-19e1cd8eb2c4n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16894&group=comp.arch#16894

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ac8:7089:: with SMTP id y9mr8171469qto.153.1621436101498;
Wed, 19 May 2021 07:55:01 -0700 (PDT)
X-Received: by 2002:aca:c488:: with SMTP id u130mr8513825oif.0.1621436101208;
Wed, 19 May 2021 07:55:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 19 May 2021 07:55:00 -0700 (PDT)
In-Reply-To: <2021May19.124934@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:8827:4ed:9355:ebe6;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:8827:4ed:9355:ebe6
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com>
<s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com>
<s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com>
<s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me>
<s7vn9p$bfu$1@newsreader4.netcologne.de> <2021May18.183723@mips.complang.tuwien.ac.at>
<s80rjn$1ci$2@newsreader4.netcologne.de> <2021May19.124934@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d5edb86e-0166-4c44-83eb-19e1cd8eb2c4n@googlegroups.com>
Subject: Re: Compact representation for common integer constants
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 19 May 2021 14:55:01 +0000
Content-Type: text/plain; charset="UTF-8"
 by: MitchAlsup - Wed, 19 May 2021 14:55 UTC

On Wednesday, May 19, 2021 at 7:23:04 AM UTC-5, Anton Ertl wrote:
> Thomas Koenig <tko...@netcologne.de> writes:
> >Anton Ertl <an...@mips.complang.tuwien.ac.at> schrieb:
> >> Thomas Koenig <tko...@netcologne.de> writes:
> >>>Unsigned loops can cause a headache, because it is often
> >>>not possible to prove they actually terminate...
> >>
> >> And the difference to signed loops is? Note that you wrote
> >> "actually", so pretending that signed overflow does not happen does
> >> not count.
> >
> >According to many language definitions, it does indeed not
> >count.
> This sentence makes no sense.
<
How about this::
<
Languages, that want to be ported across multiple architectures, and
have high performing implementations, cannot specify that signed integers
overflow.
<
> >I could quote you chapter and verse from the Fortran standard, but
> >I hope you'll take my word for it.
<
> What do "many language definitions" and "the Fortran standard" have to
> do with proving what *actually* happens?
<
Many architectures do not have signed overflow.
>
> Sure, a C compiler might "prove" that, under the assumption that no
> undefined behaviour happens
>
> int i;
> for (i=0; ;i++)
> printf("%d\n",i);
>
> terminates: In general, ex falso quodlibet; in this case, the proof
> could be as follows: you know that i is bounded, and you know that i
> increases in every iteration, so the number of iterations is bounded
> and the loop terminates.
<
It may theoretically terminate, but it may not terminate in the lifetime
the earth has left.
>
> The compiler cannot prove that if i is changed to unsigned. This does
> not change the fact that this loop *actually* does not terminate in
> either case;
<
What logic does the compiler use to decide that the int version terminates
and the unsigned version does not. It seems to me that the container for
both cases contains the same number of states.
<
> well, a C compiler might "optimize" the int loop into
> anything, but my experience is that gcc tends towards "optimizing"
> intended-to-be-bounded loops into endless loops, not the reverse.
>
> You can extend this example into one where the loop terminates, but
> the compiler cannot prove it for the unsigned case, while it uses the
> same nonsense "proof" for the signed case.
> - anton
> --
> 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
> Mitch Alsup, <c17fcd89-f024-40e7...@googlegroups.com>

Re: Compact representation for common integer constants

<nqapI.385883$2A5.264183@fx45.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16902&group=comp.arch#16902

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc3.netnews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx45.iad.POSTED!not-for-mail
From: ThatWoul...@thevillage.com (EricP)
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version: 1.0
Newsgroups: comp.arch
Subject: Re: Compact representation for common integer constants
References: <44003c05-8b05-4e0e-acb8-bb252be14d26n@googlegroups.com> <s7qlup$dm0$1@newsreader4.netcologne.de> <e29a79f4-80ba-4dcb-8079-cf2f87a86b3en@googlegroups.com> <s7svtl$qlt$1@newsreader4.netcologne.de> <bcd3dd9a-cfcd-4691-9163-842ddf1f483dn@googlegroups.com> <s7u338$cek$1@newsreader4.netcologne.de> <s7v6j1$qns$1@dont-email.me> <s7vn9p$bfu$1@newsreader4.netcologne.de> <2021May18.183723@mips.complang.tuwien.ac.at> <s80rjn$1ci$2@newsreader4.netcologne.de> <2021May19.124934@mips.complang.tuwien.ac.at> <d5edb86e-0166-4c44-83eb-19e1cd8eb2c4n@googlegroups.com>
In-Reply-To: <d5edb86e-0166-4c44-83eb-19e1cd8eb2c4n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 32
Message-ID: <nqapI.385883$2A5.264183@fx45.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Wed, 19 May 2021 15:47:31 UTC
Date: Wed, 19 May 2021 11:47:24 -0400
X-Received-Bytes: 2620
 by: EricP - Wed, 19 May 2021 15:47 UTC

MitchAlsup wrote:
> On Wednesday, May 19, 2021 at 7:23:04 AM UTC-5, Anton Ertl wrote:
>> Thomas Koenig <tko...@netcologne.de> writes:
>>> Anton Ertl <an...@mips.complang.tuwien.ac.at> schrieb:
>>>> Thomas Koenig <tko...@netcologne.de> writes:
>>>>> Unsigned loops can cause a headache, because it is often
>>>>> not possible to prove they actually terminate...
>>>> And the difference to signed loops is? Note that you wrote
>>>> "actually", so pretending that signed overflow does not happen does
>>>> not count.
>>> According to many language definitions, it does indeed not
>>> count.
>> This sentence makes no sense.
> <
> How about this::
> <
> Languages, that want to be ported across multiple architectures, and
> have high performing implementations, cannot specify that signed integers
> overflow.
> <

The language spec should:
- allow the programmer to choose between bounds-range checked,
unchecked, modulo, or saturating data types
- specify that range and array bounds checks can be enabled or disabled
at compile time by command line options or inline pragmas,
for blocks of code, individual data types, or individual objects.

So that it is up to the software product developers to make any
cost-performance tradoff, not the language or HW designers.

Pages:123456789101112131415
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor