public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH roland/arm-ifunc-test] ARM: Clean up __libc_ifunc_impl_list
@ 2013-06-17 20:55 Roland McGrath
  2013-06-17 21:36 ` Joseph S. Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Roland McGrath @ 2013-06-17 20:55 UTC (permalink / raw)
  To: libc-ports

This cleans up the test code for memcpy so that it does not refer to hwcap
bits when the actual memcpy code will not.


Thanks,
Roland


ports/ChangeLog.arm
2013-06-17  Roland McGrath  <roland@hack.frob.com>

	* sysdeps/arm/armv7/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list)
	[__ARM_NEON__]: Do not refer to HWCAP_ARM_NEON.
	[!__SOFTFP__]: Do not refer to HWCAP_ARM_VFP.

--- a/ports/sysdeps/arm/armv7/multiarch/ifunc-impl-list.c
+++ b/ports/sysdeps/arm/armv7/multiarch/ifunc-impl-list.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <stdbool.h>
 #include <string.h>
 #include <ldsodefs.h>
 #include <sysdep.h>
@@ -29,21 +30,22 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 			size_t max)
 {
   size_t i = 0;
-  int hwcap;
 
-  hwcap = GLRO(dl_hwcap);
+  bool use_neon = true;
+#ifndef __ARM_NEON__
+  use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_NEON) != 0;
+# define __memcpy_neon	memcpy
+#endif
 
-  IFUNC_IMPL (i, name, memcpy,
-	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_ARM_NEON,
-#ifdef __ARM_NEON__
-                              memcpy
-#else
-			      __memcpy_neon
+  bool use_vfp = true;
+#ifdef __SOFTFP__
+  use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_VFP) != 0;
 #endif
-                              )
+
+  IFUNC_IMPL (i, name, memcpy,
+	      IFUNC_IMPL_ADD (array, i, memcpy, use_neon, __memcpy_neon)
 #ifndef __ARM_NEON__
-	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_ARM_VFP,
-			      __memcpy_vfp)
+	      IFUNC_IMPL_ADD (array, i, memcpy, use_vfp, __memcpy_vfp)
 #endif
 	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_arm));
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH roland/arm-ifunc-test] ARM: Clean up __libc_ifunc_impl_list
  2013-06-17 20:55 [PATCH roland/arm-ifunc-test] ARM: Clean up __libc_ifunc_impl_list Roland McGrath
@ 2013-06-17 21:36 ` Joseph S. Myers
  2013-06-17 22:06   ` Roland McGrath
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph S. Myers @ 2013-06-17 21:36 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-ports

On Mon, 17 Jun 2013, Roland McGrath wrote:

> +#ifndef __ARM_NEON__
> +  use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_NEON) != 0;
> +# define __memcpy_neon	memcpy
> +#endif

I don't understand why this #define is present for the 
runtime-determined-NEON case (to match the existing code, I'd think it 
should rather be for the compile-time-NEON-enabled case).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH roland/arm-ifunc-test] ARM: Clean up __libc_ifunc_impl_list
  2013-06-17 21:36 ` Joseph S. Myers
@ 2013-06-17 22:06   ` Roland McGrath
  2013-06-17 22:59     ` Joseph S. Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Roland McGrath @ 2013-06-17 22:06 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-ports

> I don't understand why this #define is present for the 
> runtime-determined-NEON case (to match the existing code, I'd think it 
> should rather be for the compile-time-NEON-enabled case).

Oops.  Here's a better version.


Thanks,
Roland


ports/ChangeLog.arm
2013-06-17  Roland McGrath  <roland@hack.frob.com>

	* sysdeps/arm/armv7/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list)
	[__ARM_NEON__]: Do not refer to HWCAP_ARM_NEON.
	[!__SOFTFP__]: Do not refer to HWCAP_ARM_VFP.

--- a/ports/sysdeps/arm/armv7/multiarch/ifunc-impl-list.c
+++ b/ports/sysdeps/arm/armv7/multiarch/ifunc-impl-list.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <stdbool.h>
 #include <string.h>
 #include <ldsodefs.h>
 #include <sysdep.h>
@@ -29,21 +30,25 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 			size_t max)
 {
   size_t i = 0;
-  int hwcap;
 
-  hwcap = GLRO(dl_hwcap);
-
-  IFUNC_IMPL (i, name, memcpy,
-	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_ARM_NEON,
+  bool use_neon = true;
 #ifdef __ARM_NEON__
-                              memcpy
+# define __memcpy_neon	memcpy
 #else
-			      __memcpy_neon
+  use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_NEON) != 0;
 #endif
-                              )
+
+#ifndef __ARM_NEON__
+  bool use_vfp = true;
+# ifdef __SOFTFP__
+  use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_VFP) != 0;
+# endif
+#endif
+
+  IFUNC_IMPL (i, name, memcpy,
+	      IFUNC_IMPL_ADD (array, i, memcpy, use_neon, __memcpy_neon)
 #ifndef __ARM_NEON__
-	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_ARM_VFP,
-			      __memcpy_vfp)
+	      IFUNC_IMPL_ADD (array, i, memcpy, use_vfp, __memcpy_vfp)
 #endif
 	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_arm));
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH roland/arm-ifunc-test] ARM: Clean up __libc_ifunc_impl_list
  2013-06-17 22:06   ` Roland McGrath
@ 2013-06-17 22:59     ` Joseph S. Myers
  2013-06-18 17:12       ` Roland McGrath
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph S. Myers @ 2013-06-17 22:59 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-ports

On Mon, 17 Jun 2013, Roland McGrath wrote:

> +#ifndef __ARM_NEON__
> +  bool use_vfp = true;
> +# ifdef __SOFTFP__
> +  use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_VFP) != 0;

That looks like it should be setting use_vfp, not use_neon....

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH roland/arm-ifunc-test] ARM: Clean up __libc_ifunc_impl_list
  2013-06-17 22:59     ` Joseph S. Myers
@ 2013-06-18 17:12       ` Roland McGrath
  2013-06-18 21:41         ` Joseph S. Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Roland McGrath @ 2013-06-18 17:12 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-ports

> On Mon, 17 Jun 2013, Roland McGrath wrote:
> 
> > +#ifndef __ARM_NEON__
> > +  bool use_vfp = true;
> > +# ifdef __SOFTFP__
> > +  use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_VFP) != 0;
> 
> That looks like it should be setting use_vfp, not use_neon....

Sigh.


ports/ChangeLog.arm
2013-06-18  Roland McGrath  <roland@hack.frob.com>

	* sysdeps/arm/armv7/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list)
	[__ARM_NEON__]: Do not refer to HWCAP_ARM_NEON.
	[!__SOFTFP__]: Do not refer to HWCAP_ARM_VFP.

--- a/ports/sysdeps/arm/armv7/multiarch/ifunc-impl-list.c
+++ b/ports/sysdeps/arm/armv7/multiarch/ifunc-impl-list.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <stdbool.h>
 #include <string.h>
 #include <ldsodefs.h>
 #include <sysdep.h>
@@ -29,21 +30,25 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 			size_t max)
 {
   size_t i = 0;
-  int hwcap;
 
-  hwcap = GLRO(dl_hwcap);
-
-  IFUNC_IMPL (i, name, memcpy,
-	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_ARM_NEON,
+  bool use_neon = true;
 #ifdef __ARM_NEON__
-                              memcpy
+# define __memcpy_neon	memcpy
 #else
-			      __memcpy_neon
+  use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_NEON) != 0;
 #endif
-                              )
+
+#ifndef __ARM_NEON__
+  bool use_vfp = true;
+# ifdef __SOFTFP__
+  use_vfp = (GLRO(dl_hwcap) & HWCAP_ARM_VFP) != 0;
+# endif
+#endif
+
+  IFUNC_IMPL (i, name, memcpy,
+	      IFUNC_IMPL_ADD (array, i, memcpy, use_neon, __memcpy_neon)
 #ifndef __ARM_NEON__
-	      IFUNC_IMPL_ADD (array, i, memcpy, hwcap & HWCAP_ARM_VFP,
-			      __memcpy_vfp)
+	      IFUNC_IMPL_ADD (array, i, memcpy, use_vfp, __memcpy_vfp)
 #endif
 	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_arm));
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH roland/arm-ifunc-test] ARM: Clean up __libc_ifunc_impl_list
  2013-06-18 17:12       ` Roland McGrath
@ 2013-06-18 21:41         ` Joseph S. Myers
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph S. Myers @ 2013-06-18 21:41 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-ports

On Tue, 18 Jun 2013, Roland McGrath wrote:

> ports/ChangeLog.arm
> 2013-06-18  Roland McGrath  <roland@hack.frob.com>
> 
> 	* sysdeps/arm/armv7/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list)
> 	[__ARM_NEON__]: Do not refer to HWCAP_ARM_NEON.
> 	[!__SOFTFP__]: Do not refer to HWCAP_ARM_VFP.

This version is OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-18 21:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-17 20:55 [PATCH roland/arm-ifunc-test] ARM: Clean up __libc_ifunc_impl_list Roland McGrath
2013-06-17 21:36 ` Joseph S. Myers
2013-06-17 22:06   ` Roland McGrath
2013-06-17 22:59     ` Joseph S. Myers
2013-06-18 17:12       ` Roland McGrath
2013-06-18 21:41         ` Joseph S. Myers

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