Hacker News new | past | comments | ask | show | jobs | submit login
See What Your C Function Compiles To (godbolt.org)
7 points by SworDsy on June 30, 2015 | hide | past | favorite | 2 comments



The output provided when looking at the given example squaring function without and then with the compiler option -O (GCC 5.1.0 or Clang 3.6) is rather interesting.

The code goes from something rather crazy looking, to something that a human would write. Its surprising that these compilers arnt clever enough already to produce the optimized output by default.


> Compiler: x86 gcc 4.9.2

> Compiler options: -march=i686

> error: CPU you selected does not support x86-64 instruction set

Strange, I'm sure x86 is not x86_64




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: