- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Apologies for using the MIC forum for general compiler issues again. The following source code produces erroneous compiled code under both icpc 13.1.1.163 Build 20130313 and icpc 14.0.0.080 Build 20130728: [cpp] #include #include union u_t { __m128 n; float f[4]; }; static void testee( float x, float y, float z, float w, u_t& b) { u_t a2; a2.n = _mm_add_ps((__m128) { x, y, z, w }, (__m128) { x, y, z, w }); asm volatile ("" : : "x" (a2.n) : ); // side-effect with a2 asm volatile ("" : "=m" (b) : : ); // touch b b.n = _mm_mul_ps(b.n, (__m128) { x, y, z, w }); // > x; std::cin >> y; std::cin >> z; std::cin >> w; u_t b; std::cin >> b.f[0]; std::cin >> b.f[1]; std::cin >> b.f[2]; std::cin >> b.f[3]; for (size_t i = 0; i < 16; ++i) { asm volatile ("" : "=m" (x) : : ); // touch x asm volatile ("" : "=m" (y) : : ); // touch y asm volatile ("" : "=m" (z) : : ); // touch z asm volatile ("" : "=m" (w) : : ); // touch w testee(x, y, z, w, b); } return 0; } [/cpp] Both source code and resulting .s file attached.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for reporting this issue. I will investigate and post a reply soon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe I have reproduced this. It appears after optimization, which includes inlining the function, that the read-back of b may have been hoisted from the loop. I sent this to Development (under the internal tracking id below) for further analysis and will update the post as I learn more.
(Internal tracking id: DPD200248830)
(Resolution Update on 05/30/2014): This defect is fixed in the Intel® C++ Composer XE 2013 SP1 Update 3 release (Version 14.0.3.174 Build 20140422 - Linux)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Kevin!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Development identified the root cause as the compiler not recognizing the aliasing between "b" and "b.n" and to work around this to change the asm modifier to "b.n" and the compiler then gets the idea. I confirmed the work around.
I will provide another update on the status of the fix as I learn it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you once again, Kevin. I, too, confirm that the workaround gets the job done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This defect is fixed in the Intel® C++ Composer XE 2013 SP1 Update 3 Release (Version 14.0.3.174 Build 20140422 - Linux) now available from our Intel Registration Center.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page