Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6046301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:13:25+00:00 2026-05-23T07:13:25+00:00

Parameter passing in Visual Studio . Note how __m128 types are passed. Does it

  • 0

Parameter passing in Visual Studio. Note how __m128 types are passed. Does it mean that no more than 4 __m128 arguments should be passed by value.

void good_function(__m128, __m128, __m128, __m128, __m128&);
void bad_function(__m128, __m128, __m128, __m128, __m128);

Does the same rule apply to GCC?

Thank you!

EDIT: Is it possible that the fifth argument of bad_function can be misaligned? I read somewhere that only 3 arguments are passed in registers (I guess it is Win32, not x64).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:13:26+00:00Added an answer on May 23, 2026 at 7:13 am

    The parameter passing description you linked to is actually a x86_64 Windows ABI (application binary interface) description demonstrating how values will be passed to a function at the assembly level (i.e., how the compiler will translate a C-function call to assembly). That being said, the first four arguments will be passed as pointers to the __m128 types using registers on a x86_64 platform. Since the x86_64 platform has more registers to work with compared to it’s 32-bit couterpart, this type of parameter passing is done in order to speed up functions calls since accessing arguments stored in registers will be faster than accessing argument values stored in memory on the stack like you would normally see with cdecl-style function calls on a 32-bit x86 platform. If you go beyond 4 arguments, then the rest of the pointers to the __m128 type are stored on the stack. So there are no “good function” or “bad functions” simply based on the the number of arguments. In your example, both of your functions are good, it’s just with the second example the rest of the arguments must use stack-space, as the number of available registers that can be used to pass values have been used up.

    That being said, the pointers to the __m128 types will most likely be pointing to addresses allocated on the stack if they are automatic variables. So either way, you’ll most likely be using stack space, either to store the variables being pointed to, or to pass extra arguments to functions when working with larger-than-64-bit values and other aggregate types like classes, unions, arrays, etc.

    As for GCC, since what you’ve referenced is actually a platform-dependent ABI implementation (in this case x86_64 Windows), what you’ll see on other platforms will differ somewhat, although again, for most x86_64 OS’s, they will use a series of registers to pass the first couple arguments of a function call. So GCC will actually use the same rules as Visual Studio on x86_64 Windows, but on other platforms it will create different assembly based on the x86_64 ABI’s for those platforms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in migration project from VC6 to VC9. In VC9 (Visual Studio
Which parameter passing method is used in Android? Pass by reference or Pass by
What is the difference between the following parameter passing mechanisms in C++? void foo(int
I have developed a ASP.NET application,I have used sessions for parameter passing. I dont
I want to ask about the passing parameter in objective C on iPhone simulator.
I'm building a small application in Visual Studio 2010 with .Net 4.0 and C#
i'm pretty new to ADO.NET using C# (Visual Studio 2010). Using LinqToSql isn't an
Is there an OS or user-account level modification for windows 7 that I can
I have a VB6 project that references COMSVCSLib and one of the methods makes
I have a problem with class member function templates. It seems that gcc is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.