Re: optimization, powerpc style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't know the answer to Kevin's question, but why not replace the switch statement with an 
array full of messages?  Then use the message number as a subscript to choose the correct 
message.  He could keep the messages in a file that begins with the message count.
Kevin Diggs writes:

> Hi,
> 
> Please ignore the first half of the original post. I used the size
> command to make a snap judgment on the code without looking very hard
> at the assembly I posted. After actually looking at the code I
> realized that I created the .o files from the wrong .s files. In this
> case the 4.3.5 compiler DOES do a better job.
> 
> I still think the questions about the mesh compiles are valid if
> anyone has any thoughts.
> 
> Thanks (and sorry)!
> 
> kevin
> 
> On Fri, Feb 11, 2011 at 11:15 AM, kevin diggs <diggskevin38@xxxxxxxxx> wrote:
> > Hi,
> >
> > While trying to figure out why the PowerMac mesh scsi driver will work
> > when compiled with 4.1.2 but not with 4.3.5 I noticed some strange
> > behavior with literal strings.
> >
> > #include <stdio.h>
> >
> > const char *getMsg(unsigned int u)
> > {
> >        const char *p;
> >
> >        switch(u)
> >        {
> >                case 0:
> >                        p="This is message 0"; break;
> >                case 1:
> >                        p="This is message 1"; break;
> >                case 2:
> >                        p="This is message 2"; break;
> >                case 3:
> >                        p="This is message 3"; break;
> >                case 4:
> >                        p="This is message 4"; break;
> >                case 5:
> >                        p="This is message 5"; break;
> >                default:
> >                        p=NULL;
> >        }
> >
> >        return p;
> > }
> >
> > This function when compiled with 3.4.6 produces pretty good code.
> > 4.3.5 produces lesser good code. Can someone suggest what I search the
> > bug database for to see if this has been reported and what the status
> > is? Is it PowerPC specific?
> >
> 
> 

________________________________________________________________
Please visit a saintly hero:
http://www.jakemoore.org


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux