public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christian Bruel <christian.bruel@st.com>
To: Ramana Radhakrishnan <ramana.gcc@googlemail.com>
Cc: Ramana Radhakrishnan <ramana.radhakrishnan@foss.arm.com>,
	       Kyrylo Tkachov	<kyrylo.tkachov@arm.com>,
	       gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, ARM] PR65835 Fix LTO support for neon builtins
Date: Thu, 17 Dec 2015 16:21:00 -0000	[thread overview]
Message-ID: <5672E113.7040801@st.com> (raw)
In-Reply-To: <CAJA7tRbYP2Wqsb5zsn8HN0X4NwdUAEYCVJbQ6PtjRp2KTKCYfw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]


This is the new version of the patch that removes the "lto1 target 
specific builtin not available" error message happening in the LTO 
streamer-in while loading the NEON intrinsic in the global context, 
without arm_fpu_index being set with the current FPU mode.

nb: Needs https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01714.html to pass

Also robustified the associated test.

Thanks,


[-- Attachment #2: lto-neon.patch --]
[-- Type: text/x-patch, Size: 3692 bytes --]

2015-12-17  Christian Bruel  <christian.bruel@st.com>

	PR target/65837
	* arm-builtins.c (ARM_BUILTIN_CRYPTO_BASE): New enum.
	(arm_init_neon_builtins): Move neon_set_p and neon_crypto_set_p...
	(arm_init_neon_builtins_internal, arm_init_crypto_builtins_internal):
	Here.
	* arm_builtin_decl (arm_init_neon_builtins_internal)
	(arm_init_crypto_builtins_internal): Call if needed.

2015-12-17  Christian Bruel  <christian.bruel@st.com>

	PR target/65837
	* gcc.target/arm/lto/pr65837_0.c: Robustify dg tests.
	Use intrinsinc name from arm_neon.h.

Index: config/arm/arm-builtins.c
===================================================================
--- config/arm/arm-builtins.c	(revision 231774)
+++ config/arm/arm-builtins.c	(working copy)
@@ -519,6 +519,8 @@ enum arm_builtins
 #undef CRYPTO2
 #undef CRYPTO3
 
+  ARM_BUILTIN_CRYPTO_BASE,
+
 #define CRYPTO1(L, U, M1, M2) \
   ARM_BUILTIN_CRYPTO_##U,
 #define CRYPTO2(L, U, M1, M2, M3) \
@@ -893,11 +895,19 @@ arm_init_simd_builtin_scalar_types (void
 					     "__builtin_neon_uti");
 }
 
+static bool neon_set_p = false;
+static bool neon_crypto_set_p = false;
+
 static void
 arm_init_neon_builtins_internal (void)
 {
   unsigned int i, fcode = ARM_BUILTIN_NEON_PATTERN_START;
 
+  if (neon_set_p)
+    return;
+
+  neon_set_p = true;
+
   arm_init_simd_builtin_types ();
 
   /* Strong-typing hasn't been implemented for all AdvSIMD builtin intrinsics.
@@ -1020,6 +1030,11 @@ arm_init_neon_builtins_internal (void)
 static void
 arm_init_crypto_builtins_internal (void)
 {
+  if (neon_crypto_set_p)
+    return;
+
+  neon_crypto_set_p = true;
+
   tree V16UQI_type_node
     = arm_simd_builtin_type (V16QImode, true, false);
 
@@ -1098,23 +1113,13 @@ arm_init_crypto_builtins_internal (void)
   #undef FT3
 }
 
-static bool neon_set_p = false;
-static bool neon_crypto_set_p = false;
-
 void
 arm_init_neon_builtins (void)
 {
-  if (! neon_set_p)
-    {
-      neon_set_p = true;
-      arm_init_neon_builtins_internal ();
-    }
+  arm_init_neon_builtins_internal ();
 
-  if (! neon_crypto_set_p && TARGET_CRYPTO && TARGET_HARD_FLOAT)
-    {
-      neon_crypto_set_p = true;
-      arm_init_crypto_builtins_internal ();
-    }
+  if (TARGET_CRYPTO && TARGET_HARD_FLOAT)
+    arm_init_crypto_builtins_internal ();
 }
 
 #undef NUM_DREG_TYPES
@@ -1802,11 +1807,22 @@ arm_init_builtins (void)
 /* Return the ARM builtin for CODE.  */
 
 tree
-arm_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
+arm_builtin_decl (unsigned code, bool initialize_p)
 {
   if (code >= ARM_BUILTIN_MAX)
     return error_mark_node;
 
+  if (! arm_builtin_decls[code] && initialize_p)
+    {
+      /* arm_fpu_index is not set to test global features here.  */
+      if (code >= ARM_BUILTIN_CRYPTO_BASE)
+	{
+	  arm_init_neon_builtins_internal ();
+	  if (code < ARM_BUILTIN_NEON_BASE)
+	    arm_init_crypto_builtins_internal ();
+	}
+    }
+
   return arm_builtin_decls[code];
 }
 
Index: testsuite/gcc.target/arm/lto/pr65837_0.c
===================================================================
--- testsuite/gcc.target/arm/lto/pr65837_0.c	(revision 231774)
+++ testsuite/gcc.target/arm/lto/pr65837_0.c	(working copy)
@@ -1,5 +1,7 @@
 /* { dg-lto-do run } */
-/* { dg-lto-options {{-flto -mfpu=neon}} } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-skip-if "need hardfp ABI" { *-*-* } { "-mfloat-abi=soft" } { "" } } */
+/* { dg-lto-options {{-flto -mfpu=neon -mfloat-abi=hard}} } */
 /* { dg-suppress-ld-options {-mfpu=neon} } */
 
 #include "arm_neon.h"
@@ -8,7 +10,8 @@ float32x2_t a, b, c, e;
 
 int main()
 {
-  e = __builtin_neon_vmls_lanev2sf (a, b, c, 0);
+  e = vmls_lane_f32 (a, b, c, 0);
   return 0;
 }
 


  parent reply	other threads:[~2015-12-17 16:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 12:53 [PATCH, ARM] PR68674 Fix LTO support for neon builtins and error catching Christian Bruel
2015-12-08 13:01 ` Ramana Radhakrishnan
2015-12-08 13:29   ` Christian Bruel
2015-12-08 13:36     ` Ramana Radhakrishnan
2015-12-08 13:53       ` Christian Bruel
2015-12-08 15:31         ` Christian Bruel
2015-12-08 20:45         ` Ramana Radhakrishnan
2015-12-09 16:08           ` Christian Bruel
2015-12-17 16:21   ` Christian Bruel [this message]
2015-12-09 17:32 ` Kyrill Tkachov
2015-12-10  9:26   ` Christian Bruel
2015-12-10  9:59     ` Kyrill Tkachov
2015-12-10 10:11       ` Christian Bruel
2015-12-10 10:19         ` Kyrill Tkachov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5672E113.7040801@st.com \
    --to=christian.bruel@st.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=ramana.gcc@googlemail.com \
    --cc=ramana.radhakrishnan@foss.arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).