diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-11-17 18:55:13 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-11-17 18:55:13 +0000 |
commit | 10766209ec09ef42deb8cb877f1893a8a03f2a97 (patch) | |
tree | c88d08c65eaf313e5097eff3218602232238db96 /gcc/config/arm | |
parent | b4e5bc4782bafd5f44b12f43f86ad3bf31182206 (diff) | |
download | gcc-10766209ec09ef42deb8cb877f1893a8a03f2a97.zip gcc-10766209ec09ef42deb8cb877f1893a8a03f2a97.tar.gz gcc-10766209ec09ef42deb8cb877f1893a8a03f2a97.tar.bz2 |
Make builtin_vectorized_function take a combined_fn
This patch replaces the fndecl argument to builtin_vectorized_function
with a combined_fn and gets the vectoriser to call it for internal
functions too. The patch also moves vectorisation of machine-specific
built-ins to a new hook, builtin_md_vectorized_function.
Tested on x86_64-linux-gnu, aarch64-linux-gnu, arm-linux-gnu and
powerpc64-linux-gnu.
gcc/
* target.def (builtin_vectorized_function): Take a combined_fn (in
the form of an unsigned int) rather than a function decl.
(builtin_md_vectorized_function): New.
* targhooks.h (default_builtin_vectorized_function): Replace the
fndecl argument with an unsigned int.
(default_builtin_md_vectorized_function): Declare.
* targhooks.c (default_builtin_vectorized_function): Replace the
fndecl argument with an unsigned int.
(default_builtin_md_vectorized_function): New function.
* doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_MD_VECTORIZED_FUNCTION):
New hook.
* doc/tm.texi: Regenerate.
* tree-vect-stmts.c (vectorizable_function): Update call to
builtin_vectorized_function, also passing internal functions.
Call builtin_md_vectorized_function for target-specific builtins.
* config/aarch64/aarch64-protos.h
(aarch64_builtin_vectorized_function): Replace fndecl argument
with an unsigned int.
* config/aarch64/aarch64-builtins.c: Include case-cfn-macros.h.
(aarch64_builtin_vectorized_function): Update after above changes.
Use CASE_CFN_*.
* config/arm/arm-protos.h (arm_builtin_vectorized_function): Replace
fndecl argument with an unsigned int.
* config/arm/arm-builtins.c: Include case-cfn-macros.h
(arm_builtin_vectorized_function): Update after above changes.
Use CASE_CFN_*.
* config/i386/i386.c: Include case-cfn-macros.h
(ix86_veclib_handler): Take a combined_fn rather than a
built_in_function.
(ix86_veclibabi_svml, ix86_veclibabi_acml): Likewise. Use
mathfn_built_in rather than calling builtin_decl_implicit directly.
(ix86_builtin_vectorized_function) Update after above changes.
Use CASE_CFN_*.
* config/rs6000/rs6000.c: Include case-cfn-macros.h
(rs6000_builtin_vectorized_libmass): Replace fndecl argument
with a combined_fn. Use CASE_CFN_*. Use mathfn_built_in rather
than calling builtin_decl_implicit directly.
(rs6000_builtin_vectorized_function): Update after above changes.
Use CASE_CFN_*. Move BUILT_IN_MD to...
(rs6000_builtin_md_vectorized_function): ...this new function.
(TARGET_VECTORIZE_BUILTIN_MD_VECTORIZED_FUNCTION): Define.
From-SVN: r230491
Diffstat (limited to 'gcc/config/arm')
-rw-r--r-- | gcc/config/arm/arm-builtins.c | 107 | ||||
-rw-r--r-- | gcc/config/arm/arm-protos.h | 2 |
2 files changed, 53 insertions, 56 deletions
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c index 612ff5c..11cd17d 100644 --- a/gcc/config/arm/arm-builtins.c +++ b/gcc/config/arm/arm-builtins.c @@ -35,6 +35,7 @@ #include "explow.h" #include "expr.h" #include "langhooks.h" +#include "case-cfn-macros.h" #define SIMD_MAX_BUILTIN_ARGS 5 @@ -2842,7 +2843,7 @@ arm_expand_builtin (tree exp, } tree -arm_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in) +arm_builtin_vectorized_function (unsigned int fn, tree type_out, tree type_in) { machine_mode in_mode, out_mode; int in_n, out_n; @@ -2879,19 +2880,16 @@ arm_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in) ? arm_builtin_decl(ARM_BUILTIN_NEON_##N##v4sf, false) \ : NULL_TREE)) - if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) + switch (fn) { - enum built_in_function fn = DECL_FUNCTION_CODE (fndecl); - switch (fn) - { - case BUILT_IN_FLOORF: - return ARM_FIND_VRINT_VARIANT (vrintm); - case BUILT_IN_CEILF: - return ARM_FIND_VRINT_VARIANT (vrintp); - case BUILT_IN_TRUNCF: - return ARM_FIND_VRINT_VARIANT (vrintz); - case BUILT_IN_ROUNDF: - return ARM_FIND_VRINT_VARIANT (vrinta); + CASE_CFN_FLOOR: + return ARM_FIND_VRINT_VARIANT (vrintm); + CASE_CFN_CEIL: + return ARM_FIND_VRINT_VARIANT (vrintp); + CASE_CFN_TRUNC: + return ARM_FIND_VRINT_VARIANT (vrintz); + CASE_CFN_ROUND: + return ARM_FIND_VRINT_VARIANT (vrinta); #undef ARM_CHECK_BUILTIN_MODE_1 #define ARM_CHECK_BUILTIN_MODE_1(C) \ (out_mode == SImode && out_n == C \ @@ -2910,52 +2908,51 @@ arm_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in) : (ARM_CHECK_BUILTIN_MODE (4) \ ? arm_builtin_decl(ARM_BUILTIN_NEON_##N##uv4sfv4si, false) \ : NULL_TREE)) - case BUILT_IN_LROUNDF: - return out_unsigned_p - ? ARM_FIND_VCVTU_VARIANT (vcvta) - : ARM_FIND_VCVT_VARIANT (vcvta); - case BUILT_IN_LCEILF: - return out_unsigned_p - ? ARM_FIND_VCVTU_VARIANT (vcvtp) - : ARM_FIND_VCVT_VARIANT (vcvtp); - case BUILT_IN_LFLOORF: - return out_unsigned_p - ? ARM_FIND_VCVTU_VARIANT (vcvtm) - : ARM_FIND_VCVT_VARIANT (vcvtm); + CASE_CFN_LROUND: + return (out_unsigned_p + ? ARM_FIND_VCVTU_VARIANT (vcvta) + : ARM_FIND_VCVT_VARIANT (vcvta)); + CASE_CFN_LCEIL: + return (out_unsigned_p + ? ARM_FIND_VCVTU_VARIANT (vcvtp) + : ARM_FIND_VCVT_VARIANT (vcvtp)); + CASE_CFN_LFLOOR: + return (out_unsigned_p + ? ARM_FIND_VCVTU_VARIANT (vcvtm) + : ARM_FIND_VCVT_VARIANT (vcvtm)); #undef ARM_CHECK_BUILTIN_MODE #define ARM_CHECK_BUILTIN_MODE(C, N) \ (out_mode == N##mode && out_n == C \ && in_mode == N##mode && in_n == C) - case BUILT_IN_BSWAP16: - if (ARM_CHECK_BUILTIN_MODE (4, HI)) - return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv4hi, false); - else if (ARM_CHECK_BUILTIN_MODE (8, HI)) - return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv8hi, false); - else - return NULL_TREE; - case BUILT_IN_BSWAP32: - if (ARM_CHECK_BUILTIN_MODE (2, SI)) - return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv2si, false); - else if (ARM_CHECK_BUILTIN_MODE (4, SI)) - return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv4si, false); - else - return NULL_TREE; - case BUILT_IN_BSWAP64: - if (ARM_CHECK_BUILTIN_MODE (2, DI)) - return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv2di, false); - else - return NULL_TREE; - case BUILT_IN_COPYSIGNF: - if (ARM_CHECK_BUILTIN_MODE (2, SF)) - return arm_builtin_decl (ARM_BUILTIN_NEON_copysignfv2sf, false); - else if (ARM_CHECK_BUILTIN_MODE (4, SF)) - return arm_builtin_decl (ARM_BUILTIN_NEON_copysignfv4sf, false); - else - return NULL_TREE; - - default: - return NULL_TREE; - } + case CFN_BUILT_IN_BSWAP16: + if (ARM_CHECK_BUILTIN_MODE (4, HI)) + return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv4hi, false); + else if (ARM_CHECK_BUILTIN_MODE (8, HI)) + return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv8hi, false); + else + return NULL_TREE; + case CFN_BUILT_IN_BSWAP32: + if (ARM_CHECK_BUILTIN_MODE (2, SI)) + return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv2si, false); + else if (ARM_CHECK_BUILTIN_MODE (4, SI)) + return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv4si, false); + else + return NULL_TREE; + case CFN_BUILT_IN_BSWAP64: + if (ARM_CHECK_BUILTIN_MODE (2, DI)) + return arm_builtin_decl (ARM_BUILTIN_NEON_bswapv2di, false); + else + return NULL_TREE; + CASE_CFN_COPYSIGN: + if (ARM_CHECK_BUILTIN_MODE (2, SF)) + return arm_builtin_decl (ARM_BUILTIN_NEON_copysignfv2sf, false); + else if (ARM_CHECK_BUILTIN_MODE (4, SF)) + return arm_builtin_decl (ARM_BUILTIN_NEON_copysignfv4sf, false); + else + return NULL_TREE; + + default: + return NULL_TREE; } return NULL_TREE; } diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 8e73753..e4b8fb3 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -84,7 +84,7 @@ extern char *neon_output_shift_immediate (const char *, char, rtx *, extern void neon_pairwise_reduce (rtx, rtx, machine_mode, rtx (*) (rtx, rtx, rtx)); extern rtx neon_make_constant (rtx); -extern tree arm_builtin_vectorized_function (tree, tree, tree); +extern tree arm_builtin_vectorized_function (unsigned int, tree, tree); extern void neon_expand_vector_init (rtx, rtx); extern void neon_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT, const_tree); extern void neon_const_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT); |