ARM: fix -masm-syntax-unified (PR88648)
authorStefan Agner <stefan@agner.ch>
Thu, 10 Jan 2019 11:36:42 +0000 (12:36 +0100)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Thu, 10 Jan 2019 11:36:42 +0000 (11:36 +0000)
This allows to use unified asm syntax when compiling for the
ARM instruction. This matches documentation and seems what the
initial patch was intended doing when the flag got added.

2019-01-10  Stefan Agner  <stefan@agner.ch>

PR target/88648
* config/arm/arm.c (arm_option_override_internal): Force
opts->x_inline_asm_unified to true only if TARGET_THUMB2_P.

* gcc.target/arm/pr88648-asm-syntax-unified.c: Add test to
check if -masm-syntax-unified gets applied properly.

From-SVN: r267804

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/pr88648-asm-syntax-unified.c [new file with mode: 0644]

index ee2e8fbf95d790469696f08fd2c49e2400b1fcc7..c229d6595c8d2d63fbdc4a9fa75be64b6f3d1c3c 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-10  Stefan Agner  <stefan@agner.ch>
+
+       PR target/88648
+       * config/arm/arm.c (arm_option_override_internal): Force
+       opts->x_inline_asm_unified to true only if TARGET_THUMB2_P.
+
 2019-01-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/88568
index f473aee8d34c384a16a8c52f0c820269ad408698..d71ab4075a75f675d5a8267bc569f6b4fc78228e 100644 (file)
@@ -3101,7 +3101,8 @@ arm_option_override_internal (struct gcc_options *opts,
 
   /* Thumb2 inline assembly code should always use unified syntax.
      This will apply to ARM and Thumb1 eventually.  */
-  opts->x_inline_asm_unified = TARGET_THUMB2_P (opts->x_target_flags);
+  if (TARGET_THUMB2_P (opts->x_target_flags))
+    opts->x_inline_asm_unified = true;
 
 #ifdef SUBTARGET_OVERRIDE_INTERNAL_OPTIONS
   SUBTARGET_OVERRIDE_INTERNAL_OPTIONS;
index 6408435a52db49ffc02f465ae6a8122442e9ae85..3936a8f4bce77f26a037cac75d70e6eaaa374217 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-10  Stefan Agner  <stefan@agner.ch>
+
+       PR target/88648
+       * gcc.target/arm/pr88648-asm-syntax-unified.c: Add test to
+       check if -masm-syntax-unified gets applied properly.
+
 2019-01-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/88568
diff --git a/gcc/testsuite/gcc.target/arm/pr88648-asm-syntax-unified.c b/gcc/testsuite/gcc.target/arm/pr88648-asm-syntax-unified.c
new file mode 100644 (file)
index 0000000..251b4d5
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test for unified syntax assembly generation.  */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_arch_v7a_ok } */
+/* { dg-add-options arm_arch_v7a } */
+/* { dg-options "-marm -march=armv7-a -masm-syntax-unified" } */
+
+void test ()
+{
+  asm("nop");
+}
+
+/* { dg-final { scan-assembler-times {\.syntax\sunified} 3 } } */
+/* { dg-final { scan-assembler-not {\.syntax\sdivided} } } */
+