Newsgroups: comp.arch Path: csiph.com!xmission!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!kithrup.com!mrs From: mrs@kithrup.com (Mike Stump) Subject: Re: RISC Message-ID: Date: Wed, 9 Dec 2015 01:45:55 GMT References: <58c12752-2066-4014-8f83-808e5c4dfd6d@googlegroups.com> <347d7f8c-f7fb-4d14-915f-e4b6367a2f76@googlegroups.com> Organization: Kithrup Enterprises, Ld. X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Lines: 46 X-Received-Bytes: 3017 X-Received-Body-CRC: 4280684006 Xref: csiph.com comp.arch:31666 In article <347d7f8c-f7fb-4d14-915f-e4b6367a2f76@googlegroups.com>, wrote: >On Wednesday, December 9, 2015 at 1:15:03 AM UTC+2, Mike Stump wrote: >> So, take saturating add for example. A language (C for example) can >> have a function define for sat_add that calls asm("add_s %0,%1") and >> one can use it. This can either be implemented as an opaque asm, or >> as a built-in. Further, the optimizer is free to know about the >> builtin so that one cannot readily distinguish between the language >> that never has it and one that does. gcc for saturating add has the >> built in. Further, the optimizer knows about it. In this case, I >> don't find it terribly interesting that C doesn't have a saturating >> add. The user can express himself, the compiler front end can accept >> it, and the optimizer can reason about it and the code generator can >> generate it. If the language had saturating add as a first class >> object, what would be different that mattered? >> > >Portability. Excellent point. A language standard generally speaking does form a better basis for portability than lessor standards. However, a language standard alone I don't find to be very compelling or useful anymore. For example, dynamic libraries, no language standard. open, no language standard, mmap, no language standard. fork, no language standard. GPU, no language standard. The list goes on, and over time, it only ever gets bigger in more and more important ways. As a counter point, consider alloca. It is a standard in gcc and is fairly portable. Even portable across to other compilers other than gcc. I would say that it is portable just because it is useful and people use it. Saturating add could be as portable for the same reason if people cared about it. As an example, consider rotate: long rot(unsigned long a) { return (a << 1) | (a >> 63) & 1; } No built in, no language standard, no first class support in the language for it, however, gcc will reliably always generate a rotate and the opimizer reasons about it as rotate in a way that is completely indistinguishable from it being first class in the language standard. Given the above rotate is as portable as the C or C++ language standard is, it can't be said to be less portable than the language standard itself. There is no reason why a compiler could not do the same for AES, just slightly harder.