Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang header file invpcidintrin.h does not compile with vectorcall ABI #40473

Closed Quuxplusone closed 4 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR41503
Status RESOLVED FIXED
Importance P normal
Reported by David Parks (code.optimizer@gmail.com)
Reported on 2019-04-15 10:39:59 -0700
Last modified on 2019-12-03 05:23:17 -0800
Version 8.0
Hardware PC Windows 2000
CC craig.topper@gmail.com, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, neeilans@live.com, richard-llvm@metafoo.co.uk, rnk@google.com
Fixed by commit(s) rG890c6ef1fb1350dd8e6b7b25da411cffbeaf6553
Attachments
Blocks
Blocked by
See also
Given the following trivial example:
Win64$ cat test_imm_vectorcall.c
#include <intrin.h>

int f(int i, int j) { return i+j; }
Win64$

It will not compile with the combination of vectorcall ABI and -march/-mtune =
skylake-avx512:

/c/Users/dparks/LLVM-8.0.0/bin/clang -c -c -mtune=skylake-avx512 -march=skylake-
avx512 -Xclang -fdefault-calling-conv=vectorcall test_imm_vectorcall.c
In file included from test_imm_vectorcall.c:1:
c:\Users\dparks\LLVM-8.0.0\lib\clang\8.0.0\include\intrin.h:181:14: error:
function declared 'cdecl' here was previously declared without calling
convention
void __cdecl _invpcid(unsigned int, void *);
             ^
c:\Users\dparks\LLVM-8.0.0\lib\clang\8.0.0\include\invpcidintrin.h:33:1: note:
previous declaration is here
_invpcid(unsigned int __type, void *__descriptor) {
^
1 error generated.

This problem also occurs with Clang 7.0.1, but does not occur with Clang 6.0.0.
Quuxplusone commented 4 years ago

Problem continues to happen with Windows version of Clang-9.0

Quuxplusone commented 4 years ago
Changing line 17 of ...\lib\clang\9.0.0\include\invpcidintrin.h from
static __inline__ void
to
__cdecl static __inline__ void

Allows programs to compile with the vectorcall ABI avoiding the head file
errors.
Quuxplusone commented 4 years ago

What if we remove the forward declaration from intrin.h?

Quuxplusone commented 4 years ago

Should be fixed by 890c6ef1fb1350dd8e6b7b25da411cffbeaf6553

Quuxplusone commented 4 years ago

Hi Craig,

Thank you for taking care of this issue.

Will the fix be included in the next clang-9.X.Y release or will it only show up in clang-10?

Dave