Patchwork [v2,1/2] target-arm: Use TCG operation for Neon 64 bit negation

login
register
mail settings
Submitter Peter Maydell
Date Oct. 19, 2012, 1:06 p.m.
Message ID <1350652019-25946-2-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/192679/
State New
Headers show

Comments

Peter Maydell - Oct. 19, 2012, 1:06 p.m.
Use the TCG operation to do Neon 64 bit negations rather than calling
a helper routine for it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/helper.h      |    1 -
 target-arm/neon_helper.c |    6 ------
 target-arm/translate.c   |    4 +++-
 3 files changed, 3 insertions(+), 8 deletions(-)
Aurelien Jarno - Oct. 19, 2012, 10:05 p.m.
On Fri, Oct 19, 2012 at 02:06:58PM +0100, Peter Maydell wrote:
> Use the TCG operation to do Neon 64 bit negations rather than calling
> a helper routine for it.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target-arm/helper.h      |    1 -
>  target-arm/neon_helper.c |    6 ------
>  target-arm/translate.c   |    4 +++-
>  3 files changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/target-arm/helper.h b/target-arm/helper.h
> index 8b9adf1..fa3472f 100644
> --- a/target-arm/helper.h
> +++ b/target-arm/helper.h
> @@ -339,7 +339,6 @@ DEF_HELPER_2(neon_mull_s16, i64, i32, i32)
>  
>  DEF_HELPER_1(neon_negl_u16, i64, i64)
>  DEF_HELPER_1(neon_negl_u32, i64, i64)
> -DEF_HELPER_1(neon_negl_u64, i64, i64)
>  
>  DEF_HELPER_2(neon_qabs_s8, i32, env, i32)
>  DEF_HELPER_2(neon_qabs_s16, i32, env, i32)
> diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
> index 8bb5129..616cf95 100644
> --- a/target-arm/neon_helper.c
> +++ b/target-arm/neon_helper.c
> @@ -1665,12 +1665,6 @@ uint64_t HELPER(neon_negl_u32)(uint64_t x)
>      return low | ((uint64_t)high << 32);
>  }
>  
> -/* FIXME:  There should be a native op for this.  */
> -uint64_t HELPER(neon_negl_u64)(uint64_t x)
> -{
> -    return -x;
> -}
> -
>  /* Saturating sign manipulation.  */
>  /* ??? Make these use NEON_VOP1 */
>  #define DO_QABS8(x) do { \
> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index daccb15..d33f94c 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -4184,7 +4184,9 @@ static inline void gen_neon_negl(TCGv_i64 var, int size)
>      switch (size) {
>      case 0: gen_helper_neon_negl_u16(var, var); break;
>      case 1: gen_helper_neon_negl_u32(var, var); break;
> -    case 2: gen_helper_neon_negl_u64(var, var); break;
> +    case 2:
> +        tcg_gen_neg_i64(var, var);
> +        break;
>      default: abort();
>      }
>  }

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

Patch

diff --git a/target-arm/helper.h b/target-arm/helper.h
index 8b9adf1..fa3472f 100644
--- a/target-arm/helper.h
+++ b/target-arm/helper.h
@@ -339,7 +339,6 @@  DEF_HELPER_2(neon_mull_s16, i64, i32, i32)
 
 DEF_HELPER_1(neon_negl_u16, i64, i64)
 DEF_HELPER_1(neon_negl_u32, i64, i64)
-DEF_HELPER_1(neon_negl_u64, i64, i64)
 
 DEF_HELPER_2(neon_qabs_s8, i32, env, i32)
 DEF_HELPER_2(neon_qabs_s16, i32, env, i32)
diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index 8bb5129..616cf95 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -1665,12 +1665,6 @@  uint64_t HELPER(neon_negl_u32)(uint64_t x)
     return low | ((uint64_t)high << 32);
 }
 
-/* FIXME:  There should be a native op for this.  */
-uint64_t HELPER(neon_negl_u64)(uint64_t x)
-{
-    return -x;
-}
-
 /* Saturating sign manipulation.  */
 /* ??? Make these use NEON_VOP1 */
 #define DO_QABS8(x) do { \
diff --git a/target-arm/translate.c b/target-arm/translate.c
index daccb15..d33f94c 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -4184,7 +4184,9 @@  static inline void gen_neon_negl(TCGv_i64 var, int size)
     switch (size) {
     case 0: gen_helper_neon_negl_u16(var, var); break;
     case 1: gen_helper_neon_negl_u32(var, var); break;
-    case 2: gen_helper_neon_negl_u64(var, var); break;
+    case 2:
+        tcg_gen_neg_i64(var, var);
+        break;
     default: abort();
     }
 }