Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown Newsgroups: comp.arch Subject: Re: Computer architects leaving Intel... Date: Sun, 15 Sep 2024 17:50:15 +0200 Organization: A noiseless patient Spider Lines: 38 Message-ID: References: <2024Aug30.161204@mips.complang.tuwien.ac.at> <2024Sep14.152652@mips.complang.tuwien.ac.at> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 15 Sep 2024 17:50:16 +0200 (CEST) Injection-Info: dont-email.me; posting-host="0f814bd11c9fbe5b78942ec153f06f57"; logging-data="2364930"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tCAoemxZ2jg48TrNateBs1/xJHVgcqrY=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:KpbP9wjSCp+mblCLU1yAtsIMZco= In-Reply-To: Content-Language: en-GB Bytes: 3052 On 14/09/2024 21:26, Thomas Koenig wrote: > MitchAlsup1 schrieb: > >> In many cases int is slower now than long -- which violates the notion >> of int from K&R days. > > That's a designers's choice, I think. It is possible to add 32-bit > instructions which should be as fast (or possibly faster) than > 64-bit instructions, as AMD64 and ARM have shown. > For some kinds of instructions, that's true - for others, it's not so easy without either making rather complicated instructions or having assembly instructions with undefined behaviour (imagine the terror that would bring to some people!). A classic example would be for "y = p[x++];" in a loop. For a 64-bit type x, you would set up one register once with "p + x", and then have a load with post-increment instruction in the loop. You can also do that with x as a 32-bit int, unless you are of the opinion that enough apples added to a pile should give a negative number of apples. But with a wrapping type for x - such as unsigned int in C or modulo types in Ada, you have little choice but to hold "p" and "x" separately in registers, add them for every load, and do the increment and modulo operation. I really can't see this all being handled by a single instruction. Of course you could add a 32-bit zero extend or sign extend to many 32-bit ALU instructions and save some instructions - many architectures already support that kind of thing. > And having a smaller memory footprint is also beneficial, especially > for caches. > > (Plus, there are FORTRAN's storage association rules, but these should > be less used by now. But for a 64-bit integer, they pretty much would > require a 64-bit REAL and a 128-bit DOUBLE PRECISION).