Home Dashboard Directory Help

Bad code generation for SSE/x64 release by __M



Sign in
to vote
Type: Bug
ID: 566543
Opened: 6/10/2010 12:50:04 PM
Access Restriction: Public
User(s) can reproduce this bug


The compiler incorrectly assigns registers in x64 release mode when SSE is used. In the attached case, the following code sequence is generated

    v_resultMask &= (v_rSq < v_h2);
000000013F641033 cmpltps     xmm0,xmmword ptr [13F6422D0h]
000000013F64103B andps     xmm6,xmm0

    // v_resultMask[0] is FALSE
    if (v_resultMask[0])
000000013F64103E extractps esi,xmm0,0

Clearly, the test should have used register xmm6 (i.e. extractps esi, xmm6, 0) The bug can be worked around by using _mm_extract_epi32. Just define THIS_ONE_WORKS_CORRECTLY to 1, and the resulting code is now:

000000013F4D1033 cmpltps     xmm0,xmmword ptr [13F4D22D0h]
000000013F4D103B andps     xmm6,xmm0

    // v_resultMask[0] is FALSE
    if (v_resultMask[0])
000000013F4D103E pextrd     eax,xmm6,0

Compiling this code as x86 generates an ICE in Release, see #566540.
Sign in to post a comment.
Posted by Microsoft on 8/2/2010 at 11:50 AM
Thank you for your report. We confirmed the issue you found and will fix it in a future product release. In the meantime, please use your workaround.

If you have any further questions, please reactivate this issue.

Mark Levine
Dev Lead - Visual C++
Posted by Microsoft on 6/10/2010 at 9:00 PM
Thank you for reporting the issue.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.These specialized experts will follow-up with your issue.
Posted by Microsoft on 6/10/2010 at 5:06 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
ceextractps.zip 6/10/2010 7 KB