Bug 47759 - _mm_empty() intrinsic fails to serve as a boundary between MMX and x87 code due to optimizations
Summary: _mm_empty() intrinsic fails to serve as a boundary between MMX and x87 code d...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2011-02-15 21:52 UTC by Siarhei Siamashka
Modified: 2011-02-15 21:59 UTC (History)
0 users

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-02-15 21:57:56


Attachments
mm_empty_testcase.c (204 bytes, text/plain)
2011-02-15 21:52 UTC, Siarhei Siamashka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Siarhei Siamashka 2011-02-15 21:52:02 UTC
Created attachment 23355 [details]
mm_empty_testcase.c

The attached testcase fails when compiled with -O2 or -O3 optimizations, but works with -O1.

I'm actually not precisely sure how this code is expected to behave because intrinsics are x86 architecture specific and C standard can't be used as a reference. But my guess is that if the optimizer would not be allowed to arbitrarily move code across _mm_empty() boundary, then the problem would disappear.
Comment 1 Andrew Pinski 2011-02-15 21:57:56 UTC
Confirmed, the scheduler does not know that the mmx instructions touch the x87 registers.
Comment 2 Andrew Pinski 2011-02-15 21:59:12 UTC
Note this is a target specific issue and not a generic scheduler issue as the target does not communicate to the scheduler that the x87 registers and the MMX register overlap.