RE: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in FREEBSDs types.h

2017-05-16 Thread Kirspel, Kevin
After doing some research, the GCC default __builtin_popcount functions are 
slower than the FREEBSD versions (roughly 3.5x slower according to some tests I 
saw online).  If someone adds the -mpopcnt compile option, then it means that 
there is a CPU instruction to perform the task.  I think we should do what 
FREEBSD has done.  Only use the built in functions if there is a CPU 
instruction to execute it.

I have posted a patch to newlib.

Kevin Kirspel
Electrical Engineer - Sr. Staff
Idexx Roswell
235 Hembree Park Drive
Roswell GA 30076
Tel: (770)-510- ext. 81642
Direct: (770)-688-1642
Fax: (770)-510-4445

-Original Message-
From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de] 
Sent: Tuesday, May 16, 2017 9:28 AM
To: Kirspel, Kevin <kevin-kirs...@idexx.com>; devel@rtems.org
Subject: Re: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in 
FREEBSDs types.h

On 16/05/17 15:18, Kirspel, Kevin wrote:
> Sorry.  I pulled that header file from memory which these days is losing its 
> effectiveness.  So, should we put the bitcount changes in sys/types.h like 
> FREEBSD?
>
> If so, I will submit a patch tonew...@sourceware.org.  How long does it take 
> to get the patch reviewed by the newlib mailing list?

Between one day and four weeks. If its not included this week, then we can use 
the alternative.

Please add GCC support for these operations. I think the builtins are available 
since GCC 3.4.0.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in FREEBSDs types.h

2017-05-16 Thread Sebastian Huber

On 16/05/17 15:18, Kirspel, Kevin wrote:

Sorry.  I pulled that header file from memory which these days is losing its 
effectiveness.  So, should we put the bitcount changes in sys/types.h like 
FREEBSD?

If so, I will submit a patch tonew...@sourceware.org.  How long does it take to 
get the patch reviewed by the newlib mailing list?


Between one day and four weeks. If its not included this week, then we 
can use the alternative.


Please add GCC support for these operations. I think the builtins are 
available since GCC 3.4.0.


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RE: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in FREEBSDs types.h

2017-05-16 Thread Kirspel, Kevin
Sorry.  I pulled that header file from memory which these days is losing its 
effectiveness.  So, should we put the bitcount changes in sys/types.h like 
FREEBSD?

If so, I will submit a patch to new...@sourceware.org.  How long does it take 
to get the patch reviewed by the newlib mailing list?

Kevin Kirspel
Electrical Engineer - Sr. Staff
Idexx Roswell
235 Hembree Park Drive
Roswell GA 30076
Tel: (770)-510- ext. 81642
Direct: (770)-688-1642
Fax: (770)-510-4445

-Original Message-
From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de] 
Sent: Tuesday, May 16, 2017 9:06 AM
To: Kirspel, Kevin <kevin-kirs...@idexx.com>; devel@rtems.org
Subject: Re: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in 
FREEBSDs types.h

On 16/05/17 14:56, Kirspel, Kevin wrote:
> Should we put this in cdefs.h like FREEBSD?

In FreeBSD the __bitcount*() functions are defined in .

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in FREEBSDs types.h

2017-05-16 Thread Sebastian Huber

On 16/05/17 14:56, Kirspel, Kevin wrote:

Should we put this in cdefs.h like FREEBSD?


In FreeBSD the __bitcount*() functions are defined in .

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RE: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in FREEBSDs types.h

2017-05-16 Thread Kirspel, Kevin
Should we put this in cdefs.h like FREEBSD?

Kevin Kirspel
Electrical Engineer - Sr. Staff
Idexx Roswell
235 Hembree Park Drive
Roswell GA 30076
Tel: (770)-510- ext. 81642
Direct: (770)-688-1642
Fax: (770)-510-4445

-Original Message-
From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de] 
Sent: Tuesday, May 16, 2017 8:20 AM
To: Kirspel, Kevin <kevin-kirs...@idexx.com>; devel@rtems.org
Subject: Re: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in 
FREEBSDs types.h

On 16/05/17 14:15, Kirspel, Kevin wrote:
> For now, could we just include this in rtems-libbsd until newlib gets updated?

Getting this change into Newlib shouldn't be a problem. You can use something 
like this to update the RSB if you have the Newlib Git commit:

https://urldefense.proofpoint.com/v2/url?u=https-3A__git.rtems.org_rtems-2Dsource-2Dbuilder_commit_-3Fid-3D8e6ba2c62552b8deba35d2a0a5b6a498ed4e8a80=DwIF-g=2do6VJGs3LvEOe4OFFM1bA=HDiJ93ANMEQ32G5JGdpyUxbdebuwKHBbeiHMr3RbR74=8d4E_Tw0Wy2ZmYqiWKir4wT6w3s0zFGzE9XxGLABaZw=PhRVqXR36MDsL4Pm-6txrcPhdE3D-cfPEU8mrgrdsNY=
 

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in FREEBSDs types.h

2017-05-16 Thread Sebastian Huber

On 16/05/17 14:15, Kirspel, Kevin wrote:

For now, could we just include this in rtems-libbsd until newlib gets updated?


Getting this change into Newlib shouldn't be a problem. You can use 
something like this to update the RSB if you have the Newlib Git commit:


https://git.rtems.org/rtems-source-builder/commit/?id=8e6ba2c62552b8deba35d2a0a5b6a498ed4e8a80

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RE: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in FREEBSDs types.h

2017-05-16 Thread Kirspel, Kevin
For now, could we just include this in rtems-libbsd until newlib gets updated?

Kevin Kirspel
Electrical Engineer - Sr. Staff
Idexx Roswell
235 Hembree Park Drive
Roswell GA 30076
Tel: (770)-510- ext. 81642
Direct: (770)-688-1642
Fax: (770)-510-4445

-Original Message-
From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de] 
Sent: Tuesday, May 16, 2017 3:47 AM
To: Kirspel, Kevin <kevin-kirs...@idexx.com>; devel@rtems.org
Subject: Re: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in 
FREEBSDs types.h

Hello Kevin,

I know it is considerable more work, but this should move into Newlib.

The

#ifdef __POPCNT__
#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x))

needs GCC support. This __POPCNT__ is a clang feature. I don't know which 
version of GCC supports these builtins, but it should use also a 
__GNUC_PREREQ__(X, Y).

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 07/11] Add bitcount inlinesfor RTEMS. These are found in FREEBSDs types.h

2017-05-16 Thread Sebastian Huber

Hello Kevin,

I know it is considerable more work, but this should move into Newlib.

The

#ifdef __POPCNT__
#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x))

needs GCC support. This __POPCNT__ is a clang feature. I don't know 
which version of GCC supports these builtins, but it should use also a 
__GNUC_PREREQ__(X, Y).


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel