[ARM] Create objdump subtarget from build attrs

Enable an ELFObjectFile to read the its arm build attributes to
produce a target triple with a specific ARM architecture.
llvm-objdump now uses this functionality to automatically produce
a more accurate target.

Differential Revision: https://reviews.llvm.org/D28769

llvm-svn: 292366
diff --git a/llvm/test/tools/llvm-objdump/ARM/v5t-subarch.s b/llvm/test/tools/llvm-objdump/ARM/v5t-subarch.s
new file mode 100644
index 0000000..c9ce2cf
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ARM/v5t-subarch.s
@@ -0,0 +1,10 @@
+@ RUN: llvm-mc < %s -triple armv5t-elf -filetype=obj | llvm-objdump -triple=arm -d - | FileCheck %s
+
+.arch armv5t
+
+clz:
+clz r0, r1
+
+@ CHECK-LABEL: clz
+@ CHECK: 11 0f 6f e1
+
diff --git a/llvm/test/tools/llvm-objdump/ARM/v5te-subarch.s b/llvm/test/tools/llvm-objdump/ARM/v5te-subarch.s
new file mode 100644
index 0000000..87e8548
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ARM/v5te-subarch.s
@@ -0,0 +1,10 @@
+@ RUN: llvm-mc < %s -triple armv5te-elf -filetype=obj | llvm-objdump -triple=arm -d - | FileCheck %s
+
+.arch armv5te
+
+strd:
+strd r0, r1, [r2, +r3]
+
+@ CHECK-LABEL strd
+@ CHECK: f3 00 82 e1 strd r0, r1, [r2, r3]
+
diff --git a/llvm/test/tools/llvm-objdump/ARM/v5tej-subarch.s b/llvm/test/tools/llvm-objdump/ARM/v5tej-subarch.s
new file mode 100644
index 0000000..42dc873
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ARM/v5tej-subarch.s
@@ -0,0 +1,7 @@
+@ RUN: llvm-mc < %s -triple armv5tej-elf -filetype=obj | llvm-objdump -triple=arm -d - | FileCheck %s
+
+bxj:
+bxj r0
+
+@ CHECK-LABEL: bxj
+@ CHECK: 20 ff 2f e1 bxj r0
diff --git a/llvm/test/tools/llvm-objdump/ARM/v6-subarch.s b/llvm/test/tools/llvm-objdump/ARM/v6-subarch.s
new file mode 100644
index 0000000..c70761e
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ARM/v6-subarch.s
@@ -0,0 +1,9 @@
+@ RUN: llvm-mc < %s -triple armv6-elf -filetype=obj | llvm-objdump -triple=arm -d - | FileCheck %s
+
+.arch armv6
+
+umaal:
+umaal r0, r1, r2, r3
+
+@ CHECK-LABEL:umaal
+@ CHECK: 92 03 41 e0 umaal r0, r1, r2, r3
diff --git a/llvm/test/tools/llvm-objdump/ARM/v6k-subarch.s b/llvm/test/tools/llvm-objdump/ARM/v6k-subarch.s
new file mode 100644
index 0000000..8df4ce5
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ARM/v6k-subarch.s
@@ -0,0 +1,9 @@
+@ RUN: llvm-mc < %s -triple armv6k-elf -filetype=obj | llvm-objdump -triple=arm -d - | FileCheck %s
+
+.arch armv6k
+
+clrex:
+clrex
+
+@ CHECK-LABEL: clrex
+@ CHECK: 1f f0 7f f5 clrex
diff --git a/llvm/test/tools/llvm-objdump/ARM/v6m-subarch.s b/llvm/test/tools/llvm-objdump/ARM/v6m-subarch.s
new file mode 100644
index 0000000..f4c5698
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ARM/v6m-subarch.s
@@ -0,0 +1,9 @@
+@ RUN: llvm-mc < %s -triple armv6m-elf -filetype=obj | llvm-objdump -triple=thumb -d - | FileCheck %s
+
+.arch armv6m
+
+dmb:
+dmb
+
+@ CHECK-LABEL: dmb
+@ CHECK: bf f3 5f 8f dmb sy
diff --git a/llvm/test/tools/llvm-objdump/ARM/v6t2-subarch.s b/llvm/test/tools/llvm-objdump/ARM/v6t2-subarch.s
new file mode 100644
index 0000000..36e1343
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ARM/v6t2-subarch.s
@@ -0,0 +1,10 @@
+@ RUN: llvm-mc < %s -triple armv6t2-elf -filetype=obj | llvm-objdump -triple=thumb -d - | FileCheck %s
+
+.arch armv6t2
+
+.thumb
+umaalt2:
+umaal r0, r1, r2, r3
+
+@ CHECK-LABEL: umaalt2
+@ CHECK: e2 fb 63 01 umaal r0, r1, r2, r3
diff --git a/llvm/test/tools/llvm-objdump/ARM/v7m-subarch.s b/llvm/test/tools/llvm-objdump/ARM/v7m-subarch.s
new file mode 100644
index 0000000..8f6ff57
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ARM/v7m-subarch.s
@@ -0,0 +1,10 @@
+@ RUN: llvm-mc < %s -triple armv7m-elf -filetype=obj | llvm-objdump -triple=thumb -d - | FileCheck %s
+
+.arch armv7m
+
+umlal:
+umlal r0, r1, r2, r3
+
+@ CHECK-LABEL: umlal
+@ CHECK: e2 fb 03 01 umlal r0, r1, r2, r3
+