https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101981

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
> 
> Not a big difference in term of instructions is this case but as much as the
> switch increases, the difference becomes huge (in my case it switched from
> 75 to 94 lines)
> Code size increases of about 10%.
> 
> 
> @Martin, do you know if this is linked?

Yes, it's slightly related. This one is about a bit changed emission of
bit-tests:

GCC 7 emits:

  <bb 2> [100.00%]:
  _6 = (unsigned int) a_2(D);
  if (_6 > 29)
    goto <bb 4>; [50.00%]
  else
    goto <bb 3>; [50.00%]

  <bb 3> [50.00%]:
  _8 = 1 << _6;
  _9 = _8 & 933684326;
  if (_9 != 0)
    goto <bb 5>; [46.00%]
  else
    goto <bb 4>; [54.00%]

  <bb 4> [77.00%]:
  printf ("default a(%d)\n", a_2(D));

  <bb 5> [100.00%]:
  printf ("a(%d)\n", a_2(D)); [tail call]
  return;

while GCC master does:

  <bb 2> [local count: 1073741824]:
  _13 = (unsigned int) a_2(D);
  _12 = _13 > 29;
  if (_12 != 0)
    goto <bb 4>; [20.00%]
  else
    goto <bb 3>; [80.00%]

  <bb 3> [local count: 858993464]:
  _11 = 933684326 >> _13;
  _10 = _11 & 1;
  _9 = _10 != 0;
  if (_9 != 0)
    goto <bb 5>; [58.62%]
  else
    goto <bb 4>; [41.38%]

  <bb 4> [local count: 354334800]:
<L0>:
  printf ("default a(%d)\n", a_2(D));

  <bb 5> [local count: 1073741824]:
<L1>:
  printf ("a(%d)\n", a_2(D));
  return;

which is pretty much the same code. Note your line count metrics is a bit
misleading
as directives like .word or .byte have a different size in the final binary,
simiarly for other
instructions.

Reply via email to