[Bug c/45861] New: Possible missed optimization - array ops vs shift-and-mask

zackw at panix dot com gcc-bugzilla@gcc.gnu.org
Fri Oct 1 18:32:00 GMT 2010


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

           Summary: Possible missed optimization - array ops vs
                    shift-and-mask
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zackw@panix.com


Created attachment 21938
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=21938
test case

The attached .c file contains two functions, which (unless I screwed up)
compute exactly the same (mathematical) function - they take an array of 8
bytes, permute its elements, and stuff them into a 64-bit integer, which is
then returned.  However, GCC generates very different code for each (on
x86-64).  There seem to be two missed optimization opportunities here:

1) I don't know *which* of the two code generation possibilities here is
better, but it seems like GCC ought to know and ought to generate that code for
both functions.

2) Could we be taking advantage of SSEn vector permute instructions here?



More information about the Gcc-bugs mailing list