* [PATCH 3/4] [ARM] Add attribute/pragma target fpu=
@ 2015-09-14 11:45 Christian Bruel
2015-09-14 17:43 ` Bernhard Reutner-Fischer
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Christian Bruel @ 2015-09-14 11:45 UTC (permalink / raw)
To: kyrylo.tkachov, Ramana.Radhakrishnan; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 253 bytes --]
This patch splits the neon_builtins initialization into 2 internals
functions. One for NEON and one for CRYPTO, each one guarded by its own
predicate. arm_init_neon_builtins is now global to be called from
arm_valid_target_attribute_tree if needed.
[-- Attachment #2: p3.patch --]
[-- Type: text/x-patch, Size: 6801 bytes --]
2015-09-14 Christian Bruel <christian.bruel@st.com>
PR target/65837
* config/arm/arm-protos.h (arm_init_neon_builtins): Declare.
* config/arm/arm.c (arm_valid_target_attribute_tree): Call
arm_init_neon_builtins.
* config/arm/arm-builtins.c (arm_init_neon_builtins): Split into...
(arm_init_neon_builtins_internal)
(arm_init_crypto_builtins_internal):
Test and set neon_set_p, neon_crypto_set_p.
(neon_set_p, neon_crypto_set_p): New static booleans.
diff -ruN gnu_trunk.p2/gcc/gcc/config/arm/arm-builtins.c gnu_trunk.p3/gcc/gcc/config/arm/arm-builtins.c
--- gnu_trunk.p2/gcc/gcc/config/arm/arm-builtins.c 2015-09-10 14:46:30.994448152 +0200
+++ gnu_trunk.p3/gcc/gcc/config/arm/arm-builtins.c 2015-09-11 16:48:51.420065488 +0200
@@ -901,7 +901,7 @@
}
static void
-arm_init_neon_builtins (void)
+arm_init_neon_builtins_internal (void)
{
unsigned int i, fcode = ARM_BUILTIN_NEON_PATTERN_START;
@@ -1022,87 +1022,105 @@
NULL, NULL_TREE);
arm_builtin_decls[fcode] = fndecl;
}
+}
- if (TARGET_CRYPTO && TARGET_HARD_FLOAT)
- {
- tree V16UQI_type_node = arm_simd_builtin_type (V16QImode,
- true,
- false);
-
- tree V4USI_type_node = arm_simd_builtin_type (V4SImode,
- true,
- false);
+void
+arm_init_crypto_builtins_internal (void)
+{
+ tree V16UQI_type_node
+ = arm_simd_builtin_type (V16QImode, true, false);
- tree v16uqi_ftype_v16uqi
- = build_function_type_list (V16UQI_type_node, V16UQI_type_node,
- NULL_TREE);
+ tree V4USI_type_node
+ = arm_simd_builtin_type (V4SImode, true, false);
+
+ tree v16uqi_ftype_v16uqi
+ = build_function_type_list (V16UQI_type_node, V16UQI_type_node,
+ NULL_TREE);
- tree v16uqi_ftype_v16uqi_v16uqi
+ tree v16uqi_ftype_v16uqi_v16uqi
= build_function_type_list (V16UQI_type_node, V16UQI_type_node,
V16UQI_type_node, NULL_TREE);
- tree v4usi_ftype_v4usi
- = build_function_type_list (V4USI_type_node, V4USI_type_node,
- NULL_TREE);
-
- tree v4usi_ftype_v4usi_v4usi
- = build_function_type_list (V4USI_type_node, V4USI_type_node,
- V4USI_type_node, NULL_TREE);
-
- tree v4usi_ftype_v4usi_v4usi_v4usi
- = build_function_type_list (V4USI_type_node, V4USI_type_node,
- V4USI_type_node, V4USI_type_node,
- NULL_TREE);
-
- tree uti_ftype_udi_udi
- = build_function_type_list (unsigned_intTI_type_node,
- unsigned_intDI_type_node,
- unsigned_intDI_type_node,
- NULL_TREE);
-
- #undef CRYPTO1
- #undef CRYPTO2
- #undef CRYPTO3
- #undef C
- #undef N
- #undef CF
- #undef FT1
- #undef FT2
- #undef FT3
-
- #define C(U) \
- ARM_BUILTIN_CRYPTO_##U
- #define N(L) \
- "__builtin_arm_crypto_"#L
- #define FT1(R, A) \
- R##_ftype_##A
- #define FT2(R, A1, A2) \
- R##_ftype_##A1##_##A2
- #define FT3(R, A1, A2, A3) \
- R##_ftype_##A1##_##A2##_##A3
- #define CRYPTO1(L, U, R, A) \
- arm_builtin_decls[C (U)] \
- = add_builtin_function (N (L), FT1 (R, A), \
- C (U), BUILT_IN_MD, NULL, NULL_TREE);
- #define CRYPTO2(L, U, R, A1, A2) \
- arm_builtin_decls[C (U)] \
- = add_builtin_function (N (L), FT2 (R, A1, A2), \
+ tree v4usi_ftype_v4usi
+ = build_function_type_list (V4USI_type_node, V4USI_type_node,
+ NULL_TREE);
+
+ tree v4usi_ftype_v4usi_v4usi
+ = build_function_type_list (V4USI_type_node, V4USI_type_node,
+ V4USI_type_node, NULL_TREE);
+
+ tree v4usi_ftype_v4usi_v4usi_v4usi
+ = build_function_type_list (V4USI_type_node, V4USI_type_node,
+ V4USI_type_node, V4USI_type_node,
+ NULL_TREE);
+
+ tree uti_ftype_udi_udi
+ = build_function_type_list (unsigned_intTI_type_node,
+ unsigned_intDI_type_node,
+ unsigned_intDI_type_node,
+ NULL_TREE);
+
+ #undef CRYPTO1
+ #undef CRYPTO2
+ #undef CRYPTO3
+ #undef C
+ #undef N
+ #undef CF
+ #undef FT1
+ #undef FT2
+ #undef FT3
+
+ #define C(U) \
+ ARM_BUILTIN_CRYPTO_##U
+ #define N(L) \
+ "__builtin_arm_crypto_"#L
+ #define FT1(R, A) \
+ R##_ftype_##A
+ #define FT2(R, A1, A2) \
+ R##_ftype_##A1##_##A2
+ #define FT3(R, A1, A2, A3) \
+ R##_ftype_##A1##_##A2##_##A3
+ #define CRYPTO1(L, U, R, A) \
+ arm_builtin_decls[C (U)] \
+ = add_builtin_function (N (L), FT1 (R, A), \
+ C (U), BUILT_IN_MD, NULL, NULL_TREE);
+ #define CRYPTO2(L, U, R, A1, A2) \
+ arm_builtin_decls[C (U)] \
+ = add_builtin_function (N (L), FT2 (R, A1, A2), \
+ C (U), BUILT_IN_MD, NULL, NULL_TREE);
+
+ #define CRYPTO3(L, U, R, A1, A2, A3) \
+ arm_builtin_decls[C (U)] \
+ = add_builtin_function (N (L), FT3 (R, A1, A2, A3), \
C (U), BUILT_IN_MD, NULL, NULL_TREE);
+ #include "crypto.def"
- #define CRYPTO3(L, U, R, A1, A2, A3) \
- arm_builtin_decls[C (U)] \
- = add_builtin_function (N (L), FT3 (R, A1, A2, A3), \
- C (U), BUILT_IN_MD, NULL, NULL_TREE);
- #include "crypto.def"
+ #undef CRYPTO1
+ #undef CRYPTO2
+ #undef CRYPTO3
+ #undef C
+ #undef N
+ #undef FT1
+ #undef FT2
+ #undef FT3
+}
+
+static bool neon_set_p = false;
+static bool neon_crypto_set_p = false;
+
+void
+arm_init_neon_builtins (void)
+{
+ if (! neon_set_p)
+ {
+ arm_init_neon_builtins_internal ();
+ neon_set_p = true;
+ }
- #undef CRYPTO1
- #undef CRYPTO2
- #undef CRYPTO3
- #undef C
- #undef N
- #undef FT1
- #undef FT2
- #undef FT3
+ if (!neon_crypto_set_p && TARGET_CRYPTO && TARGET_HARD_FLOAT)
+ {
+ arm_init_crypto_builtins_internal ();
+ neon_crypto_set_p = true;
}
}
diff -ruN gnu_trunk.p2/gcc/gcc/config/arm/arm.c gnu_trunk.p3/gcc/gcc/config/arm/arm.c
--- gnu_trunk.p2/gcc/gcc/config/arm/arm.c 2015-09-11 15:28:59.937357745 +0200
+++ gnu_trunk.p3/gcc/gcc/config/arm/arm.c 2015-09-11 16:26:33.869000746 +0200
@@ -29556,6 +29556,9 @@
/* Do any overrides, such as global options arch=xxx. */
arm_option_override_internal (opts, opts_set);
+ if (TARGET_NEON)
+ arm_init_neon_builtins ();
+
return build_target_option_node (opts);
}
diff -ruN gnu_trunk.p2/gcc/gcc/config/arm/arm-protos.h gnu_trunk.p3/gcc/gcc/config/arm/arm-protos.h
--- gnu_trunk.p2/gcc/gcc/config/arm/arm-protos.h 2015-09-11 15:23:51.852687891 +0200
+++ gnu_trunk.p3/gcc/gcc/config/arm/arm-protos.h 2015-09-11 16:30:15.833511559 +0200
@@ -213,7 +213,10 @@
extern bool arm_change_mode_p (tree);
#endif
-extern tree arm_valid_target_attribute_tree (tree, struct gcc_options *,
+extern void arm_init_neon_builtins (void);
+
+extern tree arm_valid_target_attribute_tree (tree,
+ struct gcc_options *,
struct gcc_options *);
extern void arm_pr_long_calls (struct cpp_reader *);
extern void arm_pr_no_long_calls (struct cpp_reader *);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/4] [ARM] Add attribute/pragma target fpu=
2015-09-14 11:45 [PATCH 3/4] [ARM] Add attribute/pragma target fpu= Christian Bruel
@ 2015-09-14 17:43 ` Bernhard Reutner-Fischer
2015-09-18 8:42 ` Kyrill Tkachov
2015-10-05 11:00 ` Kyrill Tkachov
2 siblings, 0 replies; 5+ messages in thread
From: Bernhard Reutner-Fischer @ 2015-09-14 17:43 UTC (permalink / raw)
To: Christian Bruel, kyrylo.tkachov, Ramana.Radhakrishnan; +Cc: gcc-patches
On September 14, 2015 1:39:28 PM GMT+02:00, Christian Bruel <christian.bruel@st.com> wrote:
>This patch splits the neon_builtins initialization into 2 internals
>functions. One for NEON and one for CRYPTO, each one guarded by its own
>
>predicate. arm_init_neon_builtins is now global to be called from
>arm_valid_target_attribute_tree if needed.
arm_init_crypto_builtins_internal should thus be static, shouldn't it?
Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/4] [ARM] Add attribute/pragma target fpu=
2015-09-14 11:45 [PATCH 3/4] [ARM] Add attribute/pragma target fpu= Christian Bruel
2015-09-14 17:43 ` Bernhard Reutner-Fischer
@ 2015-09-18 8:42 ` Kyrill Tkachov
2015-09-18 10:43 ` Christian Bruel
2015-10-05 11:00 ` Kyrill Tkachov
2 siblings, 1 reply; 5+ messages in thread
From: Kyrill Tkachov @ 2015-09-18 8:42 UTC (permalink / raw)
To: Christian Bruel, Ramana Radhakrishnan; +Cc: gcc-patches
Hi Christian,
(going through the patches...)
On 14/09/15 12:39, Christian Bruel wrote:
> This patch splits the neon_builtins initialization into 2 internals
> functions. One for NEON and one for CRYPTO, each one guarded by its own
> predicate. arm_init_neon_builtins is now global to be called from
> arm_valid_target_attribute_tree if needed.
>
diff -ruN gnu_trunk.p2/gcc/gcc/config/arm/arm-protos.h gnu_trunk.p3/gcc/gcc/config/arm/arm-protos.h
--- gnu_trunk.p2/gcc/gcc/config/arm/arm-protos.h 2015-09-11 15:23:51.852687891 +0200
+++ gnu_trunk.p3/gcc/gcc/config/arm/arm-protos.h 2015-09-11 16:30:15.833511559 +0200
@@ -213,7 +213,10 @@
extern bool arm_change_mode_p (tree);
#endif
-extern tree arm_valid_target_attribute_tree (tree, struct gcc_options *,
+extern void arm_init_neon_builtins (void);
+
+extern tree arm_valid_target_attribute_tree (tree,
+ struct gcc_options *,
struct gcc_options *);
Why the arm_valid_target_attribute_tree declaration here?
I don't see its relevance in this patch, and it's not mentioned in the ChangeLog.
Kyrill
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/4] [ARM] Add attribute/pragma target fpu=
2015-09-18 8:42 ` Kyrill Tkachov
@ 2015-09-18 10:43 ` Christian Bruel
0 siblings, 0 replies; 5+ messages in thread
From: Christian Bruel @ 2015-09-18 10:43 UTC (permalink / raw)
To: Kyrill Tkachov, Ramana Radhakrishnan; +Cc: gcc-patches
On 09/18/2015 10:40 AM, Kyrill Tkachov wrote:
> Hi Christian,
> (going through the patches...)
>
> On 14/09/15 12:39, Christian Bruel wrote:
>> This patch splits the neon_builtins initialization into 2 internals
>> functions. One for NEON and one for CRYPTO, each one guarded by its own
>> predicate. arm_init_neon_builtins is now global to be called from
>> arm_valid_target_attribute_tree if needed.
>>
>
> diff -ruN gnu_trunk.p2/gcc/gcc/config/arm/arm-protos.h gnu_trunk.p3/gcc/gcc/config/arm/arm-protos.h
> --- gnu_trunk.p2/gcc/gcc/config/arm/arm-protos.h 2015-09-11 15:23:51.852687891 +0200
> +++ gnu_trunk.p3/gcc/gcc/config/arm/arm-protos.h 2015-09-11 16:30:15.833511559 +0200
> @@ -213,7 +213,10 @@
> extern bool arm_change_mode_p (tree);
> #endif
>
> -extern tree arm_valid_target_attribute_tree (tree, struct gcc_options *,
> +extern void arm_init_neon_builtins (void);
> +
> +extern tree arm_valid_target_attribute_tree (tree,
> + struct gcc_options *,
> struct gcc_options *);
>
> Why the arm_valid_target_attribute_tree declaration here?
> I don't see its relevance in this patch, and it's not mentioned in the ChangeLog.
Irrelevant formating new line chunk, I must have dropped a new line in
the argument list that percolated to the patch.
Please ignore it.
Christian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/4] [ARM] Add attribute/pragma target fpu=
2015-09-14 11:45 [PATCH 3/4] [ARM] Add attribute/pragma target fpu= Christian Bruel
2015-09-14 17:43 ` Bernhard Reutner-Fischer
2015-09-18 8:42 ` Kyrill Tkachov
@ 2015-10-05 11:00 ` Kyrill Tkachov
2 siblings, 0 replies; 5+ messages in thread
From: Kyrill Tkachov @ 2015-10-05 11:00 UTC (permalink / raw)
To: Christian Bruel, Ramana Radhakrishnan; +Cc: gcc-patches
Hi Christian,
On 14/09/15 12:39, Christian Bruel wrote:
> This patch splits the neon_builtins initialization into 2 internals
> functions. One for NEON and one for CRYPTO, each one guarded by its own
> predicate. arm_init_neon_builtins is now global to be called from
> arm_valid_target_attribute_tree if needed.
>
+void
+arm_init_crypto_builtins_internal (void)
+{
+ tree V16UQI_type_node
+ = arm_simd_builtin_type (V16QImode, true, false);
Like Bernhard said, this should be static.
Otherwise this is ok (with the irrelevant arm-protos.h dropped as discussed earlier).
Thanks,
Kyrill
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-05 11:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 11:45 [PATCH 3/4] [ARM] Add attribute/pragma target fpu= Christian Bruel
2015-09-14 17:43 ` Bernhard Reutner-Fischer
2015-09-18 8:42 ` Kyrill Tkachov
2015-09-18 10:43 ` Christian Bruel
2015-10-05 11:00 ` Kyrill Tkachov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).