llvm/llvm-project

Calling convention differs from MSVC for member functions returning SIMD types

Open

#104 aberto em 22 de jan. de 2020

Ver no GitHub
 (8 comments) (0 reactions) (1 assignee)C++ (10.782 forks)batch import
ABIbackend:X86extension:microsoftgood first issueplatform:windows

Métricas do repositório

Stars
 (26.378 stars)
Métricas de merge de PR
 (Mesclagem média 1d 2h) (1.000 fundiu PRs em 30d)

Description

#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.

Guia do colaborador