[Bug rtl-optimization/88168] New: -fno-jump-tables still generates jump table
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 23 13:46:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88168
Bug ID: 88168
Summary: -fno-jump-tables still generates jump table
Product: gcc
Version: 8.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
[hjl@gnu-cfl-1 microbenchmark]$ cat switch.c
int
foo (int i)
{
int j;
switch (i)
{
case 0:
j = 3;
break;
case 2:
j = 9;
break;
case 3:
j = 23;
break;
case 8:
j = 43;
break;
default:
j = 31;
break;
}
return j;
}
[hjl@gnu-cfl-1 microbenchmark]$ /usr/gcc-8.1.1-x32/bin/gcc -S -O2 switch.c
-fno-jump-tables
[hjl@gnu-cfl-1 microbenchmark]$ cat switch.s
.file "switch.c"
.text
.p2align 4,,15
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movl $31, %eax
cmpl $8, %edi
ja .L1
movl %edi, %edi
movl CSWTCH.0(,%rdi,4), %eax
.L1:
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
.section .rodata
.align 32
.type CSWTCH.0, @object
.size CSWTCH.0, 36
CSWTCH.0:
.long 3
.long 31
.long 9
.long 23
.long 31
.long 31
.long 31
.long 31
.long 43
.ident "GCC: (GNU) 8.1.1 20180521"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-1 microbenchmark]$
More information about the Gcc-bugs
mailing list