This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] aarch64: Implement math acceleration via builtins


Patch updated with upstream comments. ChangeLog updated as well.

Tested on aarch64-linux-gnu with gcc-5.4 and gcc-6. Okay for trunk?

2017-10-20  Michael Collison  <michael.collison@arm.com>

	* sysdeps/aarch64/fpu/e_sqrt.c (ieee754_sqrt): Replace
	asm statements with __builtin_sqrt.
	* sysdeps/aarch64/fpu/e_sqrtf.c (ieee754_sqrtf): Replace
	asm statements with __builtin_sqrtf.
	* sysdeps/aarch64/fpu/s_ceil.c (__ceil): Replace
	asm statements with __builtin_ceil.
	* sysdeps/aarch64/fpu/s_ceilf.c (__ceilf): Replace
	asm statements with __builtin_ceilf.
	* sysdeps/aarch64/fpu/s_floor.c (__floor): Replace
	asm statements with __builtin_floor.
	* sysdeps/aarch64/fpu/s_floorf.c (__floorf): Replace
	asm statements with __builtin_floorf.
	* sysdeps/aarch64/fpu/s_fma.c (__fma): Replace
	asm statements with __builtin_fma.
	* sysdeps/aarch64/fpu/s_fmaf.c (__fmaf): Replace
	asm statements with __builtin_fmaf.
	* sysdeps/aarch64/fpu/s_fmax.c (__fmax): Replace
	asm statements with __builtin_fmax.
	* sysdeps/aarch64/fpu/s_fmaxf.c (__fmaxf): Replace
	asm statements with __builtin_fmaxf.
	* sysdeps/aarch64/fpu/s_fmin.c (__fmin): Replace
	asm statements with __builtin_fmin.
	* sysdeps/aarch64/fpu/s_fminf.c (__fminf): Replace
	asm statements with __builtin_fminf.
	* sysdeps/aarch64/fpu/s_frint.c: Delete file.
	* sysdeps/aarch64/fpu/s_frintf.c: Delete file.
	* sysdeps/aarch64/fpu/s_llrint.c (__llrint): Replace
	asm statements with builtin_rint and conversion to int.
	* sysdeps/aarch64/fpu/s_llrintf.c (__llrintf): Ditto.
	* sysdeps/aarch64/fpu/s_llround.c (__llround): Replace
	asm statements with builtin_llround.
	* sysdeps/aarch64/fpu/s_llroundf.c (__llroundf): Ditto.
	* sysdeps/aarch64/fpu/s_lrint.c (__lrint): Replace
	asm statements with builtin_rint and conversion to long
	int.
	* sysdeps/aarch64/fpu/s_lrintf.c (__lrintf): Ditto.
	* sysdeps/aarch64/fpu/s_lround.c (__lround): Replace
	asm statements with builtin_lround.
	* sysdeps/aarch64/fpu/s_lroundf.c (__lroundf): Replace
	asm statements with builtin_lroundf.
	* sysdeps/aarch64/fpu/s_nearbyint.c (__nearbyint): Replace
	asm statements with __builtin_nearbyint.
	* sysdeps/aarch64/fpu/s_nearbyintf.c (__nearbyintf): Replace
	asm statements with __builtin_nearbyintf.
	* sysdeps/aarch64/fpu/s_rint.c (__rint): Replace
	asm statements with __builtin_rint.
	* sysdeps/aarch64/fpu/s_rintf.c (__rintf): Replace
	asm statements with __builtin_rintf.
	* sysdeps/aarch64/fpu/s_round.c (__round): Replace
	asm statements with __builtin_round.
	* sysdeps/aarch64/fpu/s_roundf.c (__roundf): Replace
	asm statements with __builtin_roundf.
	* sysdeps/aarch64/fpu/s_trunc.c (__trunc): Replace
	asm statements with __builtin_trunc.
	* sysdeps/aarch64/fpu/s_truncf.c (__truncf): Replace
	asm statements with __builtin_truncf.
	* sysdeps/aarch64/fpu/Makefile: Build e_sqrt[f].c with
	-fno-math-errno.

-----Original Message-----
From: Szabolcs Nagy 
Sent: Friday, October 20, 2017 2:36 AM
To: Michael Collison <Michael.Collison@arm.com>; Adhemerval Zanella <adhemerval.zanella@linaro.org>; libc-alpha@sourceware.org
Cc: nd <nd@arm.com>
Subject: Re: [PATCH] aarch64: Implement math acceleration via builtins

On 19/10/17 20:16, Michael Collison wrote:
> Patch updated to reflect recommended changes.
> 
> Okay for trunk?
> 
> 2017-10-19  Michael Collison  <michael.collison@arm.com>
> 
> 	* sysdeps/aarch64/fpu/e_sqrt.c (ieee754_sqrt): Replace
> 	asm statements with __builtin_sqrt.
> 	* sysdeps/aarch64/fpu/e_sqrtf.c (ieee754_sqrtf): Replace
> 	asm statements with __builtin_sqrtf.
> 	* sysdeps/aarch64/fpu/s_ceil.c (__ceil): Replace
> 	asm statements with __builtin_ceil.
> 	* sysdeps/aarch64/fpu/s_ceilf.c (__ceilf): Replace
> 	asm statements with __builtin_ceilf.
> 	* sysdeps/aarch64/fpu/s_floor.c (__floor): Replace
> 	asm statements with __builtin_floor.
> 	* sysdeps/aarch64/fpu/s_floorf.c (__floorf): Replace
> 	asm statements with __builtin_floorf.
> 	* sysdeps/aarch64/fpu/s_fma.c (__fma): Replace
> 	asm statements with __builtin_fma.
> 	* sysdeps/aarch64/fpu/s_fmaf.c (__fmaf): Replace
> 	asm statements with __builtin_fmaf.
> 	* sysdeps/aarch64/fpu/s_fmax.c (__fmax): Replace
> 	asm statements with __builtin_fmax.
> 	* sysdeps/aarch64/fpu/s_fmaxf.c (__fmaxf): Replace
> 	asm statements with __builtin_fmaxf.
> 	* sysdeps/aarch64/fpu/s_fmin.c (__fmin): Replace
> 	asm statements with __builtin_fmin.
> 	* sysdeps/aarch64/fpu/s_fminf.c (__fminf): Replace
> 	asm statements with __builtin_fminf.
> 	* sysdeps/aarch64/fpu/s_frint.c: Delete file.
> 	* sysdeps/aarch64/fpu/s_frintf.c: Delete file.
> 	* sysdeps/aarch64/fpu/s_llrint.c (__llrint): Replace
> 	asm statements with builtin and neon intrinsic.

neon intrinsic is not used, it's builtin and conversion to int.
(same for the rest of the changelog)

> 	* sysdeps/aarch64/fpu/s_llrintf.c (__llrintf): Ditto.

s/Ditto/Likewise/
(same for the rest of the changelog)

> 	* sysdeps/aarch64/fpu/s_llround.c (__llround): Replace
> 	asm statements with neon intrinsic.
> 	* sysdeps/aarch64/fpu/s_llroundf.c (__llroundf): Ditto.
> 	* sysdeps/aarch64/fpu/s_lrint.c (__lrint): Replace
> 	asm statements with builtin and neon intrinsic.
> 	* sysdeps/aarch64/fpu/s_lrintf.c (__lrintf): Ditto.
> 	* sysdeps/aarch64/fpu/s_lround.c (__lround): Replace
> 	asm statements with neon intrinsic vcvtad_s64_f64.
> 	* sysdeps/aarch64/fpu/s_lroundf.c (__lroundf): Replace
> 	asm statements with neon intrinsic vcvtas_s32_f32.
> 	* sysdeps/aarch64/fpu/s_nearbyint.c (__nearbyint): Replace
> 	asm statements with __builtin_nearbyint.
> 	* sysdeps/aarch64/fpu/s_nearbyintf.c (__nearbyintf): Replace
> 	asm statements with __builtin_nearbyintf.
> 	* sysdeps/aarch64/fpu/s_rint.c (__rint): Replace
> 	asm statements with __builtin_rint.
> 	* sysdeps/aarch64/fpu/s_rintf.c (__rintf): Replace
> 	asm statements with __builtin_rintf.
> 	* sysdeps/aarch64/fpu/s_round.c (__round): Replace
> 	asm statements with __builtin_round.
> 	* sysdeps/aarch64/fpu/s_roundf.c (__roundf): Replace
> 	asm statements with __builtin_roundf.
> 	* sysdeps/aarch64/fpu/s_trunc.c (__trunc): Replace
> 	asm statements with __builtin_trunc.
> 	* sysdeps/aarch64/fpu/s_truncf.c (__truncf): Replace
> 	asm statements with __builtin_truncf.
> 	* sysdeps/aarch64/fpu/Makefile: Build e_sqrt[f].c with
> 	-fno-math-errno.
> 

OK to commit with the ChangeLog fixes and comment fixes listed below. Please remove neon intrinsics from the commit message (text of your original mail) before commit (and let me know if you don't have commit rights so i'll do it for you).

> +long long int
> +__llrintf (float x)
> +{
> +  float r = __builtin_rintf (x);
> +
> +  /* Prevent gcc from calling rintf directly when compiled with
> +     -fno-math-errno by inserting a barrier.  */

use llrintf in the comment.

> +long int
> +__lrintf (float x)
> +{
> +  float r = __builtin_rintf (x);
> +
> +  /* Prevent gcc from calling rintf directly when compiled with
> +     -fno-math-errno by inserting a barrier.  */

use lrintf in the comment.

Attachment: gnutools-1925-rebase-v14.patch
Description: gnutools-1925-rebase-v14.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]