https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86952
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to H.J. Lu from comment #5) > (In reply to Martin Liška from comment #4) > > (In reply to H.J. Lu from comment #3) > > > (In reply to Martin Liška from comment #2) > > > > H.J. I can write a patch for it. Do you expect more expensive costs when > > > > retpolines are enabled? > > > > > > retpoline is more expensive than 4 branches. > > > > Can you please make a microbenchmark that will expose how exactly is that > > expensive? Based on that I can tune current costs. > > Is there a testcase where GCC generates a jump table for a five-entry > switch statement? $ cat jt.c int global; int foo3 (int x) { switch (x) { case 0: return 11; case 1: return 123; case 2: global += 1; return 3; case 3: return 44; case 4: return 444; default: return 0; } } $ gcc jt.c -O2 -S -o/dev/stdout .file "jt.c" .text .p2align 4,,15 .globl foo3 .type foo3, @function foo3: .LFB0: .cfi_startproc cmpl $4, %edi ja .L2 movl %edi, %edi jmp *.L4(,%rdi,8) .section .rodata .align 8 .align 4 .L4: .quad .L9 .quad .L7 .quad .L6 .quad .L5 .quad .L3 .text .p2align 4,,10 .p2align 3 ...