Posts

Showing posts from April, 2012

Where are my cores?

Image
In 2005, the world's first multicore consumer CPUs became commercially available. In 2007, Intel introduced their first quad-core processors and predicted that the number of cores would continue doubling and reach 64 cores by 2011. The following graph shows this prediction and the actual number of cores that shipped on Intel's CPUs: Interesting to see how big the discrepancy is now. We were supposed to get 64-core CPUs last year but, instead, the widest Intel CPUs shipping in Dell desktops today have just 6 cores and the widest Intel CPUs available have just 10 cores. After Larrabee and the SCC, Intel are now hyping a Many Integrated Core (MIC) architecture but a consumer version has yet to materialise.

x86 code generation quality

People often claim that it is difficult to improve upon the code generated by a modern compiler using hand-written assembler. This blog post takes a look at the code generated by GCC for a simple function and finds that it implements impressive high-level optimizations but the generated code leaves a lot of room for improvement. Consider the recursive integer Fibonacci function that may be defined in C like this: int fib(int n) { return (n<2 ? n : fib(n-1)+fib(n-2)); } Writing this function in assembler by hand we obtain the following 12 instructions: fib:  cmp eax, 2  jl fin  push eax ...