http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54733



             Bug #: 54733

           Summary: Missing opportunity to optimize endian independent

                    load/store

    Classification: Unclassified

           Product: gcc

           Version: unknown

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: tree-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: joey...@arm.com





This case tries to load from memory in little-endian way, no matter what

endianess current target is.



On trunk 4.8 little-endian target, two byte loads should be able to combined

into a single 16-byte load.



int read_aux(void *, int);



int read_le()

{ 

    unsigned char data[2]; 

    read_aux(data, 2); 

    return data[0] | (data[1]<<8);

}



Current Tree (optimized):

  unsigned char data[2];



  read_aux (&data, 2);

  D.4064_1 = data[0];

  D.4065_2 = (int) D.4064_1;

  D.4066_3 = data[1];

  D.4067_4 = (int) D.4066_3;

  D.4068_5 = D.4067_4 << 8;

  D.4063_6 = D.4068_5 | D.4065_2;

  data ={v} {CLOBBER};

  return D.4063_6;



Expected Tree (optimized):

  unsigned char data[2];

  unsigned short *temp;

  unsigned in D.4064;



  read_aux (&data, 2);

  temp=&data;

  D.4064_1 = *temp;

  return D.4064_1;

Reply via email to