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: [email protected]
ReportedBy: [email protected]
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.