llvm/llvm-project

Calling convention differs from MSVC for member functions returning SIMD types

Open

#104 建立於 2020年1月22日

在 GitHub 查看
 (8 留言) (0 反應) (1 負責人)C++ (10,782 fork)batch import
ABIbackend:X86extension:microsoftgood first issueplatform:windows

倉庫指標

Star
 (26,378 star)
PR 合併指標
 (平均合併 1天 2小時) (30 天內合併 1,000 個 PR)

描述

#include "xmmintrin.h"

class Foo {
public:
  __declspec(noinline) __m128 bar() { 
    return __m128{}; 
  }
};

clang-cl returns in xmm0, msvc takes a second hidden parameter to write to, so when the caller and callee come from objects created by different compilers any integer parameters are offset and the return value is incorrect.

The visual studio documentation (https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019#return-values) seem to imply that clang's behaviour is correct, unless __m128 etc are considered user defined types.

貢獻者指南