[ARM,MVE] Make the MVE intrinsics work in C++!
authorSimon Tatham <simon.tatham@arm.com>
Thu, 23 Jan 2020 14:10:24 +0000 (14:10 +0000)
committerSimon Tatham <simon.tatham@arm.com>
Thu, 23 Jan 2020 14:10:27 +0000 (14:10 +0000)
commit98ea4b30c2c4e122defce039e29f7023aa2663e7
treec4c1c04238d85e28c6fe4ec7cd532e2e573f4e41
parentce23515f5ab01161c98449d833b3ae013b553aa8
[ARM,MVE] Make the MVE intrinsics work in C++!

Summary:
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).

(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.)

Reviewers: LukeGeeson, MarkMurrayARM, miyuki, dmgreen

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73268
clang/test/CodeGen/arm-mve-intrinsics/cplusplus.cpp [new file with mode: 0644]
clang/utils/TableGen/MveEmitter.cpp