Patchwork [AArch64] Add vabs_s64 intrinsic

login
register
mail settings
Submitter Ian Bolton
Date July 12, 2013, 6:49 p.m.
Message ID <000001ce7f30$987ba1c0$c972e540$@bolton@arm.com>
Download mbox | patch
Permalink /patch/258781/
State New
Headers show

Comments

Ian Bolton - July 12, 2013, 6:49 p.m.
This patch implements the following intrinsic:

  int64x1_t vabs_s64 (int64x1 a)

It uses __builtin_llabs(), which will lead to "abs Dn, Dm" being generated
for
this now that my other patch has been committed.

Test case added to scalar_intrinsics.c.


OK for trunk?

Cheers,
Ian



2013-07-12  Ian Bolton  <ian.bolton@arm.com>

gcc/
	* config/aarch64/arm_neon.h (vabs_s64): New function.

testsuite/
	* gcc.target/aarch64/scalar_intrinsics.c (test_vabs_s64): Added new
test.

Patch

Index: gcc/config/aarch64/arm_neon.h
===================================================================
--- gcc/config/aarch64/arm_neon.h	(revision 200594)
+++ gcc/config/aarch64/arm_neon.h	(working copy)
@@ -17886,6 +17886,12 @@  vabsq_f64 (float64x2_t __a)
   return __builtin_aarch64_absv2df (__a);
 }
 
+__extension__ static __inline int64x1_t __attribute__ ((__always_inline__))
+vabs_s64 (int64x1_t a)
+{
+  return __builtin_llabs (a);
+}
+
 /* vadd */
 
 __extension__ static __inline int64x1_t __attribute__ ((__always_inline__))
Index: gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c
===================================================================
--- gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c	(revision 200594)
+++ gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c	(working copy)
@@ -32,6 +32,18 @@  test_vaddd_s64_2 (int64x1_t a, int64x1_t
 		     vqaddd_s64 (a, d));
 }
 
+/* { dg-final { scan-assembler-times "\\tabs\\td\[0-9\]+, d\[0-9\]+" 1 } } */
+
+int64x1_t
+test_vabs_s64 (int64x1_t a)
+{
+  uint64x1_t res;
+  force_simd (a);
+  res = vabs_s64 (a);
+  force_simd (res);
+  return res;
+}
+
 /* { dg-final { scan-assembler-times "\\tcmeq\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" 1 } } */
 
 uint64x1_t