[Bug target/55803] New: SSE2 double negation less efficient than explicit xor

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 24 10:42:00 GMT 2012


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

             Bug #: 55803
           Summary: SSE2 double negation less efficient than explicit xor
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org
            Target: x86_64-linux-gnu


Compiling the following code with -Os (-O3 or -O2 have the same with xorpd) on
x86_64-linux

#include <x86intrin.h>
double f(double d){
  return -d;
}
__m128d g(__m128d d){
  __m128d m={-0.,0.};
  return _mm_xor_pd(d,m);
}

gives for f:
    movsd    .LC0(%rip), %xmm1
    xorps    %xmm1, %xmm0

and for g:
    xorps    .LC0(%rip), %xmm0

-mavx doesn't help.



More information about the Gcc-bugs mailing list