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.

贡献者指南