llvm/llvm-project

Calling convention differs from MSVC for member functions returning SIMD types

Open

#104 ouverte le 22 janv. 2020

Voir sur GitHub
 (8 commentaires) (0 réactions) (1 assigné)C++ (10 782 forks)batch import
ABIbackend:X86extension:microsoftgood first issueplatform:windows

Métriques du dépôt

Stars
 (26 378 stars)
Métriques de merge PR
 (Merge moyen 1j 2h) (1 000 PRs mergées en 30 j)

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.

Guide contributeur