Commit 7cee9637 by Richard Sandiford Committed by Richard Sandiford

[AArch64] Tighten mode checks in aarch64_builtin_vectorized_function

aarch64_builtin_vectorized_function checked vectors based on the
number of elements and the element mode.  This doesn't interact
well with fixed-length 128-bit SVE, where SVE modes can have those
same properties.  (And we can't just use the built-ins for SVE because
the types use a different ABI.  SVE handles this kind of thing using
optabs instead.)

2020-01-10  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/aarch64/aarch64-builtins.c
	(aarch64_builtin_vectorized_function): Check for specific vector modes,
	rather than checking the number of elements and the element mode.

From-SVN: r280114
parent d29c7f60
2020-01-10 Richard Sandiford <richard.sandiford@arm.com> 2020-01-10 Richard Sandiford <richard.sandiford@arm.com>
* config/aarch64/aarch64-builtins.c
(aarch64_builtin_vectorized_function): Check for specific vector modes,
rather than checking the number of elements and the element mode.
2020-01-10 Richard Sandiford <richard.sandiford@arm.com>
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use * tree-vect-loop.c (vect_create_epilog_for_reduction): Use
get_related_vectype_for_scalar_type rather than build_vector_type get_related_vectype_for_scalar_type rather than build_vector_type
to create the index type for a conditional reduction. to create the index type for a conditional reduction.
......
...@@ -1942,17 +1942,13 @@ aarch64_builtin_vectorized_function (unsigned int fn, tree type_out, ...@@ -1942,17 +1942,13 @@ aarch64_builtin_vectorized_function (unsigned int fn, tree type_out,
tree type_in) tree type_in)
{ {
machine_mode in_mode, out_mode; machine_mode in_mode, out_mode;
unsigned HOST_WIDE_INT in_n, out_n;
if (TREE_CODE (type_out) != VECTOR_TYPE if (TREE_CODE (type_out) != VECTOR_TYPE
|| TREE_CODE (type_in) != VECTOR_TYPE) || TREE_CODE (type_in) != VECTOR_TYPE)
return NULL_TREE; return NULL_TREE;
out_mode = TYPE_MODE (TREE_TYPE (type_out)); out_mode = TYPE_MODE (type_out);
in_mode = TYPE_MODE (TREE_TYPE (type_in)); in_mode = TYPE_MODE (type_in);
if (!TYPE_VECTOR_SUBPARTS (type_out).is_constant (&out_n)
|| !TYPE_VECTOR_SUBPARTS (type_in).is_constant (&in_n))
return NULL_TREE;
#undef AARCH64_CHECK_BUILTIN_MODE #undef AARCH64_CHECK_BUILTIN_MODE
#define AARCH64_CHECK_BUILTIN_MODE(C, N) 1 #define AARCH64_CHECK_BUILTIN_MODE(C, N) 1
...@@ -1968,8 +1964,7 @@ aarch64_builtin_vectorized_function (unsigned int fn, tree type_out, ...@@ -1968,8 +1964,7 @@ aarch64_builtin_vectorized_function (unsigned int fn, tree type_out,
{ {
#undef AARCH64_CHECK_BUILTIN_MODE #undef AARCH64_CHECK_BUILTIN_MODE
#define AARCH64_CHECK_BUILTIN_MODE(C, N) \ #define AARCH64_CHECK_BUILTIN_MODE(C, N) \
(out_mode == N##Fmode && out_n == C \ (out_mode == V##C##N##Fmode && in_mode == V##C##N##Fmode)
&& in_mode == N##Fmode && in_n == C)
CASE_CFN_FLOOR: CASE_CFN_FLOOR:
return AARCH64_FIND_FRINT_VARIANT (floor); return AARCH64_FIND_FRINT_VARIANT (floor);
CASE_CFN_CEIL: CASE_CFN_CEIL:
...@@ -1984,8 +1979,7 @@ aarch64_builtin_vectorized_function (unsigned int fn, tree type_out, ...@@ -1984,8 +1979,7 @@ aarch64_builtin_vectorized_function (unsigned int fn, tree type_out,
return AARCH64_FIND_FRINT_VARIANT (sqrt); return AARCH64_FIND_FRINT_VARIANT (sqrt);
#undef AARCH64_CHECK_BUILTIN_MODE #undef AARCH64_CHECK_BUILTIN_MODE
#define AARCH64_CHECK_BUILTIN_MODE(C, N) \ #define AARCH64_CHECK_BUILTIN_MODE(C, N) \
(out_mode == SImode && out_n == C \ (out_mode == V##C##SImode && in_mode == V##C##N##Imode)
&& in_mode == N##Imode && in_n == C)
CASE_CFN_CLZ: CASE_CFN_CLZ:
{ {
if (AARCH64_CHECK_BUILTIN_MODE (4, S)) if (AARCH64_CHECK_BUILTIN_MODE (4, S))
...@@ -2002,8 +1996,7 @@ aarch64_builtin_vectorized_function (unsigned int fn, tree type_out, ...@@ -2002,8 +1996,7 @@ aarch64_builtin_vectorized_function (unsigned int fn, tree type_out,
} }
#undef AARCH64_CHECK_BUILTIN_MODE #undef AARCH64_CHECK_BUILTIN_MODE
#define AARCH64_CHECK_BUILTIN_MODE(C, N) \ #define AARCH64_CHECK_BUILTIN_MODE(C, N) \
(out_mode == N##Imode && out_n == C \ (out_mode == V##C##N##Imode && in_mode == V##C##N##Fmode)
&& in_mode == N##Fmode && in_n == C)
CASE_CFN_IFLOOR: CASE_CFN_IFLOOR:
CASE_CFN_LFLOOR: CASE_CFN_LFLOOR:
CASE_CFN_LLFLOOR: CASE_CFN_LLFLOOR:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment