Commit dfa3f8d0 by Kyrylo Tkachov Committed by Kyrylo Tkachov

arm-protos.h (arm_builtin_vectorized_function): New function prototype.

2013-04-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/arm/arm-protos.h (arm_builtin_vectorized_function):
	New function prototype.
	* config/arm/arm.c (TARGET_VECTORIZE_BUILTINS): Define.
	(TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION): Likewise.
	(arm_builtin_vectorized_function): New function.

From-SVN: r197490
parent f7837758
2013-04-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2013-04-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/arm-protos.h (arm_builtin_vectorized_function):
New function prototype.
* config/arm/arm.c (TARGET_VECTORIZE_BUILTINS): Define.
(TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION): Likewise.
(arm_builtin_vectorized_function): New function.
2013-04-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/arm_neon_builtins.def: New file. * config/arm/arm_neon_builtins.def: New file.
* config/arm/arm.c (neon_builtin_data): Move contents to * config/arm/arm.c (neon_builtin_data): Move contents to
arm_neon_builtins.def. arm_neon_builtins.def.
......
...@@ -78,6 +78,7 @@ extern char *neon_output_shift_immediate (const char *, char, rtx *, ...@@ -78,6 +78,7 @@ extern char *neon_output_shift_immediate (const char *, char, rtx *,
extern void neon_pairwise_reduce (rtx, rtx, enum machine_mode, extern void neon_pairwise_reduce (rtx, rtx, enum machine_mode,
rtx (*) (rtx, rtx, rtx)); rtx (*) (rtx, rtx, rtx));
extern rtx neon_make_constant (rtx); extern rtx neon_make_constant (rtx);
extern tree arm_builtin_vectorized_function (tree, tree, tree);
extern void neon_expand_vector_init (rtx, rtx); extern void neon_expand_vector_init (rtx, rtx);
extern void neon_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT); extern void neon_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
extern void neon_const_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT); extern void neon_const_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
......
...@@ -620,6 +620,13 @@ static const struct attribute_spec arm_attribute_table[] = ...@@ -620,6 +620,13 @@ static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_CLASS_LIKELY_SPILLED_P #undef TARGET_CLASS_LIKELY_SPILLED_P
#define TARGET_CLASS_LIKELY_SPILLED_P arm_class_likely_spilled_p #define TARGET_CLASS_LIKELY_SPILLED_P arm_class_likely_spilled_p
#undef TARGET_VECTORIZE_BUILTINS
#define TARGET_VECTORIZE_BUILTINS
#undef TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION
#define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION \
arm_builtin_vectorized_function
#undef TARGET_VECTOR_ALIGNMENT #undef TARGET_VECTOR_ALIGNMENT
#define TARGET_VECTOR_ALIGNMENT arm_vector_alignment #define TARGET_VECTOR_ALIGNMENT arm_vector_alignment
...@@ -25853,6 +25860,60 @@ arm_have_conditional_execution (void) ...@@ -25853,6 +25860,60 @@ arm_have_conditional_execution (void)
return !TARGET_THUMB1; return !TARGET_THUMB1;
} }
tree
arm_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
{
enum machine_mode in_mode, out_mode;
int in_n, out_n;
if (TREE_CODE (type_out) != VECTOR_TYPE
|| TREE_CODE (type_in) != VECTOR_TYPE
|| !(TARGET_NEON && TARGET_FPU_ARMV8 && flag_unsafe_math_optimizations))
return NULL_TREE;
out_mode = TYPE_MODE (TREE_TYPE (type_out));
out_n = TYPE_VECTOR_SUBPARTS (type_out);
in_mode = TYPE_MODE (TREE_TYPE (type_in));
in_n = TYPE_VECTOR_SUBPARTS (type_in);
/* ARM_CHECK_BUILTIN_MODE and ARM_FIND_VRINT_VARIANT are used to find the
decl of the vectorized builtin for the appropriate vector mode.
NULL_TREE is returned if no such builtin is available. */
#undef ARM_CHECK_BUILTIN_MODE
#define ARM_CHECK_BUILTIN_MODE(C) \
(out_mode == SFmode && out_n == C \
&& in_mode == SFmode && in_n == C)
#undef ARM_FIND_VRINT_VARIANT
#define ARM_FIND_VRINT_VARIANT(N) \
(ARM_CHECK_BUILTIN_MODE (2) \
? arm_builtin_decl(ARM_BUILTIN_NEON_##N##v2sf, false) \
: (ARM_CHECK_BUILTIN_MODE (4) \
? arm_builtin_decl(ARM_BUILTIN_NEON_##N##v4sf, false) \
: NULL_TREE))
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
{
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);
default:
return NULL_TREE;
}
}
return NULL_TREE;
}
#undef ARM_CHECK_BUILTIN_MODE
#undef ARM_FIND_VRINT_VARIANT
/* The AAPCS sets the maximum alignment of a vector to 64 bits. */ /* The AAPCS sets the maximum alignment of a vector to 64 bits. */
static HOST_WIDE_INT static HOST_WIDE_INT
arm_vector_alignment (const_tree type) arm_vector_alignment (const_tree type)
......
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