Jump to content
  • Advertisement
Sign in to follow this  
discman1028

Pass+return by register in SSE?

This topic is 3777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know a trick to do this? For example: __declspec(noinline) inline __m128 MyAdd( __m128 a, __m128 b ) { return _mm_add_ps( a, b ); } will pass and return in vector registers. But trying to do the same thing with a wrapped class does not work: class MyVector { public: // ... __m128 v; }; Sometimes SIMD units have ways to flag a class or struct as being "passable/returnable by register". Anyone know of such a trick for SSE? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Just use intrinsics, use __m128 where it's suitable, go x64 and MSVC should do The Right Thing.

x86-32, go __declspec(naked) and handle it all on your own! ;)

Share this post


Link to post
Share on other sites
Cool, I didn't know about naked, thanks. Seems to only work for 32-bit as you say.

Would x64 pass my 'class MyVector' by register? How is it different?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!