public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
@ 2015-12-17  2:56 Thomas Preud'homme
  2015-12-23  7:05 ` Thomas Preud'homme
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Preud'homme @ 2015-12-17  2:56 UTC (permalink / raw)
  To: binutils

Hi,

=== Patch description ===

This patch is part of a patch series to add support for ARMv8-M[1] to binutils. This specific patch adds support for the DSP extension of ARMv8-M Mainline. It allows:

* armv8-m.main+dsp to be recognized as an architecture with DSP extension
* instructions added by the DSP extension to ARMv8-M Mainline to be recognized

[1] For a quick overview of ARMv8-M please refer to the initial cover letter.

ChangeLog entries are as follow:


*** bfd/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        (elf32_arm_merge_eabi_attributes): Add merging logic for
        Tag_DSP_extension.


*** binutils/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * readelf.c (display_arm_attribute): Add output for Tag_DSP_extension.
        (arm_attr_public_tags): Define DSP_extension attribute.


*** gas/ChangeLog ***

2015-11-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
        instructions.
        (arm_extensions): Add dsp extension for ARMv8-M Mainline.
        (aeabi_set_public_attributes): Set Tag_DSP_extension to 1 for ARMv8-M
        Mainline with DSP extension.
        (arm_convert_symbolic_attribute): Define Tag_DSP_extension.


*** gas/testsuite/ChangeLog ***

2015-11-16  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * gas/arm/arch7em-bad.d: Rename to ...
        * gas/arm/arch7em-bad-1.d: This.
        * gas/arm/arch7em-bad-2.d: New file.
        * gas/arm/arch7em-bad-3.d: Likewise.
        * gas/arm/archv8m-main-dsp-1.d: Likewise.
        * gas/arm/archv8m-main-dsp-2.d: Likewise.
        * gas/arm/archv8m-main-dsp-3.d: Likewise.
        * gas/arm/attr-march-armv8m.main.dsp.d: Likewise.


*** include/elf/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * arm.h (Tag_DSP_extension): Define.


*** ld/testsuite/ChangeLog ***

2015-12-16  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * ld-arm/attr-merge-10b-dsp.s: New file.
        * ld-arm/attr-merge-10-dsp.attr: Likewise.


diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index b10a3430e2d0cd5ad22f136aa5f706506a40759e..c26e590950df847dccd4fb3f9e0f07c74b319228 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -12611,6 +12611,31 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
 		}
 	    }
 	  break;
+
+	case Tag_DSP_extension:
+	  /* No need to change output value if any of:
+	     - pre ARMv5T input architecture (do not have DSP)
+	     - M input profile not ARMv7e-M and do not have DSP.  */
+	  if (in_attr[Tag_CPU_arch].i <= 3
+	      || (in_attr[Tag_CPU_arch_profile].i == 'M'
+		  && in_attr[Tag_CPU_arch].i != 13
+		  && in_attr[i].i == 0))
+	    ; /* Do nothing.  */
+	  /* Output value should be 0 if DSP part of architecture, ie.
+	     - post ARMv5te architecture output
+	     - A, R or S profile output or ARMv7e-M output architecture.  */
+	  else if (out_attr[Tag_CPU_arch].i >= 4
+		   && (out_attr[Tag_CPU_arch_profile].i == 'A'
+		       || out_attr[Tag_CPU_arch_profile].i == 'R'
+		       || out_attr[Tag_CPU_arch_profile].i == 'S'
+		       || out_attr[Tag_CPU_arch].i == 13))
+	    out_attr[i].i = 0;
+	  /* Otherwise, DSP instructions are added and not part of output
+	     architecture.  */
+	  else
+	    out_attr[i].i = 1;
+	  break;
+
 	case Tag_FP_arch:
 	    {
 	      /* Tag_ABI_HardFP_use is handled along with Tag_FP_arch since
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 547804a9eca7952099479928f983dd9d64117a68..182b31aaa1f74efc06304209bda3efee5cec2e91 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12764,6 +12764,8 @@ static const char * arm_attr_tag_FP_HP_extension[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_ABI_FP_16bit_format[] =
   {"None", "IEEE 754", "Alternative Format"};
+static const char * arm_attr_tag_DSP_extension[] =
+  {"Follow architecture", "Allowed"};
 static const char * arm_attr_tag_MPextension_use[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_DIV_use[] =
@@ -12814,6 +12816,7 @@ static arm_attr_public_tag arm_attr_public_tags[] =
   LOOKUP(38, ABI_FP_16bit_format),
   LOOKUP(42, MPextension_use),
   LOOKUP(44, DIV_use),
+  LOOKUP(46, DSP_extension),
   {64, "nodefaults", 0, NULL},
   {65, "also_compatible_with", 0, NULL},
   LOOKUP(66, T2EE_use),
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 33ffa410d934a75e2a6f642651f16d2c5507a7af..708e19c401f06905250350f71bf507352a4816db 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -214,6 +214,9 @@ static const arm_feature_set arm_ext_v6t2_v8m =
 /* Instructions shared between ARMv8-A and ARMv8-M.  */
 static const arm_feature_set arm_ext_atomics =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_ATOMICS);
+/* DSP instructions Tag_DSP_extension refers to.  */
+static const arm_feature_set arm_ext_dsp =
+  ARM_FEATURE_CORE_LOW (ARM_EXT_V5E | ARM_EXT_V5ExP | ARM_EXT_V6_DSP);
 
 static const arm_feature_set arm_arch_any = ARM_ANY;
 static const arm_feature_set arm_arch_full = ARM_FEATURE (-1, -1, -1);
@@ -24964,6 +24967,9 @@ static const struct arm_option_extension_value_table arm_extensions[] =
   ARM_EXT_OPT ("crypto", FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
 			 ARM_FEATURE_COPROC (FPU_CRYPTO_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
+  ARM_EXT_OPT ("dsp",	ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE (ARM_EXT_V7M, ARM_EXT2_V8M)),
   ARM_EXT_OPT ("fp",     FPU_ARCH_VFP_ARMV8, ARM_FEATURE_COPROC (FPU_VFP_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
   ARM_EXT_OPT2 ("idiv",	ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV | ARM_EXT_DIV),
@@ -25599,6 +25605,7 @@ aeabi_set_public_attributes (void)
   char profile;
   int virt_sec = 0;
   int fp16_optional = 0;
+  arm_feature_set arm_arch = ARM_ARCH_NONE;
   arm_feature_set flags;
   arm_feature_set tmp;
   arm_feature_set arm_arch_v8m_base = ARM_ARCH_V8M_BASE;
@@ -25638,6 +25645,7 @@ aeabi_set_public_attributes (void)
       if (ARM_CPU_HAS_FEATURE (tmp, p->flags))
 	{
 	  arch = p->val;
+	  arm_arch = p->flags;
 	  ARM_CLEAR_FEATURE (tmp, tmp, p->flags);
 	}
     }
@@ -25654,17 +25662,26 @@ aeabi_set_public_attributes (void)
       && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v7m)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v6_dsp))
-    arch = 13;
+    {
+      arch = 13;
+      arm_arch = (arm_feature_set) ARM_ARCH_V7EM;
+    }
 
   ARM_CLEAR_FEATURE (tmp, flags, arm_arch_v8m_base);
   if (arch == 16 && ARM_CPU_HAS_FEATURE (tmp, arm_arch_any))
-    arch = 17;
+    {
+      arch = 17;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8M_MAIN;
+    }
 
   /* In cpu_arch_ver ARMv8-A is before ARMv8-M for atomics to be detected as
      coming from ARMv8-A.  However, since ARMv8-A has more instructions than
      ARMv8-M, -march=all must be detected as ARMv8-A.  */
   if (arch == 17 && ARM_FEATURE_CORE_EQUAL (selected_cpu, arm_arch_any))
-    arch = 14;
+    {
+      arch = 14;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8A;
+    }
 
   /* Tag_CPU_name.  */
   if (selected_cpu_name[0])
@@ -25702,6 +25719,17 @@ aeabi_set_public_attributes (void)
   if (profile != '\0')
     aeabi_set_attribute_int (Tag_CPU_arch_profile, profile);
 
+  /* Tag_DSP_extension.  */
+  if (ARM_CPU_HAS_FEATURE (flags, arm_ext_dsp))
+    {
+      arm_feature_set ext;
+
+      /* DSP instructions not in architecture.  */
+      ARM_CLEAR_FEATURE (ext, flags, arm_arch);
+      if (ARM_CPU_HAS_FEATURE (ext, arm_ext_dsp))
+	aeabi_set_attribute_int (Tag_DSP_extension, 1);
+    }
+
   /* Tag_ARM_ISA_use.  */
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v1)
       || arch == 0)
@@ -26095,6 +26123,7 @@ arm_convert_symbolic_attribute (const char *name)
       T (Tag_conformance),
       T (Tag_T2EE_use),
       T (Tag_Virtualization_use),
+      T (Tag_DSP_extension),
       /* We deliberately do not include Tag_MPextension_use_legacy.  */
 #undef T
     };
diff --git a/gas/testsuite/gas/arm/arch7em-bad-2.d b/gas/testsuite/gas/arm/arch7em-bad-2.d
new file mode 100644
index 0000000000000000000000000000000000000000..8c01bbcd71a54204618feee4d24b398dc0ccd503
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-2.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M mainline with DSP extension, invalid v8-M baseline
+#as: -march=armv8-m.base
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad-3.d b/gas/testsuite/gas/arm/arch7em-bad-3.d
new file mode 100644
index 0000000000000000000000000000000000000000..7fef14c3aaddca030fff14732cc88cd1f22b0cba
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-3.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M mainline with DSP extension, invalid v8-M mainline
+#as: -march=armv8-m.main
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad.d b/gas/testsuite/gas/arm/arch7em-bad-1.d
similarity index 100%
rename from gas/testsuite/gas/arm/arch7em-bad.d
rename to gas/testsuite/gas/arm/arch7em-bad-1.d
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-1.d b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
new file mode 100644
index 0000000000000000000000000000000000000000..9909364aabcf5ad3c4e27c59ffade13abe446477
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
@@ -0,0 +1,47 @@
+#name: ARM V8-M mainline with DSP instructions (base)
+#source: archv8m.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> 47a0      	blx	r4
+0+.* <[^>]*> 47c8      	blx	r9
+0+.* <[^>]*> 4720      	bx	r4
+0+.* <[^>]*> 4748      	bx	r9
+0+.* <[^>]*> e841 f000 	tt	r0, r1
+0+.* <[^>]*> e849 f800 	tt	r8, r9
+0+.* <[^>]*> e841 f040 	ttt	r0, r1
+0+.* <[^>]*> e849 f840 	ttt	r8, r9
+0+.* <[^>]*> f24f 1023 	movw	r0, #61731	; 0xf123
+0+.* <[^>]*> f24f 1823 	movw	r8, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1023 	movt	r0, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1823 	movt	r8, #61731	; 0xf123
+0+.* <[^>]*> b154      	cbz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> b94c      	cbnz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> f000 b808 	b.w	0+.* <[^>]*>
+0+.* <[^>]*> fb91 f0f2 	sdiv	r0, r1, r2
+0+.* <[^>]*> fb99 f8fa 	sdiv	r8, r9, sl
+0+.* <[^>]*> fbb1 f0f2 	udiv	r0, r1, r2
+0+.* <[^>]*> fbb9 f8fa 	udiv	r8, r9, sl
+0+.* <[^>]*> 4408      	add	r0, r1
+0+.* <[^>]*> f3bf 8f2f 	clrex
+0+.* <[^>]*> e851 0f01 	ldrex	r0, \[r1, #4\]
+0+.* <[^>]*> e8d1 0f4f 	ldrexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f5f 	ldrexh	r0, \[r1\]
+0+.* <[^>]*> e842 1001 	strex	r0, r1, \[r2, #4\]
+0+.* <[^>]*> e8c2 1f40 	strexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1f50 	strexh	r0, r1, \[r2\]
+0+.* <[^>]*> e8d1 0faf 	lda	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f8f 	ldab	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f9f 	ldah	r0, \[r1\]
+0+.* <[^>]*> e8c1 0faf 	stl	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f8f 	stlb	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f9f 	stlh	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fef 	ldaex	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fcf 	ldaexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fdf 	ldaexh	r0, \[r1\]
+0+.* <[^>]*> e8c2 1fe0 	stlex	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fc0 	stlexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fd0 	stlexh	r0, r1, \[r2\]
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-2.d b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
new file mode 100644
index 0000000000000000000000000000000000000000..3e42b0666a64972c11689e678545a34943b1a1e7
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
@@ -0,0 +1,17 @@
+#name: ARM V8-M mainline with DSP instructions (security extensions)
+#source: archv8m-cmse.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> e97f e97f 	sg
+0+.* <[^>]*> 47a4      	blxns	r4
+0+.* <[^>]*> 47cc      	blxns	r9
+0+.* <[^>]*> 4724      	bxns	r4
+0+.* <[^>]*> 474c      	bxns	r9
+0+.* <[^>]*> e841 f080 	tta	r0, r1
+0+.* <[^>]*> e849 f880 	tta	r8, r9
+0+.* <[^>]*> e841 f0c0 	ttat	r0, r1
+0+.* <[^>]*> e849 f8c0 	ttat	r8, r9
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-3.d b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
new file mode 100644
index 0000000000000000000000000000000000000000..92e20903671e3d80e78d48ac5ececa5ca125fe04
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
@@ -0,0 +1,140 @@
+#name: ARM V8-M mainline with DSP instructions (extension)
+#source: arch7em.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> eac0 0000 	pkhbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> eac0 0900 	pkhbt	r9, r0, r0
+0[0-9a-f]+ <[^>]+> eac9 0000 	pkhbt	r0, r9, r0
+0[0-9a-f]+ <[^>]+> eac0 0009 	pkhbt	r0, r0, r9
+0[0-9a-f]+ <[^>]+> eac0 5000 	pkhbt	r0, r0, r0, lsl #20
+0[0-9a-f]+ <[^>]+> eac0 00c0 	pkhbt	r0, r0, r0, lsl #3
+0[0-9a-f]+ <[^>]+> eac3 0102 	pkhbt	r1, r3, r2
+0[0-9a-f]+ <[^>]+> eac2 4163 	pkhtb	r1, r2, r3, asr #17
+0[0-9a-f]+ <[^>]+> fa83 f182 	qadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f113 	qadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f113 	qadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f192 	qdadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1b2 	qdsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1a2 	qsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f113 	qsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f113 	qsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f103 	sadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f103 	sadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f103 	ssub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f103 	ssub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f123 	shadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f123 	shadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f123 	shsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f123 	shsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f143 	uadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f143 	uadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f143 	usub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f143 	usub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f163 	uhadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f163 	uhadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f163 	uhsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f163 	uhsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f153 	uqadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f153 	uqadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f153 	uqsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f153 	uqsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f183 	sel	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fb10 0000 	smlabb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0900 	smlabb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 0000 	smlabb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0009 	smlabb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 9000 	smlabb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 0020 	smlatb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0010 	smlabt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0030 	smlatt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0000 	smlawb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0010 	smlawt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0000 	smlad	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0010 	smladx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0000 	smlsd	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0010 	smlsdx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0000 	smmla	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0010 	smmlar	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0000 	smmls	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0010 	smmlsr	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 0000 	usada8	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0080 	smlalbb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 9080 	smlalbb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0980 	smlalbb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fbc9 0080 	smlalbb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fbc0 0089 	smlalbb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fbc0 00a0 	smlaltb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0090 	smlalbt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00b0 	smlaltt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00c0 	smlald	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00d0 	smlaldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00c0 	smlsld	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00d0 	smlsldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbe0 0060 	umaal	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f000 	smulbb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f900 	smulbb	r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 f000 	smulbb	r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 f009 	smulbb	r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 f020 	smultb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f010 	smulbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f030 	smultt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f000 	smulwb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f010 	smulwt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f000 	smmul	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f010 	smmulr	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f000 	smuad	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f010 	smuadx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f000 	smusd	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f010 	smusdx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 f000 	usad8	r0, r0, r0
+0[0-9a-f]+ <[^>]+> f320 0000 	ssat16	r0, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0900 	ssat16	r9, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0009 	ssat16	r0, #10, r0
+0[0-9a-f]+ <[^>]+> f329 0000 	ssat16	r0, #1, r9
+0[0-9a-f]+ <[^>]+> f3a0 0000 	usat16	r0, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0900 	usat16	r9, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0009 	usat16	r0, #9, r0
+0[0-9a-f]+ <[^>]+> f3a9 0000 	usat16	r0, #0, r9
+0[0-9a-f]+ <[^>]+> fa2f f182 	sxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa2f f889 	sxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa3f f182 	uxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa3f f889 	uxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f990 	sxtab	r9, r0, r0, ror #8
+0[0-9a-f]+ <[^>]+> fa49 f0a0 	sxtab	r0, r9, r0, ror #16
+0[0-9a-f]+ <[^>]+> fa40 f0b9 	sxtab	r0, r0, r9, ror #24
+0[0-9a-f]+ <[^>]+> fa22 f183 	sxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa02 f183 	sxtah	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa52 f183 	uxtab	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa32 f183 	uxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa12 f183 	uxtah	r1, r2, r3
diff --git a/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
new file mode 100644
index 0000000000000000000000000000000000000000..56600d3c2680c643bd2308fd97a25f99cfece1c0
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
@@ -0,0 +1,14 @@
+# name: attributes for -march=armv8-m.main+dsp
+# source: blank.s
+# as: -march=armv8-m.main+dsp
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 4a821639502263136ff2d12a384c0dd727e2f16f..a477f17dd8c6f05e736e46bc6402778f0ad7f19b 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -305,6 +305,7 @@ enum
   Tag_MPextension_use,
   Tag_undefined_43,
   Tag_DIV_use,
+  Tag_DSP_extension = 46,
   Tag_nodefaults = 64,
   Tag_also_compatible_with,
   Tag_T2EE_use,
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 14b74030fbf2994785e305ab01531f538276f41e..a991c39717791837691f5b01e6a642aec9941e5e 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -379,6 +379,9 @@ set armeabitests_common {
      {"EABI attribute merging 10" "-r" "" "" {attr-merge-10a.s attr-merge-10b.s}
       {{readelf -A attr-merge-10.attr}}
       "attr-merge-10"}
+     {"EABI attribute merging 10 (DSP)" "-r" "" "" {attr-merge-10a.s attr-merge-10b-dsp.s}
+      {{readelf -A attr-merge-10-dsp.attr}}
+      "attr-merge-10-dsp"}
      {"EABI attribute arch merging 1" "-r" "" "" {arch-v6k.s arch-v6t2.s}
       {{readelf -A attr-merge-arch-1.attr}}
       "attr-merge-arch-1"}
diff --git a/ld/testsuite/ld-arm/attr-merge-10-dsp.attr b/ld/testsuite/ld-arm/attr-merge-10-dsp.attr
new file mode 100644
index 0000000000000000000000000000000000000000..7cdbd49cf9bac04a5226688fa7265b67ce175789
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10-dsp.attr
@@ -0,0 +1,7 @@
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/ld/testsuite/ld-arm/attr-merge-10b-dsp.s b/ld/testsuite/ld-arm/attr-merge-10b-dsp.s
new file mode 100644
index 0000000000000000000000000000000000000000..de67b36d9984c198a6eafc81b9bc729f858b9fe7
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10b-dsp.s
@@ -0,0 +1,6 @@
+	.arch armv8-m.main
+
+	@ Tag_CPU_arch & Tag_CPU_arch_profile = v8-M.MAIN
+	.eabi_attribute Tag_CPU_arch, 17
+	.eabi_attribute Tag_CPU_arch_profile, 'M'
+	.eabi_attribute Tag_DSP_extension, 1
diff --git a/ld/testsuite/ld-arm/attr-merge-4b.s b/ld/testsuite/ld-arm/attr-merge-4b.s
index 2cf68df2577e1401b20e990b4e25a507a0da13e0..1b371dab4ea636712d9a3de954da455bf912f8f1 100644
--- a/ld/testsuite/ld-arm/attr-merge-4b.s
+++ b/ld/testsuite/ld-arm/attr-merge-4b.s
@@ -2,6 +2,7 @@
 
 	@ Tag_CPU_arch = v6-M
 	.eabi_attribute Tag_CPU_arch, 11
+	.eabi_attribute Tag_CPU_arch_profile, 0x4D
 
 	@ Tag_also_compatible_with = v4T
 	.eabi_attribute Tag_also_compatible_with, "\006\002"


Tests done:

* No regression under binutils testsuite
* Toolchain was built successfully with and without the ARMv8-M support patches[2] with the following multilib list: armv6-m,armv7-m,armv7e-m,cortex-m7,armv8-m.base,armv8-m.main. The code generation for crtbegin.o, crtend.o, crti.o, crtn.o, libgcc.a, libgcov.a, libc.a, libg.a, libgloss-linux.a, libm.a, libnosys.a, librdimon.a, librdpmon.a, libstdc++.a and libsupc++.a is unchanged for all targets supported before the patches.
* Thumb-1 (default arch and --with-mode=thumb) and Thumb-2 (--with-arch=armv7-a --with-mode=thumb) GCC bootstrap using binutils with this patch
* No GCC testsuite regression on fast model compared to ARMv6s-M (Baseline) or ARMv7-M (Mainline)

[2] including this one, the ld one and the GCC one

Is this ok for the master branch?

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2015-12-17  2:56 [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension Thomas Preud'homme
@ 2015-12-23  7:05 ` Thomas Preud'homme
  2016-03-29 14:28   ` Thomas Preudhomme
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Preud'homme @ 2015-12-23  7:05 UTC (permalink / raw)
  To: binutils

Hi,

> From: binutils-owner@sourceware.org [mailto:binutils-
> owner@sourceware.org] On Behalf Of Thomas Preud'homme
> 
> ChangeLog entries are as follow:
> 
> 
> *** bfd/ChangeLog ***
> 
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         (elf32_arm_merge_eabi_attributes): Add merging logic for
>         Tag_DSP_extension.
> 
> 
> *** binutils/ChangeLog ***
> 
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * readelf.c (display_arm_attribute): Add output for
> Tag_DSP_extension.
>         (arm_attr_public_tags): Define DSP_extension attribute.
> 
> 
> *** gas/ChangeLog ***
> 
> 2015-11-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
>         instructions.
>         (arm_extensions): Add dsp extension for ARMv8-M Mainline.
>         (aeabi_set_public_attributes): Set Tag_DSP_extension to 1 for
> ARMv8-M
>         Mainline with DSP extension.
>         (arm_convert_symbolic_attribute): Define Tag_DSP_extension.
> 
> 
> *** gas/testsuite/ChangeLog ***
> 
> 2015-11-16  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * gas/arm/arch7em-bad.d: Rename to ...
>         * gas/arm/arch7em-bad-1.d: This.
>         * gas/arm/arch7em-bad-2.d: New file.
>         * gas/arm/arch7em-bad-3.d: Likewise.
>         * gas/arm/archv8m-main-dsp-1.d: Likewise.
>         * gas/arm/archv8m-main-dsp-2.d: Likewise.
>         * gas/arm/archv8m-main-dsp-3.d: Likewise.
>         * gas/arm/attr-march-armv8m.main.dsp.d: Likewise.
> 
> 
> *** include/elf/ChangeLog ***
> 
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * arm.h (Tag_DSP_extension): Define.
> 
> 
> *** ld/testsuite/ChangeLog ***
> 
> 2015-12-16  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * ld-arm/attr-merge-10b-dsp.s: New file.
>         * ld-arm/attr-merge-10-dsp.attr: Likewise.


The patch didn't apply cleanly anymore after the changes in patches 1/7 to 4/7. I've thus rebased it on top of the new versions. ChangeLog entries are unchanged.


diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 63ff49f57bda6d5656ce39eaa67801870916f861..dde83886a24928bd03262dfcb21351a97b6428c1 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -12712,6 +12712,31 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
 		}
 	    }
 	  break;
+
+	case Tag_DSP_extension:
+	  /* No need to change output value if any of:
+	     - pre ARMv5T input architecture (do not have DSP)
+	     - M input profile not ARMv7e-M and do not have DSP.  */
+	  if (in_attr[Tag_CPU_arch].i <= 3
+	      || (in_attr[Tag_CPU_arch_profile].i == 'M'
+		  && in_attr[Tag_CPU_arch].i != 13
+		  && in_attr[i].i == 0))
+	    ; /* Do nothing.  */
+	  /* Output value should be 0 if DSP part of architecture, ie.
+	     - post ARMv5te architecture output
+	     - A, R or S profile output or ARMv7e-M output architecture.  */
+	  else if (out_attr[Tag_CPU_arch].i >= 4
+		   && (out_attr[Tag_CPU_arch_profile].i == 'A'
+		       || out_attr[Tag_CPU_arch_profile].i == 'R'
+		       || out_attr[Tag_CPU_arch_profile].i == 'S'
+		       || out_attr[Tag_CPU_arch].i == 13))
+	    out_attr[i].i = 0;
+	  /* Otherwise, DSP instructions are added and not part of output
+	     architecture.  */
+	  else
+	    out_attr[i].i = 1;
+	  break;
+
 	case Tag_FP_arch:
 	    {
 	      /* Tag_ABI_HardFP_use is handled along with Tag_FP_arch since
diff --git a/binutils/readelf.c b/binutils/readelf.c
index c1a329efb78a6562ba501bf960abd3a16937b003..9135599ca330fffd579bc778670ba22d7a0c6021 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12766,6 +12766,8 @@ static const char * arm_attr_tag_FP_HP_extension[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_ABI_FP_16bit_format[] =
   {"None", "IEEE 754", "Alternative Format"};
+static const char * arm_attr_tag_DSP_extension[] =
+  {"Follow architecture", "Allowed"};
 static const char * arm_attr_tag_MPextension_use[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_DIV_use[] =
@@ -12816,6 +12818,7 @@ static arm_attr_public_tag arm_attr_public_tags[] =
   LOOKUP(38, ABI_FP_16bit_format),
   LOOKUP(42, MPextension_use),
   LOOKUP(44, DIV_use),
+  LOOKUP(46, DSP_extension),
   {64, "nodefaults", 0, NULL},
   {65, "also_compatible_with", 0, NULL},
   LOOKUP(66, T2EE_use),
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index c763bbe376fce03a3f19d1aac0915be8328ac5b4..a973ae7b0e3338415e05c67dc24bbe2e4120aa8a 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -214,6 +214,9 @@ static const arm_feature_set arm_ext_v6t2_v8m =
 /* Instructions shared between ARMv8-A and ARMv8-M.  */
 static const arm_feature_set arm_ext_atomics =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_ATOMICS);
+/* DSP instructions Tag_DSP_extension refers to.  */
+static const arm_feature_set arm_ext_dsp =
+  ARM_FEATURE_CORE_LOW (ARM_EXT_V5E | ARM_EXT_V5ExP | ARM_EXT_V6_DSP);
 
 static const arm_feature_set arm_arch_any = ARM_ANY;
 static const arm_feature_set arm_arch_full = ARM_FEATURE (-1, -1, -1);
@@ -25064,6 +25067,9 @@ static const struct arm_option_extension_value_table arm_extensions[] =
   ARM_EXT_OPT ("crypto", FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
 			 ARM_FEATURE_COPROC (FPU_CRYPTO_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
+  ARM_EXT_OPT ("dsp",	ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE (ARM_EXT_V7M, ARM_EXT2_V8M)),
   ARM_EXT_OPT ("fp",     FPU_ARCH_VFP_ARMV8, ARM_FEATURE_COPROC (FPU_VFP_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
   ARM_EXT_OPT2 ("idiv",	ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV | ARM_EXT_DIV),
@@ -25699,6 +25705,7 @@ aeabi_set_public_attributes (void)
   char profile;
   int virt_sec = 0;
   int fp16_optional = 0;
+  arm_feature_set arm_arch = ARM_ARCH_NONE;
   arm_feature_set flags;
   arm_feature_set tmp;
   arm_feature_set arm_arch_v8m_base = ARM_ARCH_V8M_BASE;
@@ -25738,6 +25745,7 @@ aeabi_set_public_attributes (void)
       if (ARM_CPU_HAS_FEATURE (tmp, p->flags))
 	{
 	  arch = p->val;
+	  arm_arch = p->flags;
 	  ARM_CLEAR_FEATURE (tmp, tmp, p->flags);
 	}
     }
@@ -25754,18 +25762,27 @@ aeabi_set_public_attributes (void)
       && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v7m)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v6_dsp))
-    arch = TAG_CPU_ARCH_V7E_M;
+    {
+      arch = TAG_CPU_ARCH_V7E_M;
+      arm_arch = (arm_feature_set) ARM_ARCH_V7EM;
+    }
 
   ARM_CLEAR_FEATURE (tmp, flags, arm_arch_v8m_base);
   if (arch == TAG_CPU_ARCH_V8M_BASE && ARM_CPU_HAS_FEATURE (tmp, arm_arch_any))
-    arch = TAG_CPU_ARCH_V8M_MAIN;
+    {
+      arch = TAG_CPU_ARCH_V8M_MAIN;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8M_MAIN;
+    }
 
   /* In cpu_arch_ver ARMv8-A is before ARMv8-M for atomics to be detected as
      coming from ARMv8-A.  However, since ARMv8-A has more instructions than
      ARMv8-M, -march=all must be detected as ARMv8-A.  */
   if (arch == TAG_CPU_ARCH_V8M_MAIN
       && ARM_FEATURE_CORE_EQUAL (selected_cpu, arm_arch_any))
-    arch = TAG_CPU_ARCH_V8;
+    {
+      arch = TAG_CPU_ARCH_V8;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8A;
+    }
 
   /* Tag_CPU_name.  */
   if (selected_cpu_name[0])
@@ -25803,6 +25820,17 @@ aeabi_set_public_attributes (void)
   if (profile != '\0')
     aeabi_set_attribute_int (Tag_CPU_arch_profile, profile);
 
+  /* Tag_DSP_extension.  */
+  if (ARM_CPU_HAS_FEATURE (flags, arm_ext_dsp))
+    {
+      arm_feature_set ext;
+
+      /* DSP instructions not in architecture.  */
+      ARM_CLEAR_FEATURE (ext, flags, arm_arch);
+      if (ARM_CPU_HAS_FEATURE (ext, arm_ext_dsp))
+	aeabi_set_attribute_int (Tag_DSP_extension, 1);
+    }
+
   /* Tag_ARM_ISA_use.  */
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v1)
       || arch == 0)
@@ -26196,6 +26224,7 @@ arm_convert_symbolic_attribute (const char *name)
       T (Tag_conformance),
       T (Tag_T2EE_use),
       T (Tag_Virtualization_use),
+      T (Tag_DSP_extension),
       /* We deliberately do not include Tag_MPextension_use_legacy.  */
 #undef T
     };
diff --git a/gas/testsuite/gas/arm/arch7em-bad-2.d b/gas/testsuite/gas/arm/arch7em-bad-2.d
new file mode 100644
index 0000000000000000000000000000000000000000..8c01bbcd71a54204618feee4d24b398dc0ccd503
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-2.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M mainline with DSP extension, invalid v8-M baseline
+#as: -march=armv8-m.base
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad-3.d b/gas/testsuite/gas/arm/arch7em-bad-3.d
new file mode 100644
index 0000000000000000000000000000000000000000..7fef14c3aaddca030fff14732cc88cd1f22b0cba
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-3.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M mainline with DSP extension, invalid v8-M mainline
+#as: -march=armv8-m.main
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad.d b/gas/testsuite/gas/arm/arch7em-bad-1.d
similarity index 100%
rename from gas/testsuite/gas/arm/arch7em-bad.d
rename to gas/testsuite/gas/arm/arch7em-bad-1.d
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-1.d b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
new file mode 100644
index 0000000000000000000000000000000000000000..9909364aabcf5ad3c4e27c59ffade13abe446477
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
@@ -0,0 +1,47 @@
+#name: ARM V8-M mainline with DSP instructions (base)
+#source: archv8m.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> 47a0      	blx	r4
+0+.* <[^>]*> 47c8      	blx	r9
+0+.* <[^>]*> 4720      	bx	r4
+0+.* <[^>]*> 4748      	bx	r9
+0+.* <[^>]*> e841 f000 	tt	r0, r1
+0+.* <[^>]*> e849 f800 	tt	r8, r9
+0+.* <[^>]*> e841 f040 	ttt	r0, r1
+0+.* <[^>]*> e849 f840 	ttt	r8, r9
+0+.* <[^>]*> f24f 1023 	movw	r0, #61731	; 0xf123
+0+.* <[^>]*> f24f 1823 	movw	r8, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1023 	movt	r0, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1823 	movt	r8, #61731	; 0xf123
+0+.* <[^>]*> b154      	cbz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> b94c      	cbnz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> f000 b808 	b.w	0+.* <[^>]*>
+0+.* <[^>]*> fb91 f0f2 	sdiv	r0, r1, r2
+0+.* <[^>]*> fb99 f8fa 	sdiv	r8, r9, sl
+0+.* <[^>]*> fbb1 f0f2 	udiv	r0, r1, r2
+0+.* <[^>]*> fbb9 f8fa 	udiv	r8, r9, sl
+0+.* <[^>]*> 4408      	add	r0, r1
+0+.* <[^>]*> f3bf 8f2f 	clrex
+0+.* <[^>]*> e851 0f01 	ldrex	r0, \[r1, #4\]
+0+.* <[^>]*> e8d1 0f4f 	ldrexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f5f 	ldrexh	r0, \[r1\]
+0+.* <[^>]*> e842 1001 	strex	r0, r1, \[r2, #4\]
+0+.* <[^>]*> e8c2 1f40 	strexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1f50 	strexh	r0, r1, \[r2\]
+0+.* <[^>]*> e8d1 0faf 	lda	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f8f 	ldab	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f9f 	ldah	r0, \[r1\]
+0+.* <[^>]*> e8c1 0faf 	stl	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f8f 	stlb	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f9f 	stlh	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fef 	ldaex	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fcf 	ldaexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fdf 	ldaexh	r0, \[r1\]
+0+.* <[^>]*> e8c2 1fe0 	stlex	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fc0 	stlexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fd0 	stlexh	r0, r1, \[r2\]
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-2.d b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
new file mode 100644
index 0000000000000000000000000000000000000000..3e42b0666a64972c11689e678545a34943b1a1e7
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
@@ -0,0 +1,17 @@
+#name: ARM V8-M mainline with DSP instructions (security extensions)
+#source: archv8m-cmse.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> e97f e97f 	sg
+0+.* <[^>]*> 47a4      	blxns	r4
+0+.* <[^>]*> 47cc      	blxns	r9
+0+.* <[^>]*> 4724      	bxns	r4
+0+.* <[^>]*> 474c      	bxns	r9
+0+.* <[^>]*> e841 f080 	tta	r0, r1
+0+.* <[^>]*> e849 f880 	tta	r8, r9
+0+.* <[^>]*> e841 f0c0 	ttat	r0, r1
+0+.* <[^>]*> e849 f8c0 	ttat	r8, r9
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-3.d b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
new file mode 100644
index 0000000000000000000000000000000000000000..92e20903671e3d80e78d48ac5ececa5ca125fe04
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
@@ -0,0 +1,140 @@
+#name: ARM V8-M mainline with DSP instructions (extension)
+#source: arch7em.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> eac0 0000 	pkhbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> eac0 0900 	pkhbt	r9, r0, r0
+0[0-9a-f]+ <[^>]+> eac9 0000 	pkhbt	r0, r9, r0
+0[0-9a-f]+ <[^>]+> eac0 0009 	pkhbt	r0, r0, r9
+0[0-9a-f]+ <[^>]+> eac0 5000 	pkhbt	r0, r0, r0, lsl #20
+0[0-9a-f]+ <[^>]+> eac0 00c0 	pkhbt	r0, r0, r0, lsl #3
+0[0-9a-f]+ <[^>]+> eac3 0102 	pkhbt	r1, r3, r2
+0[0-9a-f]+ <[^>]+> eac2 4163 	pkhtb	r1, r2, r3, asr #17
+0[0-9a-f]+ <[^>]+> fa83 f182 	qadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f113 	qadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f113 	qadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f192 	qdadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1b2 	qdsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1a2 	qsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f113 	qsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f113 	qsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f103 	sadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f103 	sadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f103 	ssub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f103 	ssub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f123 	shadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f123 	shadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f123 	shsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f123 	shsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f143 	uadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f143 	uadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f143 	usub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f143 	usub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f163 	uhadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f163 	uhadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f163 	uhsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f163 	uhsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f153 	uqadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f153 	uqadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f153 	uqsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f153 	uqsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f183 	sel	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fb10 0000 	smlabb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0900 	smlabb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 0000 	smlabb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0009 	smlabb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 9000 	smlabb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 0020 	smlatb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0010 	smlabt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0030 	smlatt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0000 	smlawb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0010 	smlawt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0000 	smlad	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0010 	smladx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0000 	smlsd	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0010 	smlsdx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0000 	smmla	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0010 	smmlar	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0000 	smmls	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0010 	smmlsr	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 0000 	usada8	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0080 	smlalbb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 9080 	smlalbb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0980 	smlalbb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fbc9 0080 	smlalbb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fbc0 0089 	smlalbb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fbc0 00a0 	smlaltb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0090 	smlalbt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00b0 	smlaltt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00c0 	smlald	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00d0 	smlaldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00c0 	smlsld	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00d0 	smlsldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbe0 0060 	umaal	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f000 	smulbb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f900 	smulbb	r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 f000 	smulbb	r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 f009 	smulbb	r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 f020 	smultb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f010 	smulbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f030 	smultt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f000 	smulwb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f010 	smulwt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f000 	smmul	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f010 	smmulr	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f000 	smuad	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f010 	smuadx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f000 	smusd	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f010 	smusdx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 f000 	usad8	r0, r0, r0
+0[0-9a-f]+ <[^>]+> f320 0000 	ssat16	r0, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0900 	ssat16	r9, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0009 	ssat16	r0, #10, r0
+0[0-9a-f]+ <[^>]+> f329 0000 	ssat16	r0, #1, r9
+0[0-9a-f]+ <[^>]+> f3a0 0000 	usat16	r0, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0900 	usat16	r9, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0009 	usat16	r0, #9, r0
+0[0-9a-f]+ <[^>]+> f3a9 0000 	usat16	r0, #0, r9
+0[0-9a-f]+ <[^>]+> fa2f f182 	sxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa2f f889 	sxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa3f f182 	uxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa3f f889 	uxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f990 	sxtab	r9, r0, r0, ror #8
+0[0-9a-f]+ <[^>]+> fa49 f0a0 	sxtab	r0, r9, r0, ror #16
+0[0-9a-f]+ <[^>]+> fa40 f0b9 	sxtab	r0, r0, r9, ror #24
+0[0-9a-f]+ <[^>]+> fa22 f183 	sxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa02 f183 	sxtah	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa52 f183 	uxtab	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa32 f183 	uxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa12 f183 	uxtah	r1, r2, r3
diff --git a/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
new file mode 100644
index 0000000000000000000000000000000000000000..56600d3c2680c643bd2308fd97a25f99cfece1c0
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
@@ -0,0 +1,14 @@
+# name: attributes for -march=armv8-m.main+dsp
+# source: blank.s
+# as: -march=armv8-m.main+dsp
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/include/elf/arm.h b/include/elf/arm.h
index a240f19a19426edeb413d5ba856242491254bc47..c78d20150b5ca425fa8e8ba4bfeefcf903d80776 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -310,6 +310,7 @@ enum
   Tag_MPextension_use,
   Tag_undefined_43,
   Tag_DIV_use,
+  Tag_DSP_extension = 46,
   Tag_nodefaults = 64,
   Tag_also_compatible_with,
   Tag_T2EE_use,
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 20b9456eeffdf1ce1ec27cb0b31cc6f07d60abad..105344708a2e3246b15b5a2230aeae5ee6515ef8 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -385,6 +385,9 @@ set armeabitests_common {
      {"EABI attribute merging 10" "-r" "" "" {attr-merge-10a.s attr-merge-10b.s}
       {{readelf -A attr-merge-10.attr}}
       "attr-merge-10"}
+     {"EABI attribute merging 10 (DSP)" "-r" "" "" {attr-merge-10a.s attr-merge-10b-dsp.s}
+      {{readelf -A attr-merge-10-dsp.attr}}
+      "attr-merge-10-dsp"}
      {"EABI attribute arch merging 1" "-r" "" "" {arch-v6k.s arch-v6t2.s}
       {{readelf -A attr-merge-arch-1.attr}}
       "attr-merge-arch-1"}
diff --git a/ld/testsuite/ld-arm/attr-merge-10-dsp.attr b/ld/testsuite/ld-arm/attr-merge-10-dsp.attr
new file mode 100644
index 0000000000000000000000000000000000000000..7cdbd49cf9bac04a5226688fa7265b67ce175789
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10-dsp.attr
@@ -0,0 +1,7 @@
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/ld/testsuite/ld-arm/attr-merge-10b-dsp.s b/ld/testsuite/ld-arm/attr-merge-10b-dsp.s
new file mode 100644
index 0000000000000000000000000000000000000000..de67b36d9984c198a6eafc81b9bc729f858b9fe7
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10b-dsp.s
@@ -0,0 +1,6 @@
+	.arch armv8-m.main
+
+	@ Tag_CPU_arch & Tag_CPU_arch_profile = v8-M.MAIN
+	.eabi_attribute Tag_CPU_arch, 17
+	.eabi_attribute Tag_CPU_arch_profile, 'M'
+	.eabi_attribute Tag_DSP_extension, 1
diff --git a/ld/testsuite/ld-arm/attr-merge-4b.s b/ld/testsuite/ld-arm/attr-merge-4b.s
index 2cf68df2577e1401b20e990b4e25a507a0da13e0..1b371dab4ea636712d9a3de954da455bf912f8f1 100644
--- a/ld/testsuite/ld-arm/attr-merge-4b.s
+++ b/ld/testsuite/ld-arm/attr-merge-4b.s
@@ -2,6 +2,7 @@
 
 	@ Tag_CPU_arch = v6-M
 	.eabi_attribute Tag_CPU_arch, 11
+	.eabi_attribute Tag_CPU_arch_profile, 0x4D
 
 	@ Tag_also_compatible_with = v4T
 	.eabi_attribute Tag_also_compatible_with, "\006\002"


Best regards,

Thomas


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2015-12-23  7:05 ` Thomas Preud'homme
@ 2016-03-29 14:28   ` Thomas Preudhomme
  2016-03-30 15:27     ` Nick Clifton
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Preudhomme @ 2016-03-29 14:28 UTC (permalink / raw)
  To: binutils

On Wednesday 23 December 2015 15:05:14 Thomas Preud'homme wrote:
> 
> The patch didn't apply cleanly anymore after the changes in patches 1/7 to
> 4/7. I've thus rebased it on top of the new versions. ChangeLog entries are
> unchanged.

Please see below for an update of this patch after the changes on the just 
sent 5/7 new version.


*** bfd/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        (elf32_arm_merge_eabi_attributes): Add merging logic for
        Tag_DSP_extension.


*** binutils/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * readelf.c (display_arm_attribute): Add output for Tag_DSP_extension.
        (arm_attr_public_tags): Define DSP_extension attribute.


*** gas/ChangeLog ***

2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
        instructions.
        (arm_extensions): Add dsp extension for ARMv8-M Mainline.
        (aeabi_set_public_attributes): Memorize the feature bits of the
        architecture selected for Tag_CPU_arch.  Use it to set
        Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
        (arm_convert_symbolic_attribute): Define Tag_DSP_extension.
        * testsuite/gas/arm/arch7em-bad.d: Rename to ...
        * testsuite/gas/arm/arch7em-bad-1.d: This.
        * testsuite/gas/arm/arch7em-bad-2.d: New file.
        * testsuite/gas/arm/arch7em-bad-3.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
        * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.


*** include/elf/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * arm.h (Tag_DSP_extension): Define.


*** ld/ChangeLog ***

2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New
        test.
        * testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
        * testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 
81ebf67a3af03d82e4c34a9ad5112f2dbe55fe55..30359b0068f65dc3da6aacdaea0e45f02c5fbfe4 
100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -12731,6 +12731,31 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd 
*obfd)
 		}
 	    }
 	  break;
+
+	case Tag_DSP_extension:
+	  /* No need to change output value if any of:
+	     - pre (<=) ARMv5T input architecture (do not have DSP)
+	     - M input profile not ARMv7E-M and do not have DSP.  */
+	  if (in_attr[Tag_CPU_arch].i <= 3
+	      || (in_attr[Tag_CPU_arch_profile].i == 'M'
+		  && in_attr[Tag_CPU_arch].i != 13
+		  && in_attr[i].i == 0))
+	    ; /* Do nothing.  */
+	  /* Output value should be 0 if DSP part of architecture, ie.
+	     - post (>=) ARMv5te architecture output
+	     - A, R or S profile output or ARMv7E-M output architecture.  */
+	  else if (out_attr[Tag_CPU_arch].i >= 4
+		   && (out_attr[Tag_CPU_arch_profile].i == 'A'
+		       || out_attr[Tag_CPU_arch_profile].i == 'R'
+		       || out_attr[Tag_CPU_arch_profile].i == 'S'
+		       || out_attr[Tag_CPU_arch].i == 13))
+	    out_attr[i].i = 0;
+	  /* Otherwise, DSP instructions are added and not part of output
+	     architecture.  */
+	  else
+	    out_attr[i].i = 1;
+	  break;
+
 	case Tag_FP_arch:
 	    {
 	      /* Tag_ABI_HardFP_use is handled along with Tag_FP_arch since
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 
b3a28a8d88d8ba69fa11f996b921f36c9349c65d..7e7e7889c6bc3af91643281b5595c995d54c5a8a 
100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12812,6 +12812,8 @@ static const char * arm_attr_tag_FP_HP_extension[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_ABI_FP_16bit_format[] =
   {"None", "IEEE 754", "Alternative Format"};
+static const char * arm_attr_tag_DSP_extension[] =
+  {"Follow architecture", "Allowed"};
 static const char * arm_attr_tag_MPextension_use[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_DIV_use[] =
@@ -12862,6 +12864,7 @@ static arm_attr_public_tag arm_attr_public_tags[] =
   LOOKUP(38, ABI_FP_16bit_format),
   LOOKUP(42, MPextension_use),
   LOOKUP(44, DIV_use),
+  LOOKUP(46, DSP_extension),
   {64, "nodefaults", 0, NULL},
   {65, "also_compatible_with", 0, NULL},
   LOOKUP(66, T2EE_use),
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 
b908a848a4620981d78c7bd92a45fb2af54bda28..7483212ce1e513c59c79b5a6b4cafc1748dc61f8 
100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -220,6 +220,9 @@ static const arm_feature_set arm_ext_v6t2_v8m =
 /* Instructions shared between ARMv8-A and ARMv8-M.  */
 static const arm_feature_set arm_ext_atomics =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_ATOMICS);
+/* DSP instructions Tag_DSP_extension refers to.  */
+static const arm_feature_set arm_ext_dsp =
+  ARM_FEATURE_CORE_LOW (ARM_EXT_V5E | ARM_EXT_V5ExP | ARM_EXT_V6_DSP);
 static const arm_feature_set arm_ext_v8_2 =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_2A);
 
@@ -25107,6 +25110,9 @@ static const struct arm_option_extension_value_table 
arm_extensions[] =
   ARM_EXT_OPT ("crypto", FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
 			 ARM_FEATURE_COPROC (FPU_CRYPTO_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
+  ARM_EXT_OPT ("dsp",	ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE (ARM_EXT_V7M, ARM_EXT2_V8M)),
   ARM_EXT_OPT ("fp",     FPU_ARCH_VFP_ARMV8, ARM_FEATURE_COPROC 
(FPU_VFP_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
   ARM_EXT_OPT2 ("idiv",	ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV | ARM_EXT_DIV),
@@ -25742,6 +25748,7 @@ aeabi_set_public_attributes (void)
   char profile;
   int virt_sec = 0;
   int fp16_optional = 0;
+  arm_feature_set arm_arch = ARM_ARCH_NONE;
   arm_feature_set flags;
   arm_feature_set tmp;
   arm_feature_set arm_arch_v8m_base = ARM_ARCH_V8M_BASE;
@@ -25781,6 +25788,7 @@ aeabi_set_public_attributes (void)
       if (ARM_CPU_HAS_FEATURE (tmp, p->flags))
 	{
 	  arch = p->val;
+	  arm_arch = p->flags;
 	  ARM_CLEAR_FEATURE (tmp, tmp, p->flags);
 	}
     }
@@ -25797,18 +25805,27 @@ aeabi_set_public_attributes (void)
       && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v7m)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v6_dsp))
-    arch = TAG_CPU_ARCH_V7E_M;
+    {
+      arch = TAG_CPU_ARCH_V7E_M;
+      arm_arch = (arm_feature_set) ARM_ARCH_V7EM;
+    }
 
   ARM_CLEAR_FEATURE (tmp, flags, arm_arch_v8m_base);
   if (arch == TAG_CPU_ARCH_V8M_BASE && ARM_CPU_HAS_FEATURE (tmp, 
arm_arch_any))
-    arch = TAG_CPU_ARCH_V8M_MAIN;
+    {
+      arch = TAG_CPU_ARCH_V8M_MAIN;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8M_MAIN;
+    }
 
   /* In cpu_arch_ver ARMv8-A is before ARMv8-M for atomics to be detected as
      coming from ARMv8-A.  However, since ARMv8-A has more instructions than
      ARMv8-M, -march=all must be detected as ARMv8-A.  */
   if (arch == TAG_CPU_ARCH_V8M_MAIN
       && ARM_FEATURE_CORE_EQUAL (selected_cpu, arm_arch_any))
-    arch = TAG_CPU_ARCH_V8;
+    {
+      arch = TAG_CPU_ARCH_V8;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8A;
+    }
 
   /* Tag_CPU_name.  */
   if (selected_cpu_name[0])
@@ -25846,6 +25863,17 @@ aeabi_set_public_attributes (void)
   if (profile != '\0')
     aeabi_set_attribute_int (Tag_CPU_arch_profile, profile);
 
+  /* Tag_DSP_extension.  */
+  if (ARM_CPU_HAS_FEATURE (flags, arm_ext_dsp))
+    {
+      arm_feature_set ext;
+
+      /* DSP instructions not in architecture.  */
+      ARM_CLEAR_FEATURE (ext, flags, arm_arch);
+      if (ARM_CPU_HAS_FEATURE (ext, arm_ext_dsp))
+	aeabi_set_attribute_int (Tag_DSP_extension, 1);
+    }
+
   /* Tag_ARM_ISA_use.  */
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v1)
       || arch == 0)
@@ -26239,6 +26267,7 @@ arm_convert_symbolic_attribute (const char *name)
       T (Tag_conformance),
       T (Tag_T2EE_use),
       T (Tag_Virtualization_use),
+      T (Tag_DSP_extension),
       /* We deliberately do not include Tag_MPextension_use_legacy.  */
 #undef T
     };
diff --git a/gas/testsuite/gas/arm/arch7em-bad-2.d 
b/gas/testsuite/gas/arm/arch7em-bad-2.d
new file mode 100644
index 
0000000000000000000000000000000000000000..2ca6a126e4cd82016c3403fc2dad2f9126bbbced
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-2.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M Mainline with DSP extension, invalid v8-M Baseline
+#as: -march=armv8-m.base
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad-3.d 
b/gas/testsuite/gas/arm/arch7em-bad-3.d
new file mode 100644
index 
0000000000000000000000000000000000000000..a513c2823cc4923da10da4c0bd2105c03676000e
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-3.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M Mainline with DSP extension, invalid v8-M Mainline
+#as: -march=armv8-m.main
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad.d 
b/gas/testsuite/gas/arm/arch7em-bad-1.d
similarity index 100%
rename from gas/testsuite/gas/arm/arch7em-bad.d
rename to gas/testsuite/gas/arm/arch7em-bad-1.d
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-1.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
new file mode 100644
index 
0000000000000000000000000000000000000000..ffd25610f3b1e642a815890108a8530250616a2e
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
@@ -0,0 +1,47 @@
+#name: ARMv8-M Mainline with DSP instructions (base)
+#source: archv8m.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> 47a0      	blx	r4
+0+.* <[^>]*> 47c8      	blx	r9
+0+.* <[^>]*> 4720      	bx	r4
+0+.* <[^>]*> 4748      	bx	r9
+0+.* <[^>]*> e841 f000 	tt	r0, r1
+0+.* <[^>]*> e849 f800 	tt	r8, r9
+0+.* <[^>]*> e841 f040 	ttt	r0, r1
+0+.* <[^>]*> e849 f840 	ttt	r8, r9
+0+.* <[^>]*> f24f 1023 	movw	r0, #61731	; 0xf123
+0+.* <[^>]*> f24f 1823 	movw	r8, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1023 	movt	r0, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1823 	movt	r8, #61731	; 0xf123
+0+.* <[^>]*> b154      	cbz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> b94c      	cbnz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> f000 b808 	b.w	0+.* <[^>]*>
+0+.* <[^>]*> fb91 f0f2 	sdiv	r0, r1, r2
+0+.* <[^>]*> fb99 f8fa 	sdiv	r8, r9, sl
+0+.* <[^>]*> fbb1 f0f2 	udiv	r0, r1, r2
+0+.* <[^>]*> fbb9 f8fa 	udiv	r8, r9, sl
+0+.* <[^>]*> 4408      	add	r0, r1
+0+.* <[^>]*> f3bf 8f2f 	clrex
+0+.* <[^>]*> e851 0f01 	ldrex	r0, \[r1, #4\]
+0+.* <[^>]*> e8d1 0f4f 	ldrexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f5f 	ldrexh	r0, \[r1\]
+0+.* <[^>]*> e842 1001 	strex	r0, r1, \[r2, #4\]
+0+.* <[^>]*> e8c2 1f40 	strexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1f50 	strexh	r0, r1, \[r2\]
+0+.* <[^>]*> e8d1 0faf 	lda	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f8f 	ldab	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f9f 	ldah	r0, \[r1\]
+0+.* <[^>]*> e8c1 0faf 	stl	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f8f 	stlb	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f9f 	stlh	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fef 	ldaex	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fcf 	ldaexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fdf 	ldaexh	r0, \[r1\]
+0+.* <[^>]*> e8c2 1fe0 	stlex	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fc0 	stlexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fd0 	stlexh	r0, r1, \[r2\]
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-2.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
new file mode 100644
index 
0000000000000000000000000000000000000000..8532551029a43223d40ae7c962d536ed3548ed79
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
@@ -0,0 +1,17 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 1)
+#source: archv8m-cmse.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> e97f e97f 	sg
+0+.* <[^>]*> 47a4      	blxns	r4
+0+.* <[^>]*> 47cc      	blxns	r9
+0+.* <[^>]*> 4724      	bxns	r4
+0+.* <[^>]*> 474c      	bxns	r9
+0+.* <[^>]*> e841 f080 	tta	r0, r1
+0+.* <[^>]*> e849 f880 	tta	r8, r9
+0+.* <[^>]*> e841 f0c0 	ttat	r0, r1
+0+.* <[^>]*> e849 f8c0 	ttat	r8, r9
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-3.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
new file mode 100644
index 
0000000000000000000000000000000000000000..7d0c74852b76965de7c96772ff003b79974d6b76
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
@@ -0,0 +1,10 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 2)
+#source: archv8m-cmse-main.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> ec31 0a00 	vlldm	r1
+0+.* <[^>]*> ec22 0a00 	vlstm	r2
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-4.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-4.d
new file mode 100644
index 
0000000000000000000000000000000000000000..5e07e9ea783147a5f1286b12f19b5c2e336f2bf9
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-4.d
@@ -0,0 +1,32 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 3)
+#source: archv8m-cmse-msr.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-5.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-5.d
new file mode 100644
index 
0000000000000000000000000000000000000000..0e7dfd2f20f0ce08ff50725cdb43ee34e5d0719d
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-5.d
@@ -0,0 +1,140 @@
+#name: ARMv8-M Mainline with DSP instructions (extension)
+#source: arch7em.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> eac0 0000 	pkhbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> eac0 0900 	pkhbt	r9, r0, r0
+0[0-9a-f]+ <[^>]+> eac9 0000 	pkhbt	r0, r9, r0
+0[0-9a-f]+ <[^>]+> eac0 0009 	pkhbt	r0, r0, r9
+0[0-9a-f]+ <[^>]+> eac0 5000 	pkhbt	r0, r0, r0, lsl #20
+0[0-9a-f]+ <[^>]+> eac0 00c0 	pkhbt	r0, r0, r0, lsl #3
+0[0-9a-f]+ <[^>]+> eac3 0102 	pkhbt	r1, r3, r2
+0[0-9a-f]+ <[^>]+> eac2 4163 	pkhtb	r1, r2, r3, asr #17
+0[0-9a-f]+ <[^>]+> fa83 f182 	qadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f113 	qadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f113 	qadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f192 	qdadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1b2 	qdsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1a2 	qsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f113 	qsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f113 	qsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f103 	sadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f103 	sadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f103 	ssub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f103 	ssub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f123 	shadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f123 	shadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f123 	shsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f123 	shsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f143 	uadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f143 	uadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f143 	usub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f143 	usub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f163 	uhadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f163 	uhadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f163 	uhsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f163 	uhsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f153 	uqadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f153 	uqadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f153 	uqsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f153 	uqsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f183 	sel	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fb10 0000 	smlabb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0900 	smlabb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 0000 	smlabb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0009 	smlabb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 9000 	smlabb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 0020 	smlatb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0010 	smlabt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0030 	smlatt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0000 	smlawb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0010 	smlawt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0000 	smlad	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0010 	smladx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0000 	smlsd	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0010 	smlsdx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0000 	smmla	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0010 	smmlar	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0000 	smmls	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0010 	smmlsr	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 0000 	usada8	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0080 	smlalbb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 9080 	smlalbb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0980 	smlalbb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fbc9 0080 	smlalbb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fbc0 0089 	smlalbb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fbc0 00a0 	smlaltb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0090 	smlalbt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00b0 	smlaltt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00c0 	smlald	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00d0 	smlaldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00c0 	smlsld	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00d0 	smlsldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbe0 0060 	umaal	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f000 	smulbb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f900 	smulbb	r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 f000 	smulbb	r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 f009 	smulbb	r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 f020 	smultb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f010 	smulbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f030 	smultt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f000 	smulwb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f010 	smulwt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f000 	smmul	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f010 	smmulr	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f000 	smuad	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f010 	smuadx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f000 	smusd	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f010 	smusdx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 f000 	usad8	r0, r0, r0
+0[0-9a-f]+ <[^>]+> f320 0000 	ssat16	r0, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0900 	ssat16	r9, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0009 	ssat16	r0, #10, r0
+0[0-9a-f]+ <[^>]+> f329 0000 	ssat16	r0, #1, r9
+0[0-9a-f]+ <[^>]+> f3a0 0000 	usat16	r0, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0900 	usat16	r9, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0009 	usat16	r0, #9, r0
+0[0-9a-f]+ <[^>]+> f3a9 0000 	usat16	r0, #0, r9
+0[0-9a-f]+ <[^>]+> fa2f f182 	sxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa2f f889 	sxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa3f f182 	uxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa3f f889 	uxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f990 	sxtab	r9, r0, r0, ror #8
+0[0-9a-f]+ <[^>]+> fa49 f0a0 	sxtab	r0, r9, r0, ror #16
+0[0-9a-f]+ <[^>]+> fa40 f0b9 	sxtab	r0, r0, r9, ror #24
+0[0-9a-f]+ <[^>]+> fa22 f183 	sxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa02 f183 	sxtah	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa52 f183 	uxtab	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa32 f183 	uxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa12 f183 	uxtah	r1, r2, r3
diff --git a/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d 
b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
new file mode 100644
index 
0000000000000000000000000000000000000000..56600d3c2680c643bd2308fd97a25f99cfece1c0
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
@@ -0,0 +1,14 @@
+# name: attributes for -march=armv8-m.main+dsp
+# source: blank.s
+# as: -march=armv8-m.main+dsp
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 
fa14bb8a9cb2bfd4ab82db5e754eab43bdce4d54..bd9fd8bcf540933cf99957e1c138b479a83958ca 
100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -311,6 +311,7 @@ enum
   Tag_MPextension_use,
   Tag_undefined_43,
   Tag_DIV_use,
+  Tag_DSP_extension = 46,
   Tag_nodefaults = 64,
   Tag_also_compatible_with,
   Tag_T2EE_use,
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 
258a3eacab5b2b184c6da225bb2eb5feb9bca29a..e2fa3b054cfe8ccbb3b93c21b7de9fd89bfb241f 
100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -413,6 +413,9 @@ set armeabitests_common {
      {"EABI attribute merging 10" "-r" "" "" {attr-merge-10a.s attr-
merge-10b.s}
       {{readelf -A attr-merge-10.attr}}
       "attr-merge-10"}
+     {"EABI attribute merging 10 (DSP)" "-r" "" "" {attr-merge-10a.s attr-
merge-10b-dsp.s}
+      {{readelf -A attr-merge-10-dsp.attr}}
+      "attr-merge-10-dsp"}
      {"EABI attribute arch merging 1" "-r" "" "" {arch-v6k.s arch-v6t2.s}
       {{readelf -A attr-merge-arch-1.attr}}
       "attr-merge-arch-1"}
diff --git a/ld/testsuite/ld-arm/attr-merge-10-dsp.attr b/ld/testsuite/ld-
arm/attr-merge-10-dsp.attr
new file mode 100644
index 
0000000000000000000000000000000000000000..7cdbd49cf9bac04a5226688fa7265b67ce175789
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10-dsp.attr
@@ -0,0 +1,7 @@
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/ld/testsuite/ld-arm/attr-merge-10b-dsp.s b/ld/testsuite/ld-
arm/attr-merge-10b-dsp.s
new file mode 100644
index 
0000000000000000000000000000000000000000..de67b36d9984c198a6eafc81b9bc729f858b9fe7
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10b-dsp.s
@@ -0,0 +1,6 @@
+	.arch armv8-m.main
+
+	@ Tag_CPU_arch & Tag_CPU_arch_profile = v8-M.MAIN
+	.eabi_attribute Tag_CPU_arch, 17
+	.eabi_attribute Tag_CPU_arch_profile, 'M'
+	.eabi_attribute Tag_DSP_extension, 1


Best regards,

Thomas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2016-03-29 14:28   ` Thomas Preudhomme
@ 2016-03-30 15:27     ` Nick Clifton
  2016-04-12 14:19       ` Thomas Preudhomme
  2016-05-05  9:44       ` Thomas Preudhomme
  0 siblings, 2 replies; 10+ messages in thread
From: Nick Clifton @ 2016-03-30 15:27 UTC (permalink / raw)
  To: Thomas Preudhomme, binutils

Hi Thomas,

> *** bfd/ChangeLog ***
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>          (elf32_arm_merge_eabi_attributes): Add merging logic for
>          Tag_DSP_extension.
> 
> 
> *** binutils/ChangeLog ***
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>          * readelf.c (display_arm_attribute): Add output for Tag_DSP_extension.
>          (arm_attr_public_tags): Define DSP_extension attribute.
> 
> 
> *** gas/ChangeLog ***
> 2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>          * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
>          instructions.
>          (arm_extensions): Add dsp extension for ARMv8-M Mainline.
>          (aeabi_set_public_attributes): Memorize the feature bits of the
>          architecture selected for Tag_CPU_arch.  Use it to set
>          Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
>          (arm_convert_symbolic_attribute): Define Tag_DSP_extension.
>          * testsuite/gas/arm/arch7em-bad.d: Rename to ...
>          * testsuite/gas/arm/arch7em-bad-1.d: This.
>          * testsuite/gas/arm/arch7em-bad-2.d: New file.
>          * testsuite/gas/arm/arch7em-bad-3.d: Likewise.
>          * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
>          * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
>          * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
>          * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
>          * testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
>          * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.
> 
> 
> *** include/elf/ChangeLog ***
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>          * arm.h (Tag_DSP_extension): Define.
> 
> 
> *** ld/ChangeLog ***
> 2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>          * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New
>          test.
>          * testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
>          * testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.
 
Approved - please apply - but ...

Please could you also add an entry to gas/NEWS mentioning the support for the new instructions.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2016-03-30 15:27     ` Nick Clifton
@ 2016-04-12 14:19       ` Thomas Preudhomme
  2016-04-12 15:14         ` Nick Clifton
  2016-05-05  9:44       ` Thomas Preudhomme
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Preudhomme @ 2016-04-12 14:19 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Wednesday 30 March 2016 16:26:56 Nick Clifton wrote:
> Hi Thomas,
> 
> > *** bfd/ChangeLog ***
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          (elf32_arm_merge_eabi_attributes): Add merging logic for
> >          Tag_DSP_extension.
> > 
> > *** binutils/ChangeLog ***
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * readelf.c (display_arm_attribute): Add output for
> >          Tag_DSP_extension.
> >          (arm_attr_public_tags): Define DSP_extension attribute.
> > 
> > *** gas/ChangeLog ***
> > 2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
> >          instructions.
> >          (arm_extensions): Add dsp extension for ARMv8-M Mainline.
> >          (aeabi_set_public_attributes): Memorize the feature bits of the
> >          architecture selected for Tag_CPU_arch.  Use it to set
> >          Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
> >          (arm_convert_symbolic_attribute): Define Tag_DSP_extension.
> >          * testsuite/gas/arm/arch7em-bad.d: Rename to ...
> >          * testsuite/gas/arm/arch7em-bad-1.d: This.
> >          * testsuite/gas/arm/arch7em-bad-2.d: New file.
> >          * testsuite/gas/arm/arch7em-bad-3.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
> >          * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.
> > 
> > *** include/elf/ChangeLog ***
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * arm.h (Tag_DSP_extension): Define.
> > 
> > *** ld/ChangeLog ***
> > 2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)):
> >          New
> >          test.
> >          * testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
> >          * testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.
> 
> Approved - please apply - but ...
> 
> Please could you also add an entry to gas/NEWS mentioning the support for
> the new instructions.

I'm a bit confused at the current content of gas/NEWS. It mentions twice 
"Changes in 2.26". Is the top one supposed to be 2.27? I'm not sure about it 
because it has been created on November 13th of last year.

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2016-04-12 14:19       ` Thomas Preudhomme
@ 2016-04-12 15:14         ` Nick Clifton
  2016-04-13  9:10           ` Thomas Preudhomme
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Clifton @ 2016-04-12 15:14 UTC (permalink / raw)
  To: Thomas Preudhomme; +Cc: binutils

Hi Thomas,

> I'm a bit confused at the current content of gas/NEWS. It mentions twice
> "Changes in 2.26".

It does ?  Are  you sure ?  The version I have here looks like this:

  -*- text -*-
  * ARC backend accepts .extInstruction, .extCondCode, .extAuxRegister, and

  [...]

  * Add assembly-time relaxation option for ARC cpus.

  Changes in 2.26:

  * Add a configure option --enable-compressed-debug-sections={all,gas} to
  [...]

Ie with only one mention of 2.26.



> Is the top one supposed to be 2.27?

Basically everything above the "Changes in 2.26" are changes that are going
to be in 2.27 once it is released.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2016-04-12 15:14         ` Nick Clifton
@ 2016-04-13  9:10           ` Thomas Preudhomme
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Preudhomme @ 2016-04-13  9:10 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Tuesday 12 April 2016 16:13:59 Nick Clifton wrote:
> Hi Thomas,
> 
> > I'm a bit confused at the current content of gas/NEWS. It mentions twice
> > "Changes in 2.26".
> 
> It does ?  Are  you sure ?  The version I have here looks like this:
> 
>   -*- text -*-
>   * ARC backend accepts .extInstruction, .extCondCode, .extAuxRegister, and
> 
>   [...]
> 
>   * Add assembly-time relaxation option for ARC cpus.
> 
>   Changes in 2.26:
> 
>   * Add a configure option --enable-compressed-debug-sections={all,gas} to
>   [...]
> 
> Ie with only one mention of 2.26.

I guess I was on a branch and watching it on a commit prior to 
ab71ce86464303fbe2e6cccd274e62451cc9c158

> 
> > Is the top one supposed to be 2.27?
> 
> Basically everything above the "Changes in 2.26" are changes that are going
> to be in 2.27 once it is released.

Yes I see that now. Sorry for the noise.

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2016-03-30 15:27     ` Nick Clifton
  2016-04-12 14:19       ` Thomas Preudhomme
@ 2016-05-05  9:44       ` Thomas Preudhomme
  2016-05-05 14:42         ` Nick Clifton
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Preudhomme @ 2016-05-05  9:44 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Wednesday 30 March 2016 16:26:56 Nick Clifton wrote:
> Hi Thomas,
> 
> > *** bfd/ChangeLog ***
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          (elf32_arm_merge_eabi_attributes): Add merging logic for
> >          Tag_DSP_extension.
> > 
> > *** binutils/ChangeLog ***
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * readelf.c (display_arm_attribute): Add output for
> >          Tag_DSP_extension.
> >          (arm_attr_public_tags): Define DSP_extension attribute.
> > 
> > *** gas/ChangeLog ***
> > 2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
> >          instructions.
> >          (arm_extensions): Add dsp extension for ARMv8-M Mainline.
> >          (aeabi_set_public_attributes): Memorize the feature bits of the
> >          architecture selected for Tag_CPU_arch.  Use it to set
> >          Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
> >          (arm_convert_symbolic_attribute): Define Tag_DSP_extension.
> >          * testsuite/gas/arm/arch7em-bad.d: Rename to ...
> >          * testsuite/gas/arm/arch7em-bad-1.d: This.
> >          * testsuite/gas/arm/arch7em-bad-2.d: New file.
> >          * testsuite/gas/arm/arch7em-bad-3.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
> >          * testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
> >          * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.
> > 
> > *** include/elf/ChangeLog ***
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * arm.h (Tag_DSP_extension): Define.
> > 
> > *** ld/ChangeLog ***
> > 2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >          * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)):
> >          New
> >          test.
> >          * testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
> >          * testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.
> 
> Approved - please apply - but ...
> 
> Please could you also add an entry to gas/NEWS mentioning the support for
> the new instructions.

Right, I also mentioned the ARMv8-M and ARMv8-M Security Extensions support. 
Let me know if you prefer that I add ARMv8-M and ARMv8-M Security Extensions 
in the 5/7 patch first and extend the entry to mention the DSP Extensions in 
this patch.

ChangeLog entries are now as follow:

*** bfd/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        (elf32_arm_merge_eabi_attributes): Add merging logic for
        Tag_DSP_extension.


*** binutils/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * readelf.c (display_arm_attribute): Add output for Tag_DSP_extension.
        (arm_attr_public_tags): Define DSP_extension attribute.


*** gas/ChangeLog ***

2016-04-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * NEWS: Document ARMv8-M and ARMv8-M Security and DSP Extensions.
        * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
        instructions.
        (arm_extensions): Add dsp extension for ARMv8-M Mainline.
        (aeabi_set_public_attributes): Memorize the feature bits of the
        architecture selected for Tag_CPU_arch.  Use it to set
        Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
        (arm_convert_symbolic_attribute): Define Tag_DSP_extension.
        * testsuite/gas/arm/arch7em-bad.d: Rename to ...
        * testsuite/gas/arm/arch7em-bad-1.d: This.
        * testsuite/gas/arm/arch7em-bad-2.d: New file.
        * testsuite/gas/arm/arch7em-bad-3.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
        * testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
        * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.


*** include/elf/ChangeLog ***

2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * arm.h (Tag_DSP_extension): Define.


*** ld/ChangeLog ***

2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New
        test.
        * testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
        * testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.


diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 
81ebf67a3af03d82e4c34a9ad5112f2dbe55fe55..30359b0068f65dc3da6aacdaea0e45f02c5fbfe4 
100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -12731,6 +12731,31 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd 
*obfd)
 		}
 	    }
 	  break;
+
+	case Tag_DSP_extension:
+	  /* No need to change output value if any of:
+	     - pre (<=) ARMv5T input architecture (do not have DSP)
+	     - M input profile not ARMv7E-M and do not have DSP.  */
+	  if (in_attr[Tag_CPU_arch].i <= 3
+	      || (in_attr[Tag_CPU_arch_profile].i == 'M'
+		  && in_attr[Tag_CPU_arch].i != 13
+		  && in_attr[i].i == 0))
+	    ; /* Do nothing.  */
+	  /* Output value should be 0 if DSP part of architecture, ie.
+	     - post (>=) ARMv5te architecture output
+	     - A, R or S profile output or ARMv7E-M output architecture.  */
+	  else if (out_attr[Tag_CPU_arch].i >= 4
+		   && (out_attr[Tag_CPU_arch_profile].i == 'A'
+		       || out_attr[Tag_CPU_arch_profile].i == 'R'
+		       || out_attr[Tag_CPU_arch_profile].i == 'S'
+		       || out_attr[Tag_CPU_arch].i == 13))
+	    out_attr[i].i = 0;
+	  /* Otherwise, DSP instructions are added and not part of output
+	     architecture.  */
+	  else
+	    out_attr[i].i = 1;
+	  break;
+
 	case Tag_FP_arch:
 	    {
 	      /* Tag_ABI_HardFP_use is handled along with Tag_FP_arch since
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 
9e7fb1e4ec4cd7c85d5c031af6ca32b93071827d..71e9e32dc14deeb1c4523827ab6222d119faf1b1 
100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12820,6 +12820,8 @@ static const char * arm_attr_tag_FP_HP_extension[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_ABI_FP_16bit_format[] =
   {"None", "IEEE 754", "Alternative Format"};
+static const char * arm_attr_tag_DSP_extension[] =
+  {"Follow architecture", "Allowed"};
 static const char * arm_attr_tag_MPextension_use[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_DIV_use[] =
@@ -12870,6 +12872,7 @@ static arm_attr_public_tag arm_attr_public_tags[] =
   LOOKUP(38, ABI_FP_16bit_format),
   LOOKUP(42, MPextension_use),
   LOOKUP(44, DIV_use),
+  LOOKUP(46, DSP_extension),
   {64, "nodefaults", 0, NULL},
   {65, "also_compatible_with", 0, NULL},
   LOOKUP(66, T2EE_use),
diff --git a/gas/NEWS b/gas/NEWS
index 
a627028de15653c9b8a5c0690eff41f4909258d0..7f6abe373f6160276cb3873a171d87fec3e4061f 
100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,4 +1,8 @@
 -*- text -*-
+* Support for the ARMv8-M architecture has been added to the ARM port.  
Support
+  for the ARMv8-M Security and DSP Extensions has also been added to the ARM
+  port.
+
 * Add a configure option --enable-elf-stt-common to decide whether ELF
   assembler should generate common symbols with the STT_COMMON type by
   default.  Default to no.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 
6cdb2241f84abc0f661fc968c4d1b3927b9520d8..3197acc177eebcfb73ccbd613ae8126942194d56 
100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -220,6 +220,9 @@ static const arm_feature_set arm_ext_v6t2_v8m =
 /* Instructions shared between ARMv8-A and ARMv8-M.  */
 static const arm_feature_set arm_ext_atomics =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_ATOMICS);
+/* DSP instructions Tag_DSP_extension refers to.  */
+static const arm_feature_set arm_ext_dsp =
+  ARM_FEATURE_CORE_LOW (ARM_EXT_V5E | ARM_EXT_V5ExP | ARM_EXT_V6_DSP);
 static const arm_feature_set arm_ext_v8_2 =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_2A);
 /* FP16 instructions.  */
@@ -25483,6 +25486,9 @@ static const struct arm_option_extension_value_table 
arm_extensions[] =
   ARM_EXT_OPT ("crypto", FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
 			 ARM_FEATURE_COPROC (FPU_CRYPTO_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
+  ARM_EXT_OPT ("dsp",	ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE (ARM_EXT_V7M, ARM_EXT2_V8M)),
   ARM_EXT_OPT ("fp",     FPU_ARCH_VFP_ARMV8, ARM_FEATURE_COPROC 
(FPU_VFP_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
   ARM_EXT_OPT ("fp16",  ARM_FEATURE_CORE_HIGH (ARM_EXT2_FP16_INST),
@@ -26120,6 +26126,7 @@ aeabi_set_public_attributes (void)
   char profile;
   int virt_sec = 0;
   int fp16_optional = 0;
+  arm_feature_set arm_arch = ARM_ARCH_NONE;
   arm_feature_set flags;
   arm_feature_set tmp;
   arm_feature_set arm_arch_v8m_base = ARM_ARCH_V8M_BASE;
@@ -26159,6 +26166,7 @@ aeabi_set_public_attributes (void)
       if (ARM_CPU_HAS_FEATURE (tmp, p->flags))
 	{
 	  arch = p->val;
+	  arm_arch = p->flags;
 	  ARM_CLEAR_FEATURE (tmp, tmp, p->flags);
 	}
     }
@@ -26175,18 +26183,27 @@ aeabi_set_public_attributes (void)
       && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v7m)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v6_dsp))
-    arch = TAG_CPU_ARCH_V7E_M;
+    {
+      arch = TAG_CPU_ARCH_V7E_M;
+      arm_arch = (arm_feature_set) ARM_ARCH_V7EM;
+    }
 
   ARM_CLEAR_FEATURE (tmp, flags, arm_arch_v8m_base);
   if (arch == TAG_CPU_ARCH_V8M_BASE && ARM_CPU_HAS_FEATURE (tmp, 
arm_arch_any))
-    arch = TAG_CPU_ARCH_V8M_MAIN;
+    {
+      arch = TAG_CPU_ARCH_V8M_MAIN;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8M_MAIN;
+    }
 
   /* In cpu_arch_ver ARMv8-A is before ARMv8-M for atomics to be detected as
      coming from ARMv8-A.  However, since ARMv8-A has more instructions than
      ARMv8-M, -march=all must be detected as ARMv8-A.  */
   if (arch == TAG_CPU_ARCH_V8M_MAIN
       && ARM_FEATURE_CORE_EQUAL (selected_cpu, arm_arch_any))
-    arch = TAG_CPU_ARCH_V8;
+    {
+      arch = TAG_CPU_ARCH_V8;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8A;
+    }
 
   /* Tag_CPU_name.  */
   if (selected_cpu_name[0])
@@ -26224,6 +26241,17 @@ aeabi_set_public_attributes (void)
   if (profile != '\0')
     aeabi_set_attribute_int (Tag_CPU_arch_profile, profile);
 
+  /* Tag_DSP_extension.  */
+  if (ARM_CPU_HAS_FEATURE (flags, arm_ext_dsp))
+    {
+      arm_feature_set ext;
+
+      /* DSP instructions not in architecture.  */
+      ARM_CLEAR_FEATURE (ext, flags, arm_arch);
+      if (ARM_CPU_HAS_FEATURE (ext, arm_ext_dsp))
+	aeabi_set_attribute_int (Tag_DSP_extension, 1);
+    }
+
   /* Tag_ARM_ISA_use.  */
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v1)
       || arch == 0)
@@ -26619,6 +26647,7 @@ arm_convert_symbolic_attribute (const char *name)
       T (Tag_conformance),
       T (Tag_T2EE_use),
       T (Tag_Virtualization_use),
+      T (Tag_DSP_extension),
       /* We deliberately do not include Tag_MPextension_use_legacy.  */
 #undef T
     };
diff --git a/gas/testsuite/gas/arm/arch7em-bad-2.d 
b/gas/testsuite/gas/arm/arch7em-bad-2.d
new file mode 100644
index 
0000000000000000000000000000000000000000..2ca6a126e4cd82016c3403fc2dad2f9126bbbced
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-2.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M Mainline with DSP extension, invalid v8-M Baseline
+#as: -march=armv8-m.base
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad-3.d 
b/gas/testsuite/gas/arm/arch7em-bad-3.d
new file mode 100644
index 
0000000000000000000000000000000000000000..a513c2823cc4923da10da4c0bd2105c03676000e
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-3.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M Mainline with DSP extension, invalid v8-M Mainline
+#as: -march=armv8-m.main
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad.d 
b/gas/testsuite/gas/arm/arch7em-bad-1.d
similarity index 100%
rename from gas/testsuite/gas/arm/arch7em-bad.d
rename to gas/testsuite/gas/arm/arch7em-bad-1.d
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-1.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
new file mode 100644
index 
0000000000000000000000000000000000000000..ffd25610f3b1e642a815890108a8530250616a2e
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
@@ -0,0 +1,47 @@
+#name: ARMv8-M Mainline with DSP instructions (base)
+#source: archv8m.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> 47a0      	blx	r4
+0+.* <[^>]*> 47c8      	blx	r9
+0+.* <[^>]*> 4720      	bx	r4
+0+.* <[^>]*> 4748      	bx	r9
+0+.* <[^>]*> e841 f000 	tt	r0, r1
+0+.* <[^>]*> e849 f800 	tt	r8, r9
+0+.* <[^>]*> e841 f040 	ttt	r0, r1
+0+.* <[^>]*> e849 f840 	ttt	r8, r9
+0+.* <[^>]*> f24f 1023 	movw	r0, #61731	; 0xf123
+0+.* <[^>]*> f24f 1823 	movw	r8, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1023 	movt	r0, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1823 	movt	r8, #61731	; 0xf123
+0+.* <[^>]*> b154      	cbz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> b94c      	cbnz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> f000 b808 	b.w	0+.* <[^>]*>
+0+.* <[^>]*> fb91 f0f2 	sdiv	r0, r1, r2
+0+.* <[^>]*> fb99 f8fa 	sdiv	r8, r9, sl
+0+.* <[^>]*> fbb1 f0f2 	udiv	r0, r1, r2
+0+.* <[^>]*> fbb9 f8fa 	udiv	r8, r9, sl
+0+.* <[^>]*> 4408      	add	r0, r1
+0+.* <[^>]*> f3bf 8f2f 	clrex
+0+.* <[^>]*> e851 0f01 	ldrex	r0, \[r1, #4\]
+0+.* <[^>]*> e8d1 0f4f 	ldrexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f5f 	ldrexh	r0, \[r1\]
+0+.* <[^>]*> e842 1001 	strex	r0, r1, \[r2, #4\]
+0+.* <[^>]*> e8c2 1f40 	strexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1f50 	strexh	r0, r1, \[r2\]
+0+.* <[^>]*> e8d1 0faf 	lda	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f8f 	ldab	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f9f 	ldah	r0, \[r1\]
+0+.* <[^>]*> e8c1 0faf 	stl	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f8f 	stlb	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f9f 	stlh	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fef 	ldaex	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fcf 	ldaexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fdf 	ldaexh	r0, \[r1\]
+0+.* <[^>]*> e8c2 1fe0 	stlex	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fc0 	stlexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fd0 	stlexh	r0, r1, \[r2\]
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-2.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
new file mode 100644
index 
0000000000000000000000000000000000000000..8532551029a43223d40ae7c962d536ed3548ed79
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
@@ -0,0 +1,17 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 1)
+#source: archv8m-cmse.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> e97f e97f 	sg
+0+.* <[^>]*> 47a4      	blxns	r4
+0+.* <[^>]*> 47cc      	blxns	r9
+0+.* <[^>]*> 4724      	bxns	r4
+0+.* <[^>]*> 474c      	bxns	r9
+0+.* <[^>]*> e841 f080 	tta	r0, r1
+0+.* <[^>]*> e849 f880 	tta	r8, r9
+0+.* <[^>]*> e841 f0c0 	ttat	r0, r1
+0+.* <[^>]*> e849 f8c0 	ttat	r8, r9
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-3.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
new file mode 100644
index 
0000000000000000000000000000000000000000..7d0c74852b76965de7c96772ff003b79974d6b76
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
@@ -0,0 +1,10 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 2)
+#source: archv8m-cmse-main.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> ec31 0a00 	vlldm	r1
+0+.* <[^>]*> ec22 0a00 	vlstm	r2
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-4.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-4.d
new file mode 100644
index 
0000000000000000000000000000000000000000..5e07e9ea783147a5f1286b12f19b5c2e336f2bf9
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-4.d
@@ -0,0 +1,32 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 3)
+#source: archv8m-cmse-msr.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-5.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-5.d
new file mode 100644
index 
0000000000000000000000000000000000000000..0e7dfd2f20f0ce08ff50725cdb43ee34e5d0719d
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-5.d
@@ -0,0 +1,140 @@
+#name: ARMv8-M Mainline with DSP instructions (extension)
+#source: arch7em.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> eac0 0000 	pkhbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> eac0 0900 	pkhbt	r9, r0, r0
+0[0-9a-f]+ <[^>]+> eac9 0000 	pkhbt	r0, r9, r0
+0[0-9a-f]+ <[^>]+> eac0 0009 	pkhbt	r0, r0, r9
+0[0-9a-f]+ <[^>]+> eac0 5000 	pkhbt	r0, r0, r0, lsl #20
+0[0-9a-f]+ <[^>]+> eac0 00c0 	pkhbt	r0, r0, r0, lsl #3
+0[0-9a-f]+ <[^>]+> eac3 0102 	pkhbt	r1, r3, r2
+0[0-9a-f]+ <[^>]+> eac2 4163 	pkhtb	r1, r2, r3, asr #17
+0[0-9a-f]+ <[^>]+> fa83 f182 	qadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f113 	qadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f113 	qadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f192 	qdadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1b2 	qdsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1a2 	qsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f113 	qsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f113 	qsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f103 	sadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f103 	sadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f103 	ssub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f103 	ssub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f123 	shadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f123 	shadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f123 	shsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f123 	shsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f143 	uadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f143 	uadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f143 	usub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f143 	usub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f163 	uhadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f163 	uhadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f163 	uhsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f163 	uhsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f153 	uqadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f153 	uqadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f153 	uqsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f153 	uqsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f183 	sel	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fb10 0000 	smlabb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0900 	smlabb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 0000 	smlabb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0009 	smlabb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 9000 	smlabb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 0020 	smlatb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0010 	smlabt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0030 	smlatt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0000 	smlawb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0010 	smlawt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0000 	smlad	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0010 	smladx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0000 	smlsd	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0010 	smlsdx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0000 	smmla	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0010 	smmlar	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0000 	smmls	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0010 	smmlsr	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 0000 	usada8	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0080 	smlalbb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 9080 	smlalbb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0980 	smlalbb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fbc9 0080 	smlalbb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fbc0 0089 	smlalbb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fbc0 00a0 	smlaltb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0090 	smlalbt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00b0 	smlaltt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00c0 	smlald	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00d0 	smlaldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00c0 	smlsld	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00d0 	smlsldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbe0 0060 	umaal	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f000 	smulbb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f900 	smulbb	r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 f000 	smulbb	r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 f009 	smulbb	r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 f020 	smultb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f010 	smulbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f030 	smultt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f000 	smulwb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f010 	smulwt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f000 	smmul	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f010 	smmulr	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f000 	smuad	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f010 	smuadx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f000 	smusd	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f010 	smusdx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 f000 	usad8	r0, r0, r0
+0[0-9a-f]+ <[^>]+> f320 0000 	ssat16	r0, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0900 	ssat16	r9, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0009 	ssat16	r0, #10, r0
+0[0-9a-f]+ <[^>]+> f329 0000 	ssat16	r0, #1, r9
+0[0-9a-f]+ <[^>]+> f3a0 0000 	usat16	r0, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0900 	usat16	r9, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0009 	usat16	r0, #9, r0
+0[0-9a-f]+ <[^>]+> f3a9 0000 	usat16	r0, #0, r9
+0[0-9a-f]+ <[^>]+> fa2f f182 	sxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa2f f889 	sxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa3f f182 	uxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa3f f889 	uxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f990 	sxtab	r9, r0, r0, ror #8
+0[0-9a-f]+ <[^>]+> fa49 f0a0 	sxtab	r0, r9, r0, ror #16
+0[0-9a-f]+ <[^>]+> fa40 f0b9 	sxtab	r0, r0, r9, ror #24
+0[0-9a-f]+ <[^>]+> fa22 f183 	sxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa02 f183 	sxtah	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa52 f183 	uxtab	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa32 f183 	uxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa12 f183 	uxtah	r1, r2, r3
diff --git a/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d 
b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
new file mode 100644
index 
0000000000000000000000000000000000000000..56600d3c2680c643bd2308fd97a25f99cfece1c0
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
@@ -0,0 +1,14 @@
+# name: attributes for -march=armv8-m.main+dsp
+# source: blank.s
+# as: -march=armv8-m.main+dsp
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 
fa14bb8a9cb2bfd4ab82db5e754eab43bdce4d54..bd9fd8bcf540933cf99957e1c138b479a83958ca 
100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -311,6 +311,7 @@ enum
   Tag_MPextension_use,
   Tag_undefined_43,
   Tag_DIV_use,
+  Tag_DSP_extension = 46,
   Tag_nodefaults = 64,
   Tag_also_compatible_with,
   Tag_T2EE_use,
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 
0af32c09e3d612326c557433db3a3a8e111bb6e6..2aec7959c3a2ee44618cb2752b23b3463bb1bcbc 
100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -407,6 +407,9 @@ set armeabitests_common {
      {"EABI attribute merging 10" "-r" "" "" {attr-merge-10a.s attr-
merge-10b.s}
       {{readelf -A attr-merge-10.attr}}
       "attr-merge-10"}
+     {"EABI attribute merging 10 (DSP)" "-r" "" "" {attr-merge-10a.s attr-
merge-10b-dsp.s}
+      {{readelf -A attr-merge-10-dsp.attr}}
+      "attr-merge-10-dsp"}
      {"EABI attribute arch merging 1" "-r" "" "" {arch-v6k.s arch-v6t2.s}
       {{readelf -A attr-merge-arch-1.attr}}
       "attr-merge-arch-1"}
diff --git a/ld/testsuite/ld-arm/attr-merge-10-dsp.attr b/ld/testsuite/ld-
arm/attr-merge-10-dsp.attr
new file mode 100644
index 
0000000000000000000000000000000000000000..7cdbd49cf9bac04a5226688fa7265b67ce175789
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10-dsp.attr
@@ -0,0 +1,7 @@
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/ld/testsuite/ld-arm/attr-merge-10b-dsp.s b/ld/testsuite/ld-
arm/attr-merge-10b-dsp.s
new file mode 100644
index 
0000000000000000000000000000000000000000..de67b36d9984c198a6eafc81b9bc729f858b9fe7
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10b-dsp.s
@@ -0,0 +1,6 @@
+	.arch armv8-m.main
+
+	@ Tag_CPU_arch & Tag_CPU_arch_profile = v8-M.MAIN
+	.eabi_attribute Tag_CPU_arch, 17
+	.eabi_attribute Tag_CPU_arch_profile, 'M'
+	.eabi_attribute Tag_DSP_extension, 1


Best regards,

Thomas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2016-05-05  9:44       ` Thomas Preudhomme
@ 2016-05-05 14:42         ` Nick Clifton
  2016-05-10 15:29           ` Thomas Preudhomme
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Clifton @ 2016-05-05 14:42 UTC (permalink / raw)
  To: Thomas Preudhomme; +Cc: binutils

Hi Thomas,

> *** bfd/ChangeLog ***
> 
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         (elf32_arm_merge_eabi_attributes): Add merging logic for
>         Tag_DSP_extension.
> 
> 
> *** binutils/ChangeLog ***
> 
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * readelf.c (display_arm_attribute): Add output for Tag_DSP_extension.
>         (arm_attr_public_tags): Define DSP_extension attribute.
> 
> 
> *** gas/ChangeLog ***
> 
> 2016-04-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * NEWS: Document ARMv8-M and ARMv8-M Security and DSP Extensions.
>         * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
>         instructions.
>         (arm_extensions): Add dsp extension for ARMv8-M Mainline.
>         (aeabi_set_public_attributes): Memorize the feature bits of the
>         architecture selected for Tag_CPU_arch.  Use it to set
>         Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
>         (arm_convert_symbolic_attribute): Define Tag_DSP_extension.
>         * testsuite/gas/arm/arch7em-bad.d: Rename to ...
>         * testsuite/gas/arm/arch7em-bad-1.d: This.
>         * testsuite/gas/arm/arch7em-bad-2.d: New file.
>         * testsuite/gas/arm/arch7em-bad-3.d: Likewise.
>         * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
>         * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
>         * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
>         * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
>         * testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
>         * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.
> 
> 
> *** include/elf/ChangeLog ***
> 
> 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * arm.h (Tag_DSP_extension): Define.
> 
> 
> *** ld/ChangeLog ***
> 
> 2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>         * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New
>         test.
>         * testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
>         * testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.
> 
 
Approved - please apply.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension
  2016-05-05 14:42         ` Nick Clifton
@ 2016-05-10 15:29           ` Thomas Preudhomme
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Preudhomme @ 2016-05-10 15:29 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

On Thursday 05 May 2016 15:41:54 Nick Clifton wrote:
> Hi Thomas,
> 
> > *** bfd/ChangeLog ***
> > 
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >         (elf32_arm_merge_eabi_attributes): Add merging logic for
> >         Tag_DSP_extension.
> > 
> > *** binutils/ChangeLog ***
> > 
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >         * readelf.c (display_arm_attribute): Add output for
> >         Tag_DSP_extension.
> >         (arm_attr_public_tags): Define DSP_extension attribute.
> > 
> > *** gas/ChangeLog ***
> > 
> > 2016-04-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >         * NEWS: Document ARMv8-M and ARMv8-M Security and DSP Extensions.
> >         * config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
> >         instructions.
> >         (arm_extensions): Add dsp extension for ARMv8-M Mainline.
> >         (aeabi_set_public_attributes): Memorize the feature bits of the
> >         architecture selected for Tag_CPU_arch.  Use it to set
> >         Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
> >         (arm_convert_symbolic_attribute): Define Tag_DSP_extension.
> >         * testsuite/gas/arm/arch7em-bad.d: Rename to ...
> >         * testsuite/gas/arm/arch7em-bad-1.d: This.
> >         * testsuite/gas/arm/arch7em-bad-2.d: New file.
> >         * testsuite/gas/arm/arch7em-bad-3.d: Likewise.
> >         * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
> >         * testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
> >         * testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
> >         * testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
> >         * testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
> >         * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.
> > 
> > *** include/elf/ChangeLog ***
> > 
> > 2015-11-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >         * arm.h (Tag_DSP_extension): Define.
> > 
> > *** ld/ChangeLog ***
> > 
> > 2016-03-07  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> > 
> >         * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)):
> >         New
> >         test.
> >         * testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
> >         * testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.
> 
> Approved - please apply.

I committed the following (rebased on more recent master branch with latest 
changes to gas/NEWS file):


diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 
d65837c1a0372076f2dd38bfd0ac82d3a5a8e92d..fa0d74fdc4777c5cfa00d34166fd57048b623baa 
100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -12737,6 +12737,31 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd 
*obfd)
 		}
 	    }
 	  break;
+
+	case Tag_DSP_extension:
+	  /* No need to change output value if any of:
+	     - pre (<=) ARMv5T input architecture (do not have DSP)
+	     - M input profile not ARMv7E-M and do not have DSP.  */
+	  if (in_attr[Tag_CPU_arch].i <= 3
+	      || (in_attr[Tag_CPU_arch_profile].i == 'M'
+		  && in_attr[Tag_CPU_arch].i != 13
+		  && in_attr[i].i == 0))
+	    ; /* Do nothing.  */
+	  /* Output value should be 0 if DSP part of architecture, ie.
+	     - post (>=) ARMv5te architecture output
+	     - A, R or S profile output or ARMv7E-M output architecture.  */
+	  else if (out_attr[Tag_CPU_arch].i >= 4
+		   && (out_attr[Tag_CPU_arch_profile].i == 'A'
+		       || out_attr[Tag_CPU_arch_profile].i == 'R'
+		       || out_attr[Tag_CPU_arch_profile].i == 'S'
+		       || out_attr[Tag_CPU_arch].i == 13))
+	    out_attr[i].i = 0;
+	  /* Otherwise, DSP instructions are added and not part of output
+	     architecture.  */
+	  else
+	    out_attr[i].i = 1;
+	  break;
+
 	case Tag_FP_arch:
 	    {
 	      /* Tag_ABI_HardFP_use is handled along with Tag_FP_arch since
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 
13e7751c8edd3fcfacaac8d54bcdb6e5447b7ae6..0935507b5877557c323b71d7d144b3806aa383e5 
100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12964,6 +12964,8 @@ static const char * arm_attr_tag_FP_HP_extension[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_ABI_FP_16bit_format[] =
   {"None", "IEEE 754", "Alternative Format"};
+static const char * arm_attr_tag_DSP_extension[] =
+  {"Follow architecture", "Allowed"};
 static const char * arm_attr_tag_MPextension_use[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_DIV_use[] =
@@ -13014,6 +13016,7 @@ static arm_attr_public_tag arm_attr_public_tags[] =
   LOOKUP(38, ABI_FP_16bit_format),
   LOOKUP(42, MPextension_use),
   LOOKUP(44, DIV_use),
+  LOOKUP(46, DSP_extension),
   {64, "nodefaults", 0, NULL},
   {65, "also_compatible_with", 0, NULL},
   LOOKUP(66, T2EE_use),
diff --git a/gas/NEWS b/gas/NEWS
index 
2f5e88daff988fe9d3d879dce71a9842225ccae4..a0990602826158b9fd1633220081a16f55e40ebf 
100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,4 +1,8 @@
 -*- text -*-
+* Support for the ARMv8-M architecture has been added to the ARM port.  
Support
+  for the ARMv8-M Security and DSP Extensions has also been added to the ARM
+  port.
+
 * ARC backend accepts .extInstruction, .extCondCode, .extAuxRegister, and
   .extCoreRegister pseudo-ops that allow an user to define custom
   instructions, conditional codes, auxiliary and core registers.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 
d4dee3f628a03f54d8911862e6fc07da22648e2b..e8619b67052dd3038bf29702d8b99e42e37f2cb9 
100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -220,6 +220,9 @@ static const arm_feature_set arm_ext_v6t2_v8m =
 /* Instructions shared between ARMv8-A and ARMv8-M.  */
 static const arm_feature_set arm_ext_atomics =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_ATOMICS);
+/* DSP instructions Tag_DSP_extension refers to.  */
+static const arm_feature_set arm_ext_dsp =
+  ARM_FEATURE_CORE_LOW (ARM_EXT_V5E | ARM_EXT_V5ExP | ARM_EXT_V6_DSP);
 static const arm_feature_set arm_ext_v8_2 =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_2A);
 /* FP16 instructions.  */
@@ -25487,6 +25490,9 @@ static const struct arm_option_extension_value_table 
arm_extensions[] =
   ARM_EXT_OPT ("crypto", FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
 			 ARM_FEATURE_COPROC (FPU_CRYPTO_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
+  ARM_EXT_OPT ("dsp",	ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+			ARM_FEATURE_CORE (ARM_EXT_V7M, ARM_EXT2_V8M)),
   ARM_EXT_OPT ("fp",     FPU_ARCH_VFP_ARMV8, ARM_FEATURE_COPROC 
(FPU_VFP_ARMV8),
 				   ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
   ARM_EXT_OPT ("fp16",  ARM_FEATURE_CORE_HIGH (ARM_EXT2_FP16_INST),
@@ -26124,6 +26130,7 @@ aeabi_set_public_attributes (void)
   char profile;
   int virt_sec = 0;
   int fp16_optional = 0;
+  arm_feature_set arm_arch = ARM_ARCH_NONE;
   arm_feature_set flags;
   arm_feature_set tmp;
   arm_feature_set arm_arch_v8m_base = ARM_ARCH_V8M_BASE;
@@ -26163,6 +26170,7 @@ aeabi_set_public_attributes (void)
       if (ARM_CPU_HAS_FEATURE (tmp, p->flags))
 	{
 	  arch = p->val;
+	  arm_arch = p->flags;
 	  ARM_CLEAR_FEATURE (tmp, tmp, p->flags);
 	}
     }
@@ -26179,18 +26187,27 @@ aeabi_set_public_attributes (void)
       && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v7m)
       && ARM_CPU_HAS_FEATURE (flags, arm_ext_v6_dsp))
-    arch = TAG_CPU_ARCH_V7E_M;
+    {
+      arch = TAG_CPU_ARCH_V7E_M;
+      arm_arch = (arm_feature_set) ARM_ARCH_V7EM;
+    }
 
   ARM_CLEAR_FEATURE (tmp, flags, arm_arch_v8m_base);
   if (arch == TAG_CPU_ARCH_V8M_BASE && ARM_CPU_HAS_FEATURE (tmp, 
arm_arch_any))
-    arch = TAG_CPU_ARCH_V8M_MAIN;
+    {
+      arch = TAG_CPU_ARCH_V8M_MAIN;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8M_MAIN;
+    }
 
   /* In cpu_arch_ver ARMv8-A is before ARMv8-M for atomics to be detected as
      coming from ARMv8-A.  However, since ARMv8-A has more instructions than
      ARMv8-M, -march=all must be detected as ARMv8-A.  */
   if (arch == TAG_CPU_ARCH_V8M_MAIN
       && ARM_FEATURE_CORE_EQUAL (selected_cpu, arm_arch_any))
-    arch = TAG_CPU_ARCH_V8;
+    {
+      arch = TAG_CPU_ARCH_V8;
+      arm_arch = (arm_feature_set) ARM_ARCH_V8A;
+    }
 
   /* Tag_CPU_name.  */
   if (selected_cpu_name[0])
@@ -26228,6 +26245,17 @@ aeabi_set_public_attributes (void)
   if (profile != '\0')
     aeabi_set_attribute_int (Tag_CPU_arch_profile, profile);
 
+  /* Tag_DSP_extension.  */
+  if (ARM_CPU_HAS_FEATURE (flags, arm_ext_dsp))
+    {
+      arm_feature_set ext;
+
+      /* DSP instructions not in architecture.  */
+      ARM_CLEAR_FEATURE (ext, flags, arm_arch);
+      if (ARM_CPU_HAS_FEATURE (ext, arm_ext_dsp))
+	aeabi_set_attribute_int (Tag_DSP_extension, 1);
+    }
+
   /* Tag_ARM_ISA_use.  */
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v1)
       || arch == 0)
@@ -26623,6 +26651,7 @@ arm_convert_symbolic_attribute (const char *name)
       T (Tag_conformance),
       T (Tag_T2EE_use),
       T (Tag_Virtualization_use),
+      T (Tag_DSP_extension),
       /* We deliberately do not include Tag_MPextension_use_legacy.  */
 #undef T
     };
diff --git a/gas/testsuite/gas/arm/arch7em-bad-2.d 
b/gas/testsuite/gas/arm/arch7em-bad-2.d
new file mode 100644
index 
0000000000000000000000000000000000000000..2ca6a126e4cd82016c3403fc2dad2f9126bbbced
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-2.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M Mainline with DSP extension, invalid v8-M Baseline
+#as: -march=armv8-m.base
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad-3.d 
b/gas/testsuite/gas/arm/arch7em-bad-3.d
new file mode 100644
index 
0000000000000000000000000000000000000000..a513c2823cc4923da10da4c0bd2105c03676000e
--- /dev/null
+++ b/gas/testsuite/gas/arm/arch7em-bad-3.d
@@ -0,0 +1,4 @@
+#name: Valid v8-M Mainline with DSP extension, invalid v8-M Mainline
+#as: -march=armv8-m.main
+#source: arch7em.s
+#error-output: arch7em-bad.l
diff --git a/gas/testsuite/gas/arm/arch7em-bad.d 
b/gas/testsuite/gas/arm/arch7em-bad-1.d
similarity index 100%
rename from gas/testsuite/gas/arm/arch7em-bad.d
rename to gas/testsuite/gas/arm/arch7em-bad-1.d
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-1.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
new file mode 100644
index 
0000000000000000000000000000000000000000..ffd25610f3b1e642a815890108a8530250616a2e
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-1.d
@@ -0,0 +1,47 @@
+#name: ARMv8-M Mainline with DSP instructions (base)
+#source: archv8m.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> 47a0      	blx	r4
+0+.* <[^>]*> 47c8      	blx	r9
+0+.* <[^>]*> 4720      	bx	r4
+0+.* <[^>]*> 4748      	bx	r9
+0+.* <[^>]*> e841 f000 	tt	r0, r1
+0+.* <[^>]*> e849 f800 	tt	r8, r9
+0+.* <[^>]*> e841 f040 	ttt	r0, r1
+0+.* <[^>]*> e849 f840 	ttt	r8, r9
+0+.* <[^>]*> f24f 1023 	movw	r0, #61731	; 0xf123
+0+.* <[^>]*> f24f 1823 	movw	r8, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1023 	movt	r0, #61731	; 0xf123
+0+.* <[^>]*> f2cf 1823 	movt	r8, #61731	; 0xf123
+0+.* <[^>]*> b154      	cbz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> b94c      	cbnz	r4, 0+.* <[^>]*>
+0+.* <[^>]*> f000 b808 	b.w	0+.* <[^>]*>
+0+.* <[^>]*> fb91 f0f2 	sdiv	r0, r1, r2
+0+.* <[^>]*> fb99 f8fa 	sdiv	r8, r9, sl
+0+.* <[^>]*> fbb1 f0f2 	udiv	r0, r1, r2
+0+.* <[^>]*> fbb9 f8fa 	udiv	r8, r9, sl
+0+.* <[^>]*> 4408      	add	r0, r1
+0+.* <[^>]*> f3bf 8f2f 	clrex
+0+.* <[^>]*> e851 0f01 	ldrex	r0, \[r1, #4\]
+0+.* <[^>]*> e8d1 0f4f 	ldrexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f5f 	ldrexh	r0, \[r1\]
+0+.* <[^>]*> e842 1001 	strex	r0, r1, \[r2, #4\]
+0+.* <[^>]*> e8c2 1f40 	strexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1f50 	strexh	r0, r1, \[r2\]
+0+.* <[^>]*> e8d1 0faf 	lda	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f8f 	ldab	r0, \[r1\]
+0+.* <[^>]*> e8d1 0f9f 	ldah	r0, \[r1\]
+0+.* <[^>]*> e8c1 0faf 	stl	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f8f 	stlb	r0, \[r1\]
+0+.* <[^>]*> e8c1 0f9f 	stlh	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fef 	ldaex	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fcf 	ldaexb	r0, \[r1\]
+0+.* <[^>]*> e8d1 0fdf 	ldaexh	r0, \[r1\]
+0+.* <[^>]*> e8c2 1fe0 	stlex	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fc0 	stlexb	r0, r1, \[r2\]
+0+.* <[^>]*> e8c2 1fd0 	stlexh	r0, r1, \[r2\]
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-2.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
new file mode 100644
index 
0000000000000000000000000000000000000000..8532551029a43223d40ae7c962d536ed3548ed79
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-2.d
@@ -0,0 +1,17 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 1)
+#source: archv8m-cmse.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> e97f e97f 	sg
+0+.* <[^>]*> 47a4      	blxns	r4
+0+.* <[^>]*> 47cc      	blxns	r9
+0+.* <[^>]*> 4724      	bxns	r4
+0+.* <[^>]*> 474c      	bxns	r9
+0+.* <[^>]*> e841 f080 	tta	r0, r1
+0+.* <[^>]*> e849 f880 	tta	r8, r9
+0+.* <[^>]*> e841 f0c0 	ttat	r0, r1
+0+.* <[^>]*> e849 f8c0 	ttat	r8, r9
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-3.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
new file mode 100644
index 
0000000000000000000000000000000000000000..7d0c74852b76965de7c96772ff003b79974d6b76
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-3.d
@@ -0,0 +1,10 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 2)
+#source: archv8m-cmse-main.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> ec31 0a00 	vlldm	r1
+0+.* <[^>]*> ec22 0a00 	vlstm	r2
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-4.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-4.d
new file mode 100644
index 
0000000000000000000000000000000000000000..5e07e9ea783147a5f1286b12f19b5c2e336f2bf9
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-4.d
@@ -0,0 +1,32 @@
+#name: ARMv8-M Mainline with DSP instructions (Security Extensions 3)
+#source: archv8m-cmse-msr.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8808 	msr	MSP, r0
+0+.* <[^>]*> f380 8888 	msr	MSP_NS, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8809 	msr	PSP, r0
+0+.* <[^>]*> f380 8889 	msr	PSP_NS, r0
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8008 	mrs	r0, MSP
+0+.* <[^>]*> f3ef 8088 	mrs	r0, MSP_NS
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8009 	mrs	r0, PSP
+0+.* <[^>]*> f3ef 8089 	mrs	r0, PSP_NS
diff --git a/gas/testsuite/gas/arm/archv8m-main-dsp-5.d 
b/gas/testsuite/gas/arm/archv8m-main-dsp-5.d
new file mode 100644
index 
0000000000000000000000000000000000000000..0e7dfd2f20f0ce08ff50725cdb43ee34e5d0719d
--- /dev/null
+++ b/gas/testsuite/gas/arm/archv8m-main-dsp-5.d
@@ -0,0 +1,140 @@
+#name: ARMv8-M Mainline with DSP instructions (extension)
+#source: arch7em.s
+#as: -march=armv8-m.main+dsp
+#objdump: -dr --prefix-addresses --show-raw-insn
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> eac0 0000 	pkhbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> eac0 0900 	pkhbt	r9, r0, r0
+0[0-9a-f]+ <[^>]+> eac9 0000 	pkhbt	r0, r9, r0
+0[0-9a-f]+ <[^>]+> eac0 0009 	pkhbt	r0, r0, r9
+0[0-9a-f]+ <[^>]+> eac0 5000 	pkhbt	r0, r0, r0, lsl #20
+0[0-9a-f]+ <[^>]+> eac0 00c0 	pkhbt	r0, r0, r0, lsl #3
+0[0-9a-f]+ <[^>]+> eac3 0102 	pkhbt	r1, r3, r2
+0[0-9a-f]+ <[^>]+> eac2 4163 	pkhtb	r1, r2, r3, asr #17
+0[0-9a-f]+ <[^>]+> fa83 f182 	qadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f113 	qadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f113 	qadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f113 	qasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f192 	qdadd	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1b2 	qdsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa83 f1a2 	qsub	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f113 	qsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f113 	qsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f113 	qsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f103 	sadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f103 	sadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f103 	sasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f103 	ssub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f103 	ssub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f103 	ssax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f123 	shadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f123 	shadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f123 	shasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f123 	shsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f123 	shsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f123 	shsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f143 	uadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f143 	uadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f143 	uasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f143 	usub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f143 	usub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f143 	usax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f163 	uhadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f163 	uhadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f163 	uhasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f163 	uhsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f163 	uhsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f163 	uhsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa92 f153 	uqadd16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa82 f153 	uqadd8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f153 	uqasx	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fad2 f153 	uqsub16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fac2 f153 	uqsub8	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fae2 f153 	uqsax	r1, r2, r3
+0[0-9a-f]+ <[^>]+> faa2 f183 	sel	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fb10 0000 	smlabb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0900 	smlabb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 0000 	smlabb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0009 	smlabb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 9000 	smlabb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 0020 	smlatb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0010 	smlabt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 0030 	smlatt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0000 	smlawb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 0010 	smlawt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0000 	smlad	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 0010 	smladx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0000 	smlsd	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 0010 	smlsdx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0000 	smmla	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 0010 	smmlar	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0000 	smmls	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb60 0010 	smmlsr	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 0000 	usada8	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0080 	smlalbb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 9080 	smlalbb	r9, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0980 	smlalbb	r0, r9, r0, r0
+0[0-9a-f]+ <[^>]+> fbc9 0080 	smlalbb	r0, r0, r9, r0
+0[0-9a-f]+ <[^>]+> fbc0 0089 	smlalbb	r0, r0, r0, r9
+0[0-9a-f]+ <[^>]+> fbc0 00a0 	smlaltb	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 0090 	smlalbt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00b0 	smlaltt	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00c0 	smlald	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbc0 00d0 	smlaldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00c0 	smlsld	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbd0 00d0 	smlsldx	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fbe0 0060 	umaal	r0, r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f000 	smulbb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f900 	smulbb	r9, r0, r0
+0[0-9a-f]+ <[^>]+> fb19 f000 	smulbb	r0, r9, r0
+0[0-9a-f]+ <[^>]+> fb10 f009 	smulbb	r0, r0, r9
+0[0-9a-f]+ <[^>]+> fb10 f020 	smultb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f010 	smulbt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb10 f030 	smultt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f000 	smulwb	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb30 f010 	smulwt	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f000 	smmul	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb50 f010 	smmulr	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f000 	smuad	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb20 f010 	smuadx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f000 	smusd	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb40 f010 	smusdx	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fb70 f000 	usad8	r0, r0, r0
+0[0-9a-f]+ <[^>]+> f320 0000 	ssat16	r0, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0900 	ssat16	r9, #1, r0
+0[0-9a-f]+ <[^>]+> f320 0009 	ssat16	r0, #10, r0
+0[0-9a-f]+ <[^>]+> f329 0000 	ssat16	r0, #1, r9
+0[0-9a-f]+ <[^>]+> f3a0 0000 	usat16	r0, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0900 	usat16	r9, #0, r0
+0[0-9a-f]+ <[^>]+> f3a0 0009 	usat16	r0, #9, r0
+0[0-9a-f]+ <[^>]+> f3a9 0000 	usat16	r0, #0, r9
+0[0-9a-f]+ <[^>]+> fa2f f182 	sxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa2f f889 	sxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa3f f182 	uxtb16	r1, r2
+0[0-9a-f]+ <[^>]+> fa3f f889 	uxtb16	r8, r9
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f080 	sxtab	r0, r0, r0
+0[0-9a-f]+ <[^>]+> fa40 f990 	sxtab	r9, r0, r0, ror #8
+0[0-9a-f]+ <[^>]+> fa49 f0a0 	sxtab	r0, r9, r0, ror #16
+0[0-9a-f]+ <[^>]+> fa40 f0b9 	sxtab	r0, r0, r9, ror #24
+0[0-9a-f]+ <[^>]+> fa22 f183 	sxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa02 f183 	sxtah	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa52 f183 	uxtab	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa32 f183 	uxtab16	r1, r2, r3
+0[0-9a-f]+ <[^>]+> fa12 f183 	uxtah	r1, r2, r3
diff --git a/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d 
b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
new file mode 100644
index 
0000000000000000000000000000000000000000..56600d3c2680c643bd2308fd97a25f99cfece1c0
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8m.main.dsp.d
@@ -0,0 +1,14 @@
+# name: attributes for -march=armv8-m.main+dsp
+# source: blank.s
+# as: -march=armv8-m.main+dsp
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 
fa14bb8a9cb2bfd4ab82db5e754eab43bdce4d54..bd9fd8bcf540933cf99957e1c138b479a83958ca 
100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -311,6 +311,7 @@ enum
   Tag_MPextension_use,
   Tag_undefined_43,
   Tag_DIV_use,
+  Tag_DSP_extension = 46,
   Tag_nodefaults = 64,
   Tag_also_compatible_with,
   Tag_T2EE_use,
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 
fea70a18f41d73f12f1f1f55373527fb06640d42..f34ce5ff2e4c45f01800df116d8f407f2dd75862 
100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -411,6 +411,9 @@ set armeabitests_common {
      {"EABI attribute merging 10" "-r" "" "" {attr-merge-10a.s attr-
merge-10b.s}
       {{readelf -A attr-merge-10.attr}}
       "attr-merge-10"}
+     {"EABI attribute merging 10 (DSP)" "-r" "" "" {attr-merge-10a.s attr-
merge-10b-dsp.s}
+      {{readelf -A attr-merge-10-dsp.attr}}
+      "attr-merge-10-dsp"}
      {"EABI attribute arch merging 1" "-r" "" "" {arch-v6k.s arch-v6t2.s}
       {{readelf -A attr-merge-arch-1.attr}}
       "attr-merge-arch-1"}
diff --git a/ld/testsuite/ld-arm/attr-merge-10-dsp.attr b/ld/testsuite/ld-
arm/attr-merge-10-dsp.attr
new file mode 100644
index 
0000000000000000000000000000000000000000..7cdbd49cf9bac04a5226688fa7265b67ce175789
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10-dsp.attr
@@ -0,0 +1,7 @@
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "8-M.MAIN"
+  Tag_CPU_arch: v8-M.mainline
+  Tag_CPU_arch_profile: Microcontroller
+  Tag_THUMB_ISA_use: Yes
+  Tag_DSP_extension: Allowed
diff --git a/ld/testsuite/ld-arm/attr-merge-10b-dsp.s b/ld/testsuite/ld-
arm/attr-merge-10b-dsp.s
new file mode 100644
index 
0000000000000000000000000000000000000000..de67b36d9984c198a6eafc81b9bc729f858b9fe7
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-10b-dsp.s
@@ -0,0 +1,6 @@
+	.arch armv8-m.main
+
+	@ Tag_CPU_arch & Tag_CPU_arch_profile = v8-M.MAIN
+	.eabi_attribute Tag_CPU_arch, 17
+	.eabi_attribute Tag_CPU_arch_profile, 'M'
+	.eabi_attribute Tag_DSP_extension, 1


Best regards,

Thomas

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-05-10 15:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-17  2:56 [PATCH, ARM 7/7] Add support for ARMv8-M Mainline with DSP extension Thomas Preud'homme
2015-12-23  7:05 ` Thomas Preud'homme
2016-03-29 14:28   ` Thomas Preudhomme
2016-03-30 15:27     ` Nick Clifton
2016-04-12 14:19       ` Thomas Preudhomme
2016-04-12 15:14         ` Nick Clifton
2016-04-13  9:10           ` Thomas Preudhomme
2016-05-05  9:44       ` Thomas Preudhomme
2016-05-05 14:42         ` Nick Clifton
2016-05-10 15:29           ` Thomas Preudhomme

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).