public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tamar Christina <tamar.christina@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: nd@arm.com, Ramana.Radhakrishnan@arm.com,
	Richard.Earnshaw@arm.com,	nickc@redhat.com,
	Kyrylo.Tkachov@arm.com
Subject: [PATCH][GCC][ARM] Silence more re-definition warnings, make test case failure case more explicit.
Date: Wed, 07 Feb 2018 18:36:00 -0000	[thread overview]
Message-ID: <20180207183550.GA6132@arm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

Hi All,

The previous testcase would fail on a system where the initial mode is thumb and later
switches to an arm mode. This would again cause some warnings to be emitted.

This patch visits all builtins defined with builtin_define_with_int_value and undefines
them if they could possibly change by changing the architecture.

The testcase has also been updated to make it fail more easily on such cases.

Bootstrapped and regtested on arm-none-Linux-gnueabihf and no issues.

Ok for trunk?

Thanks,
Tamar


gcc/
2018-02-07  Tamar Christina  <tamar.christina@arm.com>

	PR target/82641
	* config/arm/arm-c.c (arm_cpu_builtins): Un-define __ARM_FEATURE_LDREX,
	__ARM_ARCH_PROFILE, __ARM_ARCH_ISA_THUMB, __ARM_FP and __ARM_NEON_FP.

gcc/testsuite
2018-02-07  Tamar Christina  <tamar.christina@arm.com>

	PR target/82641
	* gcc.target/arm/pragma_arch_switch_2.c: Use armv6 and armv5t.

-- 

[-- Attachment #2: rb8905.patch --]
[-- Type: text/x-diff, Size: 3285 bytes --]

diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c
index 9a16172f1d8af1a2fb3f24b758650e16ff6e810a..7c741e9fe66a0e086556272a46c4cd709996ce36 100644
--- a/gcc/config/arm/arm-c.c
+++ b/gcc/config/arm/arm-c.c
@@ -87,11 +87,10 @@ arm_cpu_builtins (struct cpp_reader* pfile)
 	builtin_define ("__ARM_FEATURE_CMSE");
     }
 
+  cpp_undef (pfile, "__ARM_FEATURE_LDREX");
   if (TARGET_ARM_FEATURE_LDREX)
     builtin_define_with_int_value ("__ARM_FEATURE_LDREX",
 				   TARGET_ARM_FEATURE_LDREX);
-  else
-    cpp_undef (pfile, "__ARM_FEATURE_LDREX");
 
   def_or_undef_macro (pfile, "__ARM_FEATURE_CLZ",
 		      ((TARGET_ARM_ARCH >= 5 && !TARGET_THUMB)
@@ -105,6 +104,8 @@ arm_cpu_builtins (struct cpp_reader* pfile)
   builtin_define_with_int_value ("__ARM_SIZEOF_MINIMAL_ENUM",
 				 flag_short_enums ? 1 : 4);
   builtin_define_type_sizeof ("__ARM_SIZEOF_WCHAR_T", wchar_type_node);
+
+  cpp_undef (pfile, "__ARM_ARCH_PROFILE");
   if (TARGET_ARM_ARCH_PROFILE)
     builtin_define_with_int_value ("__ARM_ARCH_PROFILE",
 				   TARGET_ARM_ARCH_PROFILE);
@@ -128,6 +129,7 @@ arm_cpu_builtins (struct cpp_reader* pfile)
   else
     def_or_undef_macro (pfile, "__THUMBEL__", TARGET_THUMB);
 
+  cpp_undef (pfile, "__ARM_ARCH_ISA_THUMB");
   if (TARGET_ARM_ARCH_ISA_THUMB)
     builtin_define_with_int_value ("__ARM_ARCH_ISA_THUMB",
 				   TARGET_ARM_ARCH_ISA_THUMB);
@@ -147,10 +149,9 @@ arm_cpu_builtins (struct cpp_reader* pfile)
 
   builtin_define ("__VFP_FP__");
 
+  cpp_undef (pfile, "__ARM_FP");
   if (TARGET_ARM_FP)
     builtin_define_with_int_value ("__ARM_FP", TARGET_ARM_FP);
-  else
-    cpp_undef (pfile, "__ARM_FP");
 
   def_or_undef_macro (pfile, "__ARM_FP16_FORMAT_IEEE",
 		      arm_fp16_format == ARM_FP16_FORMAT_IEEE);
@@ -169,10 +170,9 @@ arm_cpu_builtins (struct cpp_reader* pfile)
   def_or_undef_macro (pfile, "__ARM_NEON__", TARGET_NEON);
   def_or_undef_macro (pfile, "__ARM_NEON", TARGET_NEON);
 
+  cpp_undef (pfile, "__ARM_NEON_FP");
   if (TARGET_NEON_FP)
     builtin_define_with_int_value ("__ARM_NEON_FP", TARGET_NEON_FP);
-  else
-    cpp_undef (pfile, "__ARM_NEON_FP");
 
   /* Add a define for interworking. Needed when building libgcc.a.  */
   if (arm_cpp_interwork)
diff --git a/gcc/testsuite/gcc.target/arm/pragma_arch_switch_2.c b/gcc/testsuite/gcc.target/arm/pragma_arch_switch_2.c
index fe52191c32c037fe4096c1884e1f6397318bd6a3..7f297557d555fd139a3b804d354117239a78ae62 100644
--- a/gcc/testsuite/gcc.target/arm/pragma_arch_switch_2.c
+++ b/gcc/testsuite/gcc.target/arm/pragma_arch_switch_2.c
@@ -2,16 +2,16 @@
 /* { dg-skip-if "instruction not valid on thumb" { *-*-* } { "-mthumb" } { "" } } */
 /* { dg-do assemble } */
 /* { dg-require-effective-target arm_arm_ok } */
-/* { dg-additional-options "-Wall -O2 -march=armv4t -std=gnu99 -marm" } */
+/* { dg-additional-options "-Wall -O2 -march=armv5t -std=gnu99 -marm" } */
 
-#pragma GCC target ("arch=armv5te")
-void cpu_has_iwmmxt (void)
+#pragma GCC target ("arch=armv6")
+int test_assembly (int hi, int lo)
 {
-   int lo;
-   int hi;
+   int res;
    __asm__ __volatile__ (
-      "mcrr   p0, 0, %2, %3, c0\n"
-      : "=r" (lo), "=r" (hi)
-      : "r" (0), "r" (0x100));
+      "uxtah   %0, %1, %2\n"
+      : "=r" (res)
+      : "r" (hi),  "r" (lo));
+   return res;
 }
 


             reply	other threads:[~2018-02-07 18:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07 18:36 Tamar Christina [this message]
2018-02-09 12:14 ` Kyrill Tkachov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180207183550.GA6132@arm.com \
    --to=tamar.christina@arm.com \
    --cc=Kyrylo.Tkachov@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@arm.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).