[AArch64] Faster math barriers

Message ID 000201d07777$02ea0890$08be19b0$@com
State Committed
Headers

Commit Message

Wilco Dijkstra April 15, 2015, 12:23 p.m. UTC
  Add more efficient versions of math_opt_barrier and math_force_eval that avoid going via memory.

OK for commit?

2015-04-15  Wilco Dijkstra  <wdijkstr@arm.com>

	* sysdeps/aarch64/fpu/math_private.h
	(define math_opt_barrier): Add AArch64 version.
	(math_force_eval): Likewise.

---
 sysdeps/aarch64/fpu/math_private.h | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Marcus Shawcroft July 6, 2015, 3:44 p.m. UTC | #1
On 15 April 2015 at 13:23, Wilco Dijkstra <wdijkstr@arm.com> wrote:
> Add more efficient versions of math_opt_barrier and math_force_eval that avoid going via memory.
>
> OK for commit?
>
> 2015-04-15  Wilco Dijkstra  <wdijkstr@arm.com>
>
>         * sysdeps/aarch64/fpu/math_private.h
>         (define math_opt_barrier): Add AArch64 version.
>         (math_force_eval): Likewise.

Looks OK to me. /Marcus
  

Patch

diff --git a/sysdeps/aarch64/fpu/math_private.h b/sysdeps/aarch64/fpu/math_private.h
index b3c2509..1f02ddb 100644
--- a/sysdeps/aarch64/fpu/math_private.h
+++ b/sysdeps/aarch64/fpu/math_private.h
@@ -22,6 +22,11 @@ 
 #include <fenv.h>
 #include <fpu_control.h>
 
+#define math_opt_barrier(x) \
+({ __typeof (x) __x = (x); __asm ("" : "+w" (__x)); __x; })
+#define math_force_eval(x) \
+({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "w" (__x)); })
+
 extern __always_inline double
 __ieee754_sqrt (double d)
 {