<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59561>59561</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-cl 32 bit vectorcall doesn't match msvc 32 bit vectorcall
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          altalk23
      </td>
    </tr>
</table>

<pre>
    I got an abi incompatibility between msvc and clang on i686-pc-windows-msvc target using version 15.0.6.

Take this function:
```cpp
float __vectorcall test(
    int ecx, int edx, float xmm0, float xmm1, float xmm2, float xmm3, float xmm4, float xmm5,
    int stack1, float stack2, int stack3
) {
    return stack2;
}
```

In msvc the `stack2` parameter is passed by value, but in clang it is passed by reference. [Godbolt link](https://godbolt.org/z/Gj4Y4WdY3)

The definition for [__vectorcall from Microsoft Docs](https://learn.microsoft.com/en-us/cpp/cpp/vectorcall?view=msvc-170) actually say "seventh and subsequent vector type arguments are passed on the stack by reference to memory allocated by the caller" for x86, but msvc itself does not follow this and passes by value instead.  Msvc only seems to pass by value if the argument is float or double but not the other vector types like __m128. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVE2PozgQ_TXOpRRkikCSA4fpjjKaw9xWWs2pZUwRPDF21i6Szv76lSHZbnpXighFvfrwew9UjObkiGpRvojysFIj9z7UyrKyZyxWjW_v9Q84eQblQDUGjNN-uCg2jbGG79AQ34gcDPGqQbkWtFXuBN6BqXbV-qLXN-Naf4vrCcEqnIhhjMad4EohGu8gLzOZVZmQByG_zdc_1JmAexOhG51m450oHilRyfmnL5f5SWe9Ynh7u5JmH7SyFpgiC9zNeQAA4xhIvwt8nW_b6XaufB8GuYjyRYSLqFhEm0VUCnxdjoys9PlTuynG5xZTVDyOhXsQ25eP8kA8BvesKB4ZsT18oeEzbT8eQnBPICr5qK2keEXxTV5UUAMxBTARLipGaqG5w1XZkdJKzchg3ENBw0tUoI4COU0ZiPLlu28bbxmscWdRHgTueuZLTCLhUeDxNOczH04Cj38LPH7_vfm1-bP9VQjcL5TuCVrqjDNJZeh8SP0XYnbBD_DT6OCj7xgOXsf_m2lJBZcNT1ym_SDwSG49RoHH5Jbn9aO3KI5XQzdRHBJv63wrkw5K86isvUNUdxCIka7kuJ_8Hccm0l8jOYa5DfD9QqDCaRzIcQQV6Embd5MSkwwLDoE9DDT4cAdlrdeKZ5ITOq1FQSBOXLzvqqc0k7KGI9kOWk8RnGfovLX-Nr8qab1pcvxXVjAuMqk2A_iZyr1LpyIaYlohgT9Bu2n-8yRJ_tm0PkDrx8bStEaamnCeewqfOYhgzZng7W3IcZfBqq2Ldl_s1YrqvNrmiDu53a36uthUuMN913VlKZWUbbvNcyplUVVUbPbNytQoEXPMK0SZ57tM7ysqiyrPJbW61bnYSBqUsZm11yF5bGViHKku92WVr6xqyMbpk4bo6AZTUiCmL1yoU826GU9RbKQ1keNHFzZsqZ78v9YWCoTGPGWenJhodwK3DINi3c-S_Ae2GoOtv7wPhvuxeVgyzXv8rS_B_ybNAo_Tlsmp0yn-CQAA__93G9QT">