3 ms·
Ask any high-level language compiler implementor; they will tell you that x86's register-starvedness and anisotropic instruction encoding are huge losses. A num
by bitwize 12y ago
Ask any high-level language compiler implementor; they will tell you that x86's register-starvedness and anisotropic instruction encoding are huge losses. A number of high-quality Lisp implementations (e.g., T) never saw the light of day on x86 -- and never will -- because their compilers assumed a register file of at least sensible size (16 or so).
The world would have been better off if the 68k architecture had won back in the 80s.
- Someone 12y ago'68k is easier to write a compiler for' and 'writing a good compiler for x86 is very hard, but if you have one, x86 is faster' need not rule out each other. Maybe, both are true. Maybe, the denser x86 instruction set helps more than the its complex instruction decoder hurts. Now that CPUs with a billion transistors are 'small', that decoder doesn't look that large anymore.
- WallWextra 12y agoThe 68k address/data register split is ugly, and the double-indirect addressing modes probably cause more difficulties for a fast implementation than any x86 quirk (though this can be cured with R&D money).
- DSingularity 12y agoI dont think this is NOT true. Two reasons why. The first is register allocation algorithms have gotten really good at breaking up lifetimes of registers and producing near optimal spillcode. And the second reason is that most of the time the penalty you take is L1_ACCESS_TIME - REG_ACCESS_TIME + pushtime + poptime. On modern OOO machine with modern day L1 caches with optimized HW prefetching this is almost 0. Seriously. -edit: left out not :)
- ANTSANTS 12y ago>they will tell you that x86's register-starvedness and anisotropic instruction encoding are huge losses. Eh, not sure I buy that. Since at least the Pentium, x86 implementations have had very fast stack variable access compared to contemporary RISC architectures, practically treating some number of bytes around the stack pointer as registers. As Linus points out, everyone architecture has to confront this problem anyway sooner or later because some stack access is unavoidable; the x86 implementers just had to confront it sooner because of their ISA had half or less of the registers of the RISC architectures. So while of course it's better to keep everything in registers if possible, I'm sure that the old Lisp compilers would have performed reasonably well on x86 if they'd tried instead of throwing their hands in the air and saying "we can't do it!" And the "anisotropic instruction encoding" makes so much sense that ARM adopted it (in a much simplified fashion) with Thumb-2. Fixed width instruction encodings waste a lot of space because the common operations need 2-3 more bytes than they ought to, and because absolute addresses and constants above a certain size must be loaded from an indirect access to a location close by the instruction stream, instead of just being inline with the instruction. Instead of 1 byte of instruction + 4/8 bytes of data/address, you get 2-4 bytes of instruction including relative address + the 4-8 bytes of data you wanted to access in the first place. All this adds up after a while, and at some point, the waste of code cache hurts more than the more complicated ISA. I love 68k too (which had a somewhat "anisotropic instruction encoding" itself, by the way), but let's give credit where it's due: it took a lot of engineering talent and confidence ("RISC is the future!") for Intel to prove that CISC chips could beat RISC chips on performance. It might have never been possible for Motorola to overcome their management problems and infighting to progress 68k at the zenith of RISC hype.
- comex 12y ago> And the "anisotropic instruction encoding" makes so much sense that ARM adopted it (in a much simplified fashion) with Thumb-2. And then abandoned it in their 64-bit architecture in favor of the old uniform 32-bit, FWIW.
- ANTSANTS 12y agoOops. I haven't worked with ARM in a while, wasn't aware of that. I knew it was simplified a bit (like no more funky barrel-shifter stuff), but I'm kinda surprised they went back to a fixed-length encoding scheme when they're already taking much greater complexity hits with the high performance OoO implementations.
- ajross 12y agoNot sure which architecture you're looking at, but my x86 machines all have 16 symmetric GPRs. I'm a little confused at the idea of a high-quality Lisp implementation refusing to build in 64 bit mode. And I'm especially confused at the idea of an architecture with explicitly asymmetric registers being so much of an improvement that "the world would have been better off". I can see that argument being made over MIPS, I guess. But not 68000...
- mattnewport 12y agoDid you actually read any of the linked messages in which Linus makes a strong case for why this oft repeated claim about x86 turned out not to be a real problem in practice? If you're going to disagree with what Linus is saying can you explain why you think he's wrong?
- userbinator 12y agoI don't think a large number of architectural registers is necessary - look at what people have been able to do with the highly-constrained 6502 in the C64, for example. If anything, it's the compilers and compiler writers that need to be more intelligent about how they approach the problem, since humans have been better at writing Asm than compilers for... ever since compilers existed. I think MIPS is a good example of how trying to make a "dumb and simple" architecture to cater to compiler writers, with the promise of cheap, tiny, and fast CPUs that required far less effort to design for the same performance, didn't work out so well: http://www.extremetech.com/extreme/188396-the-final-isa-showdown-is-arm-x86-or-mips-intrinsically-more-power-efficient http://www.extremetech.com/extreme/188396-the-final-isa-show... On the 2nd page of that article are the interesting results, and there's also this odd sentence: "Loongson also struggles, possibly due to poor compiler optimization." ...but isn't MIPS supposed to be one of the most compiler-friendly ISAs, with a very orthogonal and large number of registers (32!), and a uniform instruction format? In many compiler courses it is the "model architecture" of choice for its easy code generation and "better performance", but in the real world its only real advantage seems to be being small and cheap - and ARM, which is a bit more complex, is not far from it but surpasses it easily in efficency.