Comment Comment by rzimmerman Try with gcc 6.2 options -Ofast -march=native: int square(int num) { int a = 0; for (int x = 0; x < num; x+=2) { if (!(x % 2)) { a += x; } } return a; } All kinds of loop unrolling and vector instructions. Now remove the "!" parent rzimmerman 10 years ago