Bug 22390

Summary: MSVC fails to link pixman in x64, when SSE2 is enabled. (solution is included)
Product: pixman Reporter: George Yohng <georgefd>
Component: pixmanAssignee: Søren Sandmann Pedersen <soren.sandmann>
Status: RESOLVED FIXED QA Contact: Søren Sandmann Pedersen <soren.sandmann>
Severity: normal    
Priority: medium    
Version: other   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: MMX __m64 functions implementation for MSVC, those which are used by pixman SSE2.

Description George Yohng 2009-06-20 10:09:33 UTC
Created attachment 26978 [details]
MMX __m64 functions implementation for MSVC, those which are used by pixman SSE2.

pixman 0.15.12, and previous versions:

Microsoft C++ does not define __m64 and all related MMX functions in x64. However, it succeeds in generating object files for SSE2 code inside pixman.

The real problem happens during linking, when it cannot find MMX functions (which are not defined as intrinsics for AMD64 platform).

MMX __m64 is used relatively scarcely within SSE2 implementation, and the performance impact probably is negligible.

I have implemented those missing functions using general programming, and adding this header into pixman's config for MSVC in this way, helps the problem:

#if defined(_M_AMD64) //Microsoft
    #define __amd64__   1
    #define __x86_64__  1 
    #include "mmx_x64.h"
#endif

#ifdef _MSC_VER
    #define __attribute__(a)
#endif


Note, that there is another problem in pixman SSE2 code, which prevents it from being compiled on MSVC, namely using the __attribute__ keyword. Thus the above code also takes care of it.

The code inside mmx_x64.h is not extensively tested, but seems to perform fine within our product.
Comment 1 Søren Sandmann Pedersen 2009-07-21 00:50:04 UTC
I have added the file in git master, thanks.

Since I have no way to test this myself, please test either the latest git master or pixman 0.15.18 (when it is released) to verify that it works.

Thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.