https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47253
--- Comment #14 from H.J. Lu <hjl.tools at gmail dot com> --- Created attachment 60458 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60458&action=edit A patch to fold jump table with tests I got [hjl@gnu-tgl-3 pr47253]$ cat j.c void bar0 (void); void bar1 (void); void bar2 (void); void bar3 (void); void bar4 (void); void foo (int i) { switch (i) { case 0: bar0 (); break; case 1: bar1 (); break; case 2: bar2 (); break; case 3: bar3 (); break; case 4: bar4 (); break; } } [hjl@gnu-tgl-3 pr47253]$ cat j.s .file "j.c" .text .p2align 4 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc cmpl $4, %edi ja .L1 movl %edi, %edi jmp *.L4(,%rdi,8) .section .rodata .align 8 .align 4 .L4: .quad bar0 .quad bar1 .quad bar2 .quad bar3 .quad bar4 .text .L1: ret .cfi_endproc .LFE0: .size foo, .-foo .ident "GCC: (GNU) 15.0.1 20250211 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-tgl-3 pr47253]$