This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/67553] New: Saturating SSE/AVX instructions do not get optimized
- From: "tmb99 at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 11 Sep 2015 16:41:50 +0000
- Subject: [Bug middle-end/67553] New: Saturating SSE/AVX instructions do not get optimized
- Auto-submitted: auto-generated
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