arm-arches.def (armv8-m.base): Define new architecture.
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Thu, 7 Jul 2016 08:54:40 +0000 (08:54 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Thu, 7 Jul 2016 08:54:40 +0000 (08:54 +0000)
2016-07-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    * config/arm/arm-arches.def (armv8-m.base): Define new architecture.
    (armv8-m.main): Likewise.
    (armv8-m.main+dsp): Likewise.
    * config/arm/arm-protos.h (FL_FOR_ARCH8M_BASE): Define.
    (FL_FOR_ARCH8M_MAIN): Likewise.
    * config/arm/arm-tables.opt: Regenerate.
    * config/arm/bpabi.h: Add armv8-m.base, armv8-m.main and
    armv8-m.main+dsp to BE8_LINK_SPEC.
    * config/arm/arm.h (TARGET_HAVE_LDACQ): Exclude ARMv8-M.
    (enum base_architecture): Add BASE_ARCH_8M_BASE and BASE_ARCH_8M_MAIN.
    * config/arm/arm.c (arm_arch_name): Increase size to work with ARMv8-M
    Baseline and Mainline.
    (arm_option_override_internal): Also disable arm_restrict_it when
    !arm_arch_notm.  Update comment for -munaligned-access to also cover
    ARMv8-M Baseline.
    (arm_file_start): Increase buffer size for printing architecture name.
    * doc/invoke.texi: Document architectures armv8-m.base, armv8-m.main
    and armv8-m.main+dsp.
    (mno-unaligned-access): Clarify that this is disabled by default for
    ARMv8-M Baseline architectures as well.

    gcc/testsuite/
    * lib/target-supports.exp: Generate add_options_for_arm_arch_FUNC and
    check_effective_target_arm_arch_FUNC_multilib for ARMv8-M Baseline and
    ARMv8-M Mainline architectures.

    libgcc/
    * config/arm/lib1funcs.S (__ARM_ARCH__): Define to 8 for ARMv8-M.

From-SVN: r238081

12 files changed:
gcc/ChangeLog
gcc/config/arm/arm-arches.def
gcc/config/arm/arm-protos.h
gcc/config/arm/arm-tables.opt
gcc/config/arm/arm.c
gcc/config/arm/arm.h
gcc/config/arm/bpabi.h
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports.exp
libgcc/ChangeLog
libgcc/config/arm/lib1funcs.S

index 7273e76fbf396df0a20dcd259b3cd67df305d3a7..6e9f523855f5bc0554c2260ae1ee42e341530ff3 100644 (file)
@@ -1,3 +1,26 @@
+2016-07-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * config/arm/arm-arches.def (armv8-m.base): Define new architecture.
+       (armv8-m.main): Likewise.
+       (armv8-m.main+dsp): Likewise.
+       * config/arm/arm-protos.h (FL_FOR_ARCH8M_BASE): Define.
+       (FL_FOR_ARCH8M_MAIN): Likewise.
+       * config/arm/arm-tables.opt: Regenerate.
+       * config/arm/bpabi.h: Add armv8-m.base, armv8-m.main and
+       armv8-m.main+dsp to BE8_LINK_SPEC.
+       * config/arm/arm.h (TARGET_HAVE_LDACQ): Exclude ARMv8-M.
+       (enum base_architecture): Add BASE_ARCH_8M_BASE and BASE_ARCH_8M_MAIN.
+       * config/arm/arm.c (arm_arch_name): Increase size to work with ARMv8-M
+       Baseline and Mainline.
+       (arm_option_override_internal): Also disable arm_restrict_it when
+       !arm_arch_notm.  Update comment for -munaligned-access to also cover
+       ARMv8-M Baseline.
+       (arm_file_start): Increase buffer size for printing architecture name.
+       * doc/invoke.texi: Document architectures armv8-m.base, armv8-m.main
+       and armv8-m.main+dsp.
+       (mno-unaligned-access): Clarify that this is disabled by default for
+       ARMv8-M Baseline architectures as well.
+
 2016-07-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * config/arm/elf.h: Use __ARM_ARCH_ISA_THUMB and __ARM_ARCH_ISA_ARM to
index fd02b18db01d03da19fd66412f4bf1df00ce25da..be46521c9eaea54f9ad78a92874567589289dbdf 100644 (file)
@@ -62,6 +62,12 @@ ARM_ARCH("armv8.1-a", cortexa53,  8A,
 ARM_ARCH("armv8.1-a+crc",cortexa53, 8A,
          ARM_FSET_MAKE (FL_CO_PROC | FL_CRC32 | FL_FOR_ARCH8A,
                         FL2_FOR_ARCH8_1A))
+ARM_ARCH("armv8-m.base", cortexm0, 8M_BASE,
+        ARM_FSET_MAKE_CPU1 (                         FL_FOR_ARCH8M_BASE))
+ARM_ARCH("armv8-m.main", cortexm7, 8M_MAIN,
+        ARM_FSET_MAKE_CPU1(FL_CO_PROC |              FL_FOR_ARCH8M_MAIN))
+ARM_ARCH("armv8-m.main+dsp", cortexm7, 8M_MAIN,
+        ARM_FSET_MAKE_CPU1(FL_CO_PROC | FL_ARCH7EM | FL_FOR_ARCH8M_MAIN))
 ARM_ARCH("iwmmxt",  iwmmxt,     5TE,   ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT))
 ARM_ARCH("iwmmxt2", iwmmxt2,    5TE,   ARM_FSET_MAKE_CPU1 (FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT | FL_IWMMXT2))
 
index 1943907ba488a717f1000f0e1fd331f6ddfea429..2419ca0c5a3e31c4fa3d925fc7139fb4b8cd837b 100644 (file)
@@ -421,6 +421,8 @@ extern bool arm_is_constant_pool_ref (rtx);
 #define FL_FOR_ARCH7EM  (FL_FOR_ARCH7M | FL_ARCH7EM)
 #define FL_FOR_ARCH8A  (FL_FOR_ARCH7VE | FL_ARCH8)
 #define FL2_FOR_ARCH8_1A       FL2_ARCH8_1
+#define FL_FOR_ARCH8M_BASE     (FL_FOR_ARCH6M | FL_ARCH8 | FL_THUMB_DIV)
+#define FL_FOR_ARCH8M_MAIN     (FL_FOR_ARCH7M | FL_ARCH8)
 
 /* There are too many feature bits to fit in a single word so the set of cpu and
    fpu capabilities is a structure.  A feature set is created and manipulated
index a5fe2c36da284a31b9f3025c4d7ed327330e45b1..b92cb17f012d7ec5492e66e1e98ed3f1f4bae6eb 100644 (file)
@@ -437,10 +437,19 @@ EnumValue
 Enum(arm_arch) String(armv8.1-a+crc) Value(28)
 
 EnumValue
-Enum(arm_arch) String(iwmmxt) Value(29)
+Enum(arm_arch) String(armv8-m.base) Value(29)
 
 EnumValue
-Enum(arm_arch) String(iwmmxt2) Value(30)
+Enum(arm_arch) String(armv8-m.main) Value(30)
+
+EnumValue
+Enum(arm_arch) String(armv8-m.main+dsp) Value(31)
+
+EnumValue
+Enum(arm_arch) String(iwmmxt) Value(32)
+
+EnumValue
+Enum(arm_arch) String(iwmmxt2) Value(33)
 
 Enum
 Name(arm_fpu) Type(int)
index 580662d9b24d1d803bd1734169adff3053ecd5f9..3a9b9cb7bb8b42ba73ee2822b353e300d967c7c3 100644 (file)
@@ -2307,9 +2307,11 @@ static const struct processors *arm_selected_arch;
 static const struct processors *arm_selected_cpu;
 static const struct processors *arm_selected_tune;
 
-/* The name of the preprocessor macro to define for this architecture.  */
+/* The name of the preprocessor macro to define for this architecture.  PROFILE
+   is replaced by the architecture name (eg. 8A) in arm_option_override () and
+   is thus chosen to be big enough to hold the longest architecture name.  */
 
-char arm_arch_name[] = "__ARM_ARCH_0UNK__";
+char arm_arch_name[] = "__ARM_ARCH_PROFILE__";
 
 /* Available values for -mfpu=.  */
 
@@ -2950,7 +2952,8 @@ arm_option_override_internal (struct gcc_options *opts,
   if (! opts_set->x_arm_restrict_it)
     opts->x_arm_restrict_it = arm_arch8;
 
-  if (!TARGET_THUMB2_P (opts->x_target_flags))
+  /* ARM execution state and M profile don't have [restrict] IT.  */
+  if (!TARGET_THUMB2_P (opts->x_target_flags) || !arm_arch_notm)
     opts->x_arm_restrict_it = 0;
 
   /* Enable -munaligned-access by default for
@@ -2961,7 +2964,8 @@ arm_option_override_internal (struct gcc_options *opts,
 
      Disable -munaligned-access by default for
      - all pre-ARMv6 architecture-based processors
-     - ARMv6-M architecture-based processors.  */
+     - ARMv6-M architecture-based processors
+     - ARMv8-M Baseline processors.  */
 
   if (! opts_set->x_unaligned_access)
     {
@@ -26005,7 +26009,7 @@ arm_file_start (void)
              const char* pos = strchr (arm_selected_arch->name, '+');
              if (pos)
                {
-                 char buf[15];
+                 char buf[32];
                  gcc_assert (strlen (arm_selected_arch->name)
                              <= sizeof (buf) / sizeof (*pos));
                  strncpy (buf, arm_selected_arch->name,
index f0cdd669191689bc5dcf3a7c2b60da5a2d201e3f..07353629c6b04166e65505652130e3a6d93789d3 100644 (file)
@@ -261,7 +261,7 @@ extern void (*arm_lang_output_object_attributes_hook)(void);
                             || arm_arch7) && arm_arch_notm)
 
 /* Nonzero if this chip supports load-acquire and store-release.  */
-#define TARGET_HAVE_LDACQ      (TARGET_ARM_ARCH >= 8)
+#define TARGET_HAVE_LDACQ      (TARGET_ARM_ARCH >= 8 && arm_arch_notm)
 
 /* Nonzero if integer division instructions supported.  */
 #define TARGET_IDIV    ((TARGET_ARM && arm_arch_arm_hwdiv)     \
@@ -398,7 +398,9 @@ enum base_architecture
   BASE_ARCH_7R = 7,
   BASE_ARCH_7M = 7,
   BASE_ARCH_7EM = 7,
-  BASE_ARCH_8A = 8
+  BASE_ARCH_8A = 8,
+  BASE_ARCH_8M_BASE = 8,
+  BASE_ARCH_8M_MAIN = 8
 };
 
 /* The major revision number of the ARM Architecture implemented by the target.  */
index d6d394ace44cd7858b47c95e68c5d57282d31b0d..ff216607524120cde9b6f01bf89d63a907f8c113 100644 (file)
@@ -93,6 +93,9 @@
    |march=armv8-a+crc                                  \
    |march=armv8.1-a                                    \
    |march=armv8.1-a+crc                                        \
+   |march=armv8-m.base                                 \
+   |march=armv8-m.main                                 \
+   |march=armv8-m.main+dsp                             \
    :%{!r:--be8}}}"
 #else
 #define BE8_LINK_SPEC \
    |march=armv8-a+crc                                  \
    |march=armv8.1-a                                    \
    |march=armv8.1-a+crc                                        \
+   |march=armv8-m.base                                 \
+   |march=armv8-m.main                                 \
+   |march=armv8-m.main+dsp                             \
    :%{!r:--be8}}}"
 #endif
 
index ba44951843e2ac7cf7bb41fc20fe42c26732e127..b6398ff3512a2e998c8ff7c718ee3d670114fa68 100644 (file)
@@ -14148,7 +14148,8 @@ of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
-@samp{armv8.1-a+crc}, @samp{iwmmxt}, @samp{iwmmxt2}.
+@samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
+@samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
 
 Architecture revisions older than @samp{armv4t} are deprecated.
 
@@ -14460,10 +14461,10 @@ generating these instructions.  This option is enabled by default when
 @opindex mno-unaligned-access
 Enables (or disables) reading and writing of 16- and 32- bit values
 from addresses that are not 16- or 32- bit aligned.  By default
-unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
-architectures, and enabled for all other architectures.  If unaligned
-access is not enabled then words in packed data structures are
-accessed a byte at a time.
+unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
+ARMv8-M Baseline architectures, and enabled for all other
+architectures.  If unaligned access is not enabled then words in packed
+data structures are accessed a byte at a time.
 
 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
 generated object file to either true or false, depending upon the
index fa8438231152fe416b99b71ae7677ae9ccd0aa8e..16eebb6bcb78bf2d65b70cb816bbe156493e0815 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * lib/target-supports.exp: Generate add_options_for_arm_arch_FUNC and
+       check_effective_target_arm_arch_FUNC_multilib for ARMv8-M Baseline and
+       ARMv8-M Mainline architectures.
+
 2016-07-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * lib/target-supports.exp (check_effective_target_arm_cortex_m): Use
index 0e294c5581eeb8730a31f1e748796f989cde36cf..b26f8a29c8dc472c563fc2eb3a7d8768f1647bbe 100644 (file)
@@ -3348,7 +3348,9 @@ foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
                                     v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
                                     v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
                                     v8a "-march=armv8-a" __ARM_ARCH_8A__
-                                    v8_1a "-march=armv8.1a" __ARM_ARCH_8A__ } {
+                                    v8_1a "-march=armv8.1a" __ARM_ARCH_8A__
+                                    v8m_base "-march=armv8-m.base -mthumb" __ARM_ARCH_8M_BASE__
+                                    v8m_main "-march=armv8-m.main -mthumb" __ARM_ARCH_8M_MAIN__ } {
     eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
        proc check_effective_target_arm_arch_FUNC_ok { } {
            if { [ string match "*-marm*" "FLAG" ] &&
index 9ed6385bba481eae1f8a2a65239fe6a109e1a87c..b6f830fee82372bb13e1b5f5437927ad1441d2b1 100644 (file)
@@ -1,3 +1,7 @@
+2016-07-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * config/arm/lib1funcs.S (__ARM_ARCH__): Define to 8 for ARMv8-M.
+
 2016-07-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * config/arm/lib1funcs.S (HAVE_ARM_CLZ): Define for ARMv6* or later
index c4f061f8196d243159903cac4eb0291d1bf0b1ad..96e206ee542126c5d68091087446afe9f01aa51f 100644 (file)
@@ -108,7 +108,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # define __ARM_ARCH__ 7
 #endif
 
-#if defined(__ARM_ARCH_8A__)
+#if defined(__ARM_ARCH_8A__) || defined(__ARM_ARCH_8M_BASE__) \
+       || defined(__ARM_ARCH_8M_MAIN__)
 # define __ARM_ARCH__ 8
 #endif