https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110268
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Christophe Lyon <cl...@gcc.gnu.org>: https://gcc.gnu.org/g:eca10aaa3954af3dab56eccc208c90273c2b1732 commit r14-2418-geca10aaa3954af3dab56eccc208c90273c2b1732 Author: Christophe Lyon <christophe.l...@linaro.org> Date: Mon Jun 26 14:39:47 2023 +0000 arm: Fix MVE intrinsics support with LTO (PR target/110268) After the recent MVE intrinsics re-implementation, LTO stopped working because the intrinsics would no longer be defined. The main part of the patch is simple and similar to what we do for AArch64: - call handle_arm_mve_h() from arm_init_mve_builtins to declare the intrinsics when the compiler is in LTO mode - actually implement arm_builtin_decl for MVE. It was just a bit tricky to handle __ARM_MVE_PRESERVE_USER_NAMESPACE: its value in the user code cannot be guessed at LTO time, so we always have to assume that it was not defined. The led to a few fixes in the way we register MVE builtins as placeholders or not. Without this patch, we would just omit some versions of the inttrinsics when __ARM_MVE_PRESERVE_USER_NAMESPACE is true. In fact, like for the C/C++ placeholders, we need to always keep entries for all of them to ensure that we have a consistent numbering scheme. 2023-06-26 Christophe Lyon <christophe.l...@linaro.org> PR target/110268 gcc/ * config/arm/arm-builtins.cc (arm_init_mve_builtins): Handle LTO. (arm_builtin_decl): Hahndle MVE builtins. * config/arm/arm-mve-builtins.cc (builtin_decl): New function. (add_unique_function): Fix handling of __ARM_MVE_PRESERVE_USER_NAMESPACE. (add_overloaded_function): Likewise. * config/arm/arm-protos.h (builtin_decl): New declaration. gcc/testsuite/ * gcc.target/arm/pr110268-1.c: New test. * gcc.target/arm/pr110268-2.c: New test.