Newsgroups: comp.arch Path: csiph.com!xmission!news.glorb.com!peer03.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: Tue, 8 Dec 2015 23:09:31 GMT References: <58c12752-2066-4014-8f83-808e5c4dfd6d@googlegroups.com> Organization: Kithrup Enterprises, Ld. X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Lines: 47 X-Received-Bytes: 3013 X-Received-Body-CRC: 2046715323 Xref: csiph.com comp.arch:31655 In article , Ivan Godard wrote: >>> Then they are poorly designed ISAs. All ISAs have some system-control >>> ops that are usable only as intrinsics or asm, but unprivileged ops >>> should all be reachable from standard languages, or be removed. >> >> >> That seems too strong. So no ISAs should implement cryptographic >> accelerations, or things like bignum assists? >> > >The question is one of terminology. A generic crypto box is essentially >an on-board I/O device, and the ops that control it are system ops that >I am not considering. The difference is whether the unit can be >independently used by several processes; you don't have to "own" the FP >adder to use it, but for a crypto either only one process (probably the >OS) can use it at all, or a process wanting to use it has to "open" it >first. Yes, the boundary is fuzzy. > >Bignum assist is a better counter-example to my over-strong assertion. >The basic ADDC op won't be produced by the compiler unless bignum is a >native type to the language. Why do you think that? See below. >So yes, there is a third category: special-purpose ops where the >compiler does not have corresponding special-purpose >languages. Saturating arithmetic is another example. But for these >the fault seems to lie in the language rather than the ISA; a >language with bignums, or saturating arithmetic, is certainly >imaginable and would be useful if your application domain called for >them. 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? Further, the argument that applies to saturating add can be used for any instruction, any resource, any black box.