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: unassig...@gcc.gnu.org

        ReportedBy: gli...@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.

Reply via email to