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/67553] New: Saturating SSE/AVX instructions do not get optimized


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67553

            Bug ID: 67553
           Summary: Saturating SSE/AVX instructions do not get optimized
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tmb99 at gmx dot net
  Target Milestone: ---

Compiling this code with -O3 -mavx

__m128i v0 = _mm_setzero_si128();
__m128i v2 = _mm_setzero_si128();
__m128i sum = _mm_adds_epi16(v0,v2);
__m128i dif = _mm_subs_epi16(v0,v2);

results in the following badly optimized assembly code:

vpxor   %xmm0, %xmm0, %xmm0
vpsubsw %xmm0, %xmm0, %xmm1
vpaddsw %xmm0, %xmm0, %xmm0


IMHO the adds and subs instructions should be eliminated by the optimizer


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