This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Slow switch on Pentium



  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]