This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/45861] New: Possible missed optimization - array ops vs shift-and-mask
- From: "zackw at panix dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 1 Oct 2010 18:31:55 +0000
- Subject: [Bug c/45861] New: Possible missed optimization - array ops vs shift-and-mask
- Auto-submitted: auto-generated
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?