This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: problems with gcc inline assembly using xmm registers
David Palao wrote:
irst, thanks for the reply.
What do you mean with "use the mmx builtins directly"?
(remember I'm learning this stuff right now...)
If I understand correctly, it is possible to say to the compiler that it has
to use ONLY xmm registers (you mean xmm, right?) in doing certain part(s) of
the code (and only this part(s) ) and it will be done in the most efficient
way, is it true???
see xmmintrin.h, I'm not sure what other documentation is
available, or for that matter what version of GCC it was added to.
it allows you to write stuff like,
/* great big comment snipped */
{
/* all 8 get live here. */
__m128 fd = _mm_loadl_pi (invert, (__m64 *)forward);
__m128 rd = _mm_loadl_pi (invert, (__m64 *)reverse);
__m128 fd2 = _mm_shuffle_ps (fd, fd, _MM_SHUFFLE (0,1,1,0));
__m128 rd2 = _mm_shuffle_ps (rd, rd, _MM_SHUFFLE (0,1,1,0));
__m128 h = _mm_add_ps (fd2, _mm_mul_ps (rd2, invert));
__m128 h1 = _mm_shuffle_ps (h, h, _MM_SHUFFLE (1,0,1,0));
__m128 h2r = _mm_shuffle_ps (h, h, _MM_SHUFFLE (3,2,3,2));
__m128 h2i = _mm_shuffle_ps (h, h, _MM_SHUFFLE (2,3,2,3));
__m128 r = _mm_add_ps (_mm_mul_ps (h2r, wr),
_mm_mul_ps (_mm_mul_ps (h2i, wi),
invert));
r = _mm_add_ps (r, _mm_mul_ps (h1, half1));
_mm_storel_pi ((__m64 *)forward, r);
_mm_storeh_pi ((__m64 *)reverse,r);
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk