summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrbr <chrbr@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-24 08:19:12 +0000
committerchrbr <chrbr@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-24 08:19:12 +0000
commite6ab74757a938d9b4da22f3a7524ab1140eb3f86 (patch)
treeaf57654dff86396668ddefa8bb93c0c306fa78dc
parent4373b6abded9f5793b26afff82293482cdc80739 (diff)
downloadgcc-e6ab74757a938d9b4da22f3a7524ab1140eb3f86.tar.gz
2016-02-24 Christian Bruel <christian.bruel@st.com>
* config/arm/arm-c.c (arm_option_override): Initialize target_option_current_node. * config/arm/arm.c (arm_pragma_target_parse): Replace build_target_option_node call by target_option_current_node. Set target_option_current_node. Fix comments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233654 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/arm/arm-c.c13
-rw-r--r--gcc/config/arm/arm.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/arm/pragma_cpp_fma.c36
5 files changed, 62 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0ba100dedf2..40579696377 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2016-02-24 Christian Bruel <christian.bruel@st.com>
+
+ * config/arm/arm-c.c (arm_option_override): Initialize
+ target_option_current_node.
+ * config/arm/arm.c (arm_pragma_target_parse): Replace
+ build_target_option_node call by target_option_current_node.
+ Set target_option_current_node.
+ Fix comments.
+
2016-02-23 David Edelsohn <dje.gcc@gmail.com>
PR target/69810
diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c
index 982a606ece1..4fbdfc50d03 100644
--- a/gcc/config/arm/arm-c.c
+++ b/gcc/config/arm/arm-c.c
@@ -199,7 +199,7 @@ arm_cpu_cpp_builtins (struct cpp_reader * pfile)
static bool
arm_pragma_target_parse (tree args, tree pop_target)
{
- tree prev_tree = build_target_option_node (&global_options);
+ tree prev_tree = target_option_current_node;
tree cur_tree;
struct cl_target_option *prev_opt;
struct cl_target_option *cur_opt;
@@ -220,11 +220,16 @@ arm_pragma_target_parse (tree args, tree pop_target)
TREE_TARGET_OPTION (prev_tree));
return false;
}
+
+ /* handle_pragma_pop_options and handle_pragma_reset_options will set
+ target_option_current_node, but not handle_pragma_target. */
+ target_option_current_node = cur_tree;
}
- /* Figure out the previous mode. */
- prev_opt = TREE_TARGET_OPTION (prev_tree);
- cur_opt = TREE_TARGET_OPTION (cur_tree);
+ /* Update macros if target_node changes. The global state will be restored
+ by arm_set_current_function. */
+ prev_opt = TREE_TARGET_OPTION (prev_tree);
+ cur_opt = TREE_TARGET_OPTION (cur_tree);
gcc_assert (prev_opt);
gcc_assert (cur_opt);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 765d0021e80..94893439015 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3453,8 +3453,9 @@ arm_option_override (void)
arm_add_gc_roots ();
/* Save the initial options in case the user does function specific
- options. */
- target_option_default_node = build_target_option_node (&global_options);
+ options or #pragma target. */
+ target_option_default_node = target_option_current_node
+ = build_target_option_node (&global_options);
/* Init initial mode for testing. */
thumb_flipper = TARGET_THUMB;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2e524ece716..beb80260007 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-02-24 Christian Bruel <christian.bruel@st.com>
+
+ * gcc.target/arm/pragma_cpp_fma.c: New test.
+
2016-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/61156
@@ -89,6 +93,7 @@
PR c/69900
* gcc.dg/pr69900.c: New test.
+>>>>>>> .r233653
2016-02-23 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/69666
diff --git a/gcc/testsuite/gcc.target/arm/pragma_cpp_fma.c b/gcc/testsuite/gcc.target/arm/pragma_cpp_fma.c
new file mode 100644
index 00000000000..be63256b84c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pragma_cpp_fma.c
@@ -0,0 +1,36 @@
+/* Test that FMA macro is correctly undef. */
+/* { dg-do compile } */
+/* { dg-skip-if "Default no fma" { *-*-* } { "-mfpu=*vfpv4*" "-mfpu=*armv8"} } */
+/* { dg-require-effective-target arm_fp_ok } */
+/* { dg-add-options arm_fp } */
+
+#pragma GCC push_options
+#pragma GCC target ("fpu=crypto-neon-fp-armv8")
+
+#ifndef __ARM_FEATURE_FMA
+#error "__ARM_FEATURE_FMA is not defined but should be"
+#endif
+
+#ifndef __ARM_FEATURE_CRYPTO
+#error "__ARM_FEATURE_CRYPTO is not defined but should be"
+#endif
+
+#if __ARM_NEON_FP != 6
+#error "__ARM_NEON_FP"
+#endif
+
+#if __ARM_FP != 14
+#error "__ARM_FP"
+#endif
+
+#pragma GCC pop_options
+
+#pragma GCC push_options
+#pragma GCC target ("fpu=neon-vfpv4")
+#pragma GCC pop_options
+
+#ifdef __ARM_FEATURE_FMA
+#error "__ARM_FEATURE_FMA is defined but should not be"
+#endif
+
+