Patchwork [AArch64] Vectorize over more math.h functions.

login
register
mail settings
Submitter James Greenhalgh
Date April 26, 2013, 1:28 p.m.
Message ID <1366982888-29096-1-git-send-email-james.greenhalgh@arm.com>
Download mbox | patch
Permalink /patch/239874/
State New
Headers show

Comments

James Greenhalgh - April 26, 2013, 1:28 p.m.
Hi,

This patch adds float -> int builtins to the set
of builtins we can try to vectorize in aarch64_builtin_vectorized_function.

In particular, we add BUILT_IN_IFLOORF, BUILT_IN_ICEILF, BUILT_IN_LROUND,
BUILT_IN_IROUNDF.

The BUILT_IN_LROUND cases won't be triggered unless -ffast-math
or something else which turns off inexact errors is enabled.

Regression tested for aarch64-none-elf with no regressions.

Thanks,
James

---
gcc/

2013-04-26  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/aarch64/aarch64-builtins.c
	(aarch64_builtin_vectorized_function): Vectorize over ifloorf,
	iceilf, lround, iroundf.
Marcus Shawcroft - April 29, 2013, 9:55 a.m.
On 26 April 2013 14:28, James Greenhalgh <james.greenhalgh@arm.com> wrote:
>
> Hi,
>
> This patch adds float -> int builtins to the set
> of builtins we can try to vectorize in aarch64_builtin_vectorized_function.
>
> In particular, we add BUILT_IN_IFLOORF, BUILT_IN_ICEILF, BUILT_IN_LROUND,
> BUILT_IN_IROUNDF.
>
> The BUILT_IN_LROUND cases won't be triggered unless -ffast-math
> or something else which turns off inexact errors is enabled.
>
> Regression tested for aarch64-none-elf with no regressions.
>
> Thanks,
> James
>
> ---
> gcc/
>
> 2013-04-26  James Greenhalgh  <james.greenhalgh@arm.com>
>
>         * config/aarch64/aarch64-builtins.c
>         (aarch64_builtin_vectorized_function): Vectorize over ifloorf,
>         iceilf, lround, iroundf.


OK
/Marcus

Patch

diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index d2e5136..53d2c6a 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -1245,6 +1245,7 @@  aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
   (out_mode == N##Imode && out_n == C \
    && in_mode == N##Fmode && in_n == C)
 	case BUILT_IN_LFLOOR:
+	case BUILT_IN_IFLOORF:
 	  {
 	    tree new_tree = NULL_TREE;
 	    if (AARCH64_CHECK_BUILTIN_MODE (2, D))
@@ -1259,6 +1260,7 @@  aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
 	    return new_tree;
 	  }
 	case BUILT_IN_LCEIL:
+	case BUILT_IN_ICEILF:
 	  {
 	    tree new_tree = NULL_TREE;
 	    if (AARCH64_CHECK_BUILTIN_MODE (2, D))
@@ -1272,6 +1274,22 @@  aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
 		aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lceilv2sfv2si];
 	    return new_tree;
 	  }
+	case BUILT_IN_LROUND:
+	case BUILT_IN_IROUNDF:
+	  {
+	    tree new_tree = NULL_TREE;
+	    if (AARCH64_CHECK_BUILTIN_MODE (2, D))
+	      new_tree =
+		aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lroundv2dfv2di];
+	    else if (AARCH64_CHECK_BUILTIN_MODE (4, S))
+	      new_tree =
+		aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lroundv4sfv4si];
+	    else if (AARCH64_CHECK_BUILTIN_MODE (2, S))
+	      new_tree =
+		aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lroundv2sfv2si];
+	    return new_tree;
+	  }
+
 	default:
 	  return NULL_TREE;
       }