Re: GCC does not cope with my code

bonzini@gnu.org
28 May 2000 21:05:02 -0400

          From comp.compilers

Related articles
GCC does not cope with my code braung@ert.rwth-aachen.de (Gunnar Braun) (2000-05-24)
Re: GCC does not cope with my code mq@maq.org (2000-05-28)
Re: GCC does not cope with my code webid@asi.fr (Armel) (2000-05-28)
Re: GCC does not cope with my code chrisd@reservoir.com (Chris Dodd) (2000-05-28)
Re: GCC does not cope with my code rus@tamu.edu (Silvius Rus) (2000-05-28)
Re: GCC does not cope with my code bonzini@gnu.org (2000-05-28)
Re: GCC does not cope with my code gnb@itga.com.au (Gregory Bond) (2000-05-28)
Re: GCC does not cope with my code J.Scheerder@cwi.nl (2000-05-28)
Re: GCC does not cope with my code Wilco.Dijkstra@arm.com (Wilco Dijkstra) (2000-05-28)
Re: GCC does not cope with my code braung@ert.rwth-aachen.de (Gunnar Braun) (2000-05-31)
Re: GCC does not cope with my code bosch@nile.gnat.com (Geert Bosch) (2000-06-04)
| List of all articles for this month |
From: bonzini@gnu.org
Newsgroups: comp.compilers
Date: 28 May 2000 21:05:02 -0400
Organization: Mailgate.ORG Server - http://www.Mailgate.ORG
Keywords: GCC, practice

> case 0x00001798: oldPC = PC; { ; { instruction_counter++; { ; { {
> case 0x0000179c: oldPC = PC; { ; { instruction_counter++; { ; { {
> case 0x000017a0: oldPC = PC; { ; { instruction_counter++; { ; { {


I guess the problem is the exaggerate size of the switch statement.
Try (in order):


to switch on PC >> 2, which should give more optimization opportunities to
the compiler (jump table vs. binary search);


to use gotos and `manual' binary search. That is, break becomes `goto up',
and in top you have lots of ifs that do


switch_on_pc:
if (PC < 0x...) goto from_xxx_to_yyy
if (PC < 0x...) goto from_yyy_to_zzz
...
from_xxx_to_yyy: if (PC < 0x...) goto pc_is_www
...


pc_is_www:
oldPC = PC; { ; { instruction_counter++; { ; { {
; { barrel_shifter_operand2_bus = rot_imm(0x0000001c , 0 , 0 ); } ; }
; { ; { R[0x2] = barrel_shifter_operand2_bus; if (& R[0x2] == &R[15])
R[0x2] -=4; } ; } ; } ; } ; } ; } ; cycle++; PC += 4; if (PC != (oldPC
+ 4)) goto switch_on_pc;


If portability is not a problem, GCC's && operator would do, either.


Paolo


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.