Bug 22198 - Miscompile of SSE2 _mm_madd_epi16 with -O2
Summary: Miscompile of SSE2 _mm_madd_epi16 with -O2
Status: RESOLVED DUPLICATE of bug 21920
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: wrong-code
Depends on:
Reported: 2005-06-27 15:02 UTC by Isabelle Hurbain
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Target: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:

Testcase (13.03 KB, text/plain)
2005-06-27 15:03 UTC, Isabelle Hurbain

Note You need to log in before you can comment on or make changes to this bug.
Description Isabelle Hurbain 2005-06-27 15:02:00 UTC
The attached code is OK with gcc 3.3.6 debian and gcc 4.0 without -O2 but does not generate pmaddw 
instruction with gcc 4.0 and -O2.
The compile line is
/usr/local/bin/gcc -save-temps -msse2 -Wall -O2 -o bug-report bug-report.c
and the values are NOT initialized in the gcc 4.0 -O2 setup.
Comment 1 Isabelle Hurbain 2005-06-27 15:03:33 UTC
Created attachment 9160 [details]
Comment 2 Andrew Pinski 2005-06-27 15:06:13 UTC
Does -fno-strict-aliasing help as you are violating C aliasing rules:
   a128 = _mm_load_si128((__m128i *)a_storage);
Comment 3 Isabelle Hurbain 2005-06-27 15:14:47 UTC
Well, ld do segfault now...
To be honest I don't know about C aliasing rules ;-(
Comment 4 Andrew Pinski 2005-06-27 15:23:41 UTC

*** This bug has been marked as a duplicate of 21920 ***
Comment 5 Isabelle Hurbain 2005-06-27 15:45:04 UTC
Sorry, no segfault of ld. My mistake - wrong compilation options.