[PATCH] D73268: [ARM,MVE] Make the MVE intrinsics work in C++!

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 23 05:26:45 PST 2020


simon_tatham created this revision.
simon_tatham added reviewers: LukeGeeson, MarkMurrayARM, miyuki, dmgreen.
Herald added subscribers: cfe-commits, kristof.beyls.
Herald added a project: clang.

Apparently nobody has tried this in months of development. It turns
out that `FunctionDecl::getBuiltinID` will never consider a function
to be a builtin if it is in C++ and not extern "C". So none of the
function declarations in <arm_mve.h> are recognized as builtins when
clang is compiling in C++ mode: it just emits calls to them as
ordinary functions, which then turn out not to exist at link time.

The trivial fix is to wrap most of arm_mve.h in an extern "C".

Added a test in clang/test/CodeGen/arm-mve-intrinsics which checks
basic functioning of the MVE header file in C++ mode. I've filled it
with copies of existing test functions from other files in that
directory, including a few moderately tricky cases of overloading (in
particular one that relies on the strict-polymorphism attribute added
in D72518 <https://reviews.llvm.org/D72518>).

(I considered making //every// test in that directory compile in both
C and C++ mode and check the code generation was identical. But I
think that would increase testing time by more than the value it adds,
and also update_cc_test_checks gets confused when the output function
name varies between RUN lines.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73268

Files:
  clang/test/CodeGen/arm-mve-intrinsics/cplusplus.cpp
  clang/utils/TableGen/MveEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73268.239866.patch
Type: text/x-patch
Size: 7447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200123/659479f0/attachment.bin>


More information about the cfe-commits mailing list