public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* 4.4.2 PowerPC Optimisation
@ 2009-12-22 17:36 Mark Colby
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Colby @ 2009-12-22 17:36 UTC (permalink / raw)
  To: gcc-help

Hi,

I am trying to migrate my C/C++ cross-compiling (cygwin->powerpc) from
2.9.5 to 4.4.2. Specifically I have been successfully using 2.9.5 for
years and have just built 4.4.2 (no libraries) as I want to compile for
newer cores with isel, sse etc. I appear to have a fully working
compiler (produces a few hundred lines of code that runs correctly in my
target hardware) but the code produced is oddly inefficient despite -O3.
Under 2.9.5 this:

  typedef union
  {
    U32 R;
    struct
    {
      U32 WP:2;
      U32 WRC:2;
      U32 WIE:1;
      U32 DIE:1;
      U32 FP:2;
      U32 FIE:1;
      U32 ARE:1;
      U32 :1;
      U32 WPEXT:4;
      U32 FPEXT:4;
      U32 :13;
    } B;
  } SPR_TCRVAL_t;

  ..
  
  {
    SPR_TCRVAL_t tcr;
    tcr.R=0;
    tcr.B.WRC=2;
    tcr.B.WPEXT=10;
    tcr.B.ARE=1;
    <asm macro to assign tcr to SPR 340>
  }

produces a nice simple:

  lis 0,0x2054
  mtspr 340,0

Yet under 4.4.2 with all optimisations apparently enabled (constant
optimisation, function inlining etc all visible in the assembly output)
I get:

  li 9,2
  li 0,0
  rlwimi 0,9,28,2,3
  li 9,10
  rlwimi 0,9,17,11,14
  li 9,1
  rlwimi 0,9,22,9,9
  mtspr 340,0

!!

Has anyone seen this sort of thing before? Is there anything obviously
dumb in what I am trying to do? Any pointers gratefully received!

Thanks,

Mark


*****************************************************************
This email has been checked by the altohiway Mailcontroller Service
*****************************************************************

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: 4.4.2 PowerPC Optimisation
@ 2010-01-04 10:36 Mark Colby
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Colby @ 2010-01-04 10:36 UTC (permalink / raw)
  To: gcc-help

Apologies if this was the wrong list to ask this on. I will repost (with
a simpler and complete example) to the gcc list. Thanks, Mark

> Hi,
> 
> I am trying to migrate my C/C++ cross-compiling (cygwin->powerpc) from
> 2.9.5 to 4.4.2. Specifically I have been successfully using 2.9.5 for
> years and have just built 4.4.2 (no libraries) as I want to compile
for
> newer cores with isel, sse etc. I appear to have a fully working
> compiler (produces a few hundred lines of code that runs correctly in
my
> target hardware) but the code produced is oddly inefficient despite
-O3.
> Under 2.9.5 this:
> 
>   typedef union
>   {
>     U32 R;
>     struct
>     {
>       U32 WP:2;
>       U32 WRC:2;
>       U32 WIE:1;
>       U32 DIE:1;
>       U32 FP:2;
>       U32 FIE:1;
>       U32 ARE:1;
>       U32 :1;
>       U32 WPEXT:4;
>       U32 FPEXT:4;
>       U32 :13;
>     } B;
>   } SPR_TCRVAL_t;
> 
>   ..
> 
>   {
>     SPR_TCRVAL_t tcr;
>     tcr.R=0;
>     tcr.B.WRC=2;
>     tcr.B.WPEXT=10;
>     tcr.B.ARE=1;
>     <asm macro to assign tcr to SPR 340>
>   }
> 
> produces a nice simple:
> 
>   lis 0,0x2054
>   mtspr 340,0
> 
> Yet under 4.4.2 with all optimisations apparently enabled (constant
> optimisation, function inlining etc all visible in the assembly
output)
> I get:
> 
>   li 9,2
>   li 0,0
>   rlwimi 0,9,28,2,3
>   li 9,10
>   rlwimi 0,9,17,11,14
>   li 9,1
>   rlwimi 0,9,22,9,9
>   mtspr 340,0
> 
> !!
> 
> Has anyone seen this sort of thing before? Is there anything obviously
> dumb in what I am trying to do? Any pointers gratefully received!
> 
> Thanks,
> 
> Mark


*****************************************************************
This email has been checked by the altohiway Mailcontroller Service
*****************************************************************

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-04 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-22 17:36 4.4.2 PowerPC Optimisation Mark Colby
2010-01-04 10:36 Mark Colby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).