[llvm-bugs] [Bug 28975] New: ABI incompatibilities between Clang and GCC (calling conventions for AVX512 vector arguments)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 14 14:36:42 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28975

            Bug ID: 28975
           Summary: ABI incompatibilities between Clang and GCC (calling
                    conventions for AVX512 vector arguments)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: wenzel.jakob at epfl.ch
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider the following simple program:

------------------------

#include <immintrin.h>

float test_float(float x)    { return x; }
double test_double(double x) { return x; }

__m128 test_m128(__m128 x)   { return x; }
__m256 test_m256(__m256 x)   { return x; }
__m512 test_m512(__m512 x)   { return x; }

------------------------

GCC trunk compiles this to the following optimized assembly (labels stripped
away for readability):

$ gcc test.c -O3 -Wall -Wabi -mavx512f -fomit-frame-pointer -o - -S

_test_f1:
    ret
_test_f4:
    ret
_test_f8:
    ret
_test_f16:
    ret

In other words, everything is passed via registers. On the other hand, clang
uses registers for everything *except* AVX512 SIMD registers:

$ clang test.c -O3 -Wall -Wabi -mavx512f -fomit-frame-pointer -o - -S

_test_f1:
    retq

_test_f4:
    retq

_test_f8:
    retq

_test_f16:
    pushq    %rbp
    movq    %rsp, %rbp
    andq    $-64, %rsp
    subq    $64, %rsp
    vmovaps    16(%rbp), %ymm0
    vmovaps    48(%rbp), %ymm1
    vmovaps    %ymm1, 32(%rdi)
    vmovaps    %ymm0, (%rdi)
    movq    %rdi, %rax
    movq    %rbp, %rsp
    popq    %rbp
    retq

It would be desirable if Clang would match GCC's behavior here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160814/2887106f/attachment.html>


More information about the llvm-bugs mailing list