Hi,
One oversight in the design for the AArch64 Simd Builtins type
building foo I put in this week is that you cannot have both
signed and unsigned versions of the same builtin.
Although I solved the problem at a user level by appending a "type"
string to the builtin name, I didn't manage to solve it internally
for the aarch64_builtins enum.
This patch fixes that by appending the TYPE parameter to each
of these enum names.
Thus:
AARCH64_SIMD_BUILTIN_my_builtin
Becomes:
AARCH64_SIMD_BUILTIN_BINOP_my_builtin
And if we also wanted an unsigned variant we would see:
AARCH64_SIMD_BUILTIN_BINOP_U_my_builtin
Regression tested on aarch64-none-elf with no regressions.
OK?
Thanks,
James
---
gcc/
2013-11-22 James Greenhalgh <[email protected]>
* config/aarch64/aarch64-builtins.c
(VAR1): Use new naming scheme for aarch64_builtins.
(aarch64_builtin_vectorized_function): Use new
aarch64_builtins names.
diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index fec7b22..cabef23 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -309,7 +309,7 @@ static aarch64_simd_builtin_datum aarch64_simd_builtin_data[] = {
#undef VAR1
#define VAR1(T, N, MAP, A) \
- AARCH64_SIMD_BUILTIN_##N##A,
+ AARCH64_SIMD_BUILTIN_##T##_##N##A,
enum aarch64_builtins
{
@@ -886,11 +886,11 @@ aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
#define AARCH64_CHECK_BUILTIN_MODE(C, N) 1
#define AARCH64_FIND_FRINT_VARIANT(N) \
(AARCH64_CHECK_BUILTIN_MODE (2, D) \
- ? aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_##N##v2df] \
+ ? aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_UNOP_##N##v2df] \
: (AARCH64_CHECK_BUILTIN_MODE (4, S) \
- ? aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_##N##v4sf] \
+ ? aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_UNOP_##N##v4sf] \
: (AARCH64_CHECK_BUILTIN_MODE (2, S) \
- ? aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_##N##v2sf] \
+ ? aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_UNOP_##N##v2sf] \
: NULL_TREE)))
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
{
@@ -926,7 +926,7 @@ aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
case BUILT_IN_CLZ:
{
if (AARCH64_CHECK_BUILTIN_MODE (4, S))
- return aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_clzv4si];
+ return aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_UNOP_clzv4si];
return NULL_TREE;
}
#undef AARCH64_CHECK_BUILTIN_MODE
@@ -936,47 +936,47 @@ aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
case BUILT_IN_LFLOOR:
case BUILT_IN_IFLOORF:
{
- tree new_tree = NULL_TREE;
+ enum aarch64_builtins builtin;
if (AARCH64_CHECK_BUILTIN_MODE (2, D))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lfloorv2dfv2di];
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lfloorv2dfv2di;
else if (AARCH64_CHECK_BUILTIN_MODE (4, S))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lfloorv4sfv4si];
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lfloorv4sfv4si;
else if (AARCH64_CHECK_BUILTIN_MODE (2, S))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lfloorv2sfv2si];
- return new_tree;
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lfloorv2sfv2si;
+ else
+ return NULL_TREE;
+
+ return aarch64_builtin_decls[builtin];
}
case BUILT_IN_LCEIL:
case BUILT_IN_ICEILF:
{
- tree new_tree = NULL_TREE;
+ enum aarch64_builtins builtin;
if (AARCH64_CHECK_BUILTIN_MODE (2, D))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lceilv2dfv2di];
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lceilv2dfv2di;
else if (AARCH64_CHECK_BUILTIN_MODE (4, S))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lceilv4sfv4si];
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lceilv4sfv4si;
else if (AARCH64_CHECK_BUILTIN_MODE (2, S))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lceilv2sfv2si];
- return new_tree;
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lceilv2sfv2si;
+ else
+ return NULL_TREE;
+
+ return aarch64_builtin_decls[builtin];
}
case BUILT_IN_LROUND:
case BUILT_IN_IROUNDF:
{
- tree new_tree = NULL_TREE;
+ enum aarch64_builtins builtin;
if (AARCH64_CHECK_BUILTIN_MODE (2, D))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lroundv2dfv2di];
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lroundv2dfv2di;
else if (AARCH64_CHECK_BUILTIN_MODE (4, S))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lroundv4sfv4si];
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lroundv4sfv4si;
else if (AARCH64_CHECK_BUILTIN_MODE (2, S))
- new_tree =
- aarch64_builtin_decls[AARCH64_SIMD_BUILTIN_lroundv2sfv2si];
- return new_tree;
+ builtin = AARCH64_SIMD_BUILTIN_UNOP_lroundv2sfv2si;
+ else
+ return NULL_TREE;
+
+ return aarch64_builtin_decls[builtin];
}
default:
@@ -989,7 +989,7 @@ aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
#undef VAR1
#define VAR1(T, N, MAP, A) \
- case AARCH64_SIMD_BUILTIN_##N##A:
+ case AARCH64_SIMD_BUILTIN_##T##_##N##A:
tree
aarch64_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *args,