[Bug target/110268] [14 Regression] arm MVE intrinsics support broken with LTO

2023-07-10 Thread clyon at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110268

Christophe Lyon  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #7 from Christophe Lyon  ---
Fixed.

[Bug target/110268] [14 Regression] arm MVE intrinsics support broken with LTO

2023-07-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110268

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Christophe Lyon :

https://gcc.gnu.org/g:eca10aaa3954af3dab56eccc208c90273c2b1732

commit r14-2418-geca10aaa3954af3dab56eccc208c90273c2b1732
Author: Christophe Lyon 
Date:   Mon Jun 26 14:39:47 2023 +

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   

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.

[Bug target/110268] [14 Regression] arm MVE intrinsics support broken with LTO

2023-06-19 Thread clyon at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110268

Christophe Lyon  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #5 from Christophe Lyon  ---
Indeed, a small update to arm_builtin_decl() does the trick.

Investigating how to decide whether to call
arm_mve::handle_arm_mve_h (false);
or
arm_mve::handle_arm_mve_h (true);

which is normally controlled at preprocessing time depending on
__ARM_MVE_PRESERVE_USER_NAMESPACE

[Bug target/110268] [14 Regression] arm MVE intrinsics support broken with LTO

2023-06-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110268

--- Comment #4 from Richard Biener  ---
tree
arm_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
{ 
  unsigned subcode = code >> ARM_BUILTIN_SHIFT;
  switch (code & ARM_BUILTIN_CLASS)
{
case ARM_BUILTIN_GENERAL:
  return arm_general_builtin_decl (subcode);
case ARM_BUILTIN_MVE:
  return error_mark_node;

^^^

I guess that's the problem.  MVE builtins are not handled at all?

[Bug target/110268] [14 Regression] arm MVE intrinsics support broken with LTO

2023-06-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110268

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |14.0

--- Comment #3 from Richard Biener  ---
At stream-out time we stream the MD specific DECL_FUNCTION_CODE and at
stream-in time we expect the backend has a FUNCTION_DECL corresponding to that
code for us.  The error means that targetm.builtin_decl doesn't know about the
builtin
(or did not implement "materializing" it).

[Bug target/110268] [14 Regression] arm MVE intrinsics support broken with LTO

2023-06-15 Thread clyon at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110268

--- Comment #2 from Christophe Lyon  ---
This regression appeared after the patch that re-implements vdupq, but the
issue is likely more generic.
velo r

I tried to update arm_init_mve_builtins() with:

+ if (in_lto_p)
+   {
+ arm_mve::handle_arm_mve_types_h ();
+ arm_mve::handle_arm_mve_h (false);
+   }

but that's not sufficient, we still get the same error although the MVE
intrinsics are registered.

I noticed that the error happens in unpack_ts_function_decl_value_fields() with
fcode==885, not sure where it comes from?

Besides, we'll also have to check how to compute the right value for
handle_arm_mve_h's parameter.

[Bug target/110268] [14 Regression] arm MVE intrinsics support broken with LTO

2023-06-15 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110268

Alex Coplan  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2023-06-15
 Status|UNCONFIRMED |NEW

--- Comment #1 from Alex Coplan  ---
Confirmed.