---------- Forwarded message ----------
Date: Fri, 20 Jul 2007 11:41:39 -0700
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: ...
Subject: 6224421: Using mmx intrinsics
Hi Alan,
Regarding CR 6224421, using of gcc style mmx intrinsics. I think you actually
mean icc style mmx intrinsics.
Your previous comment in the CR is as follow:
----------------------------------------------------------------------------------------------------------------
Re-opening because this is not yet fixed - while the added functionality
is very nice, it's still not compatible with gcc and sources that work
fine with gcc still won't work with Sun cc without a lot of porting effort.
For the Xorg server, to use the MMX extension code for alpha blending, we
still have to use gcc because Venus is incompatible with the existing open
source code.
Incompatibilities include:
- different header names - <mmintrin.h> vs. <sys/sunmedia_types.h> &
<sys/sunmedia_intrin.h>
- the inability to cast an unsigned long long to a __m64 since Sun Studio
defined it as a struct - this gives dozens of errors in the single source
file we need to compile and is probably the biggest blocker
Of course, even if all that was fixed, we'd still need to use gcc to
compile the 32-bit version, since the gcc inline asm statements to check
for MMX compatibility on 32-bit processors are rejected by Sun Studio, but
we'd at least be able to move from gcc to Venus for the 64-bit builds of
this code, which don't need to check since MMX is always present on AMD64.
*** (#2 of 5): 2005-10-09 17:14:54 PDT [EMAIL PROTECTED]
----------------------------------------------------------------------------------------------------------------
Sun Studio is now fully compatible with the icc-style ?mmintrin.h intrinsics,
supporting close to 300 intrinsics. So you don't need to use sunmedia_intrin.h
anymore. On the other hand, all compilers explicitly/implicitly defined __m64
differently, some declared it as "long long", some as "struct", while some
defined it as a real internal type. So all compilers act somewhat differently
when it comes to casting. We declared it as "struct", thereby you can not
cast a "long long" directly to __m64. Changing it to "long long" or "real
internal type" requires significant tasks on our part, since it may requires
changes in many components of the compiler and so far you are the only customer
asking for this feature.
Would you consider modify the source a little bit as follow:
For x = (__m64) ll; // where ll is long long and x is __m64
Could you instead use dereference cast:
x = *(__m64*) ≪
For constant cast, x = (__m64) 0x3f0000007f000000;
You may do a define with something similar to
#define m64_cast(a) _mm_setr_pi32(a&0xffffffff, a>>32)
x = m64_cast(0x3f0000007f000000);
For example given a small case like:
#include <mmintrin.h>
long long ll;
__m64 x, y, m2;
#define m64_cast(a) _mm_setr_pi32(a&0xffffffff, a>>32)
void foo()
{
x = _mm_add_pi8(*(__m64 *) &ll, m2);
y = _mm_add_pi8( m64_cast(0x3f0000007f000000), m2);
}
We would generate
movq ll,%mm1 ;/ line : 11
movq m2,%mm0 paddb %mm1,%mm0
movq %mm0,x movq
.tim.string.0,%mm0 ;/ line : 14
movq m2,%mm1 paddb
%mm1,%mm0
movq %mm0,y ...
.type .tim.string.0, @object
.size .tim.string.0, 8
.4byte 0x7f000000
.4byte 0x3f000000
_______________________________________________
tools-discuss mailing list
[email protected]