HomePhabricator

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

Authored by simon_tatham on Jan 23 2020, 6:10 AM.

Description

[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

Details

Committed
simon_tathamJan 23 2020, 6:10 AM
Reviewer
MarkMurrayARM
Differential Revision
D73268: [ARM,MVE] Make the MVE intrinsics work in C++!
Parents
rGce23515f5ab0: [tablegen] Emit string literals instead of char arrays
Branches
Unknown
Tags
Unknown