https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81914
--- Comment #9 from Daniel Fruzynski <bugzi...@poradnik-webmastera.com> --- In the meantime I found another case when gcc 7 inserts lots of jumps. I am not sure if your extra test cases covers it too: #include <stdint.h> int test(int data1[9][9], int data2[9][9]) { uint64_t b1 = 0, b2 = 0; for (int n = 0; n < 9; ++n) { for (int k = 0; k < 9; ++k) { int a = data1[n][k] * 9 + data2[n][k]; (a < 64 ? b1 : b2) |= 1 << (a & 63); } } return __builtin_popcount(b1) + __builtin_popcount(b2); }