This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/55027] New: simplify vector multiplication by 1


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

             Bug #: 55027
           Summary: simplify vector multiplication by 1
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org


Hello,

vector multiplication by 1 is not simplified at the tree level.

#include <x86intrin.h>
__m128d f(__m128d x){
  __m128d y={1,1};
  return x*y;
}

Worse, gcc can actually create such multiplies. In this modified version of
PR55016:

#include <math.h>
float v0[1024];
float v1[1024];
void v() {
    for(int i=0; i!=1024; ++i)
          v0[i] = 1/sqrtf(v1[i]);
}

compiled on x86_64 with gcc -O3 -ffast-math e.c -S -std=gnu99

*.optimized still shows:
  vect_var_.9_23 = vect_var_.8_21 * { 1.0e+0, 1.0e+0, 1.0e+0, 1.0e+0 };

The back-end later removes it, but it should also be handled at tree level.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]