This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Slow switch on Pentium
- To: HRBRUNNER-24864 dot WERKSTUDENT at hl dot siemens dot de
- Subject: Re: Slow switch on Pentium
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 21 Dec 1998 19:49:28 -0700
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <345D9A56.6969@hl.siemens.de>you write:
> Hi!
>
> Since the Pentium (I+II) and most of the cloner (K5 and K6) have
> separated, but coherent I and D caches, and a prohibited policy for
> duplicated lines (no cache lines are duplicated), a switch statement on
> a pentium may take quite a performance hit, see for example
>
> http://www.complang.tuwien.ac.at/misc/pentium-switch/
>
> The obvious solution (put the jump table into the ro-data segment)
> doesn't work for -fPIC code. My idea is the following:
>
> Replace the jump table in text segment #ifdef's (in final.c) with an
> if(JUMP_TABLE_IN_TEXT_SEGMENT) { statement, which would be true or false
> for architectures without I/D cache coherency (the compiler will strip
> off the dead code, anyway), and fpic_mode for the Pentium.
Yes. As of egcs-1.1, the most x86 ports prefer to put jump tables into the
readonly data section.
jeff