[llvm] r257885 - [ARM] Add DSP build attribute and extension targeting

Bradley Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 02:28:25 PST 2016


Author: brasmi01
Date: Fri Jan 15 04:28:25 2016
New Revision: 257885

URL: http://llvm.org/viewvc/llvm-project?rev=257885&view=rev
Log:
[ARM] Add DSP build attribute and extension targeting

Modified:
    llvm/trunk/include/llvm/Support/ARMBuildAttributes.h
    llvm/trunk/include/llvm/Support/ARMTargetParser.def
    llvm/trunk/lib/Support/ARMBuildAttrs.cpp
    llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
    llvm/trunk/test/CodeGen/ARM/build-attributes-encoding.s
    llvm/trunk/test/CodeGen/ARM/build-attributes.ll
    llvm/trunk/test/MC/ARM/directive-eabi_attribute.s
    llvm/trunk/test/MC/ARM/thumbv8m.s
    llvm/trunk/test/tools/llvm-readobj/ARM/attribute-0.s
    llvm/trunk/test/tools/llvm-readobj/ARM/attribute-1.s
    llvm/trunk/tools/llvm-readobj/ARMAttributeParser.cpp
    llvm/trunk/tools/llvm-readobj/ARMAttributeParser.h

Modified: llvm/trunk/include/llvm/Support/ARMBuildAttributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ARMBuildAttributes.h?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ARMBuildAttributes.h (original)
+++ llvm/trunk/include/llvm/Support/ARMBuildAttributes.h Fri Jan 15 04:28:25 2016
@@ -67,6 +67,7 @@ enum AttrType {
   ABI_FP_16bit_format       = 38,
   MPextension_use           = 42, // recoded from 70 (ABI r2.08)
   DIV_use                   = 44,
+  DSP_extension             = 46,
   also_compatible_with      = 65,
   conformance               = 67,
   Virtualization_use        = 68,

Modified: llvm/trunk/include/llvm/Support/ARMTargetParser.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ARMTargetParser.def?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ARMTargetParser.def (original)
+++ llvm/trunk/include/llvm/Support/ARMTargetParser.def Fri Jan 15 04:28:25 2016
@@ -116,6 +116,7 @@ ARM_ARCH_EXT_NAME("invalid",  AEK_INVALI
 ARM_ARCH_EXT_NAME("none",     AEK_NONE,     nullptr,  nullptr)
 ARM_ARCH_EXT_NAME("crc",      AEK_CRC,      "+crc",   "-crc")
 ARM_ARCH_EXT_NAME("crypto",   AEK_CRYPTO,   "+crypto","-crypto")
+ARM_ARCH_EXT_NAME("dsp",      AEK_DSP,      "+dsp",   "-dsp")
 ARM_ARCH_EXT_NAME("fp",       AEK_FP,       nullptr,  nullptr)
 ARM_ARCH_EXT_NAME("idiv",     (AEK_HWDIVARM | AEK_HWDIV), nullptr, nullptr)
 ARM_ARCH_EXT_NAME("mp",       AEK_MP,       nullptr,  nullptr)

Modified: llvm/trunk/lib/Support/ARMBuildAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ARMBuildAttrs.cpp?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ARMBuildAttrs.cpp (original)
+++ llvm/trunk/lib/Support/ARMBuildAttrs.cpp Fri Jan 15 04:28:25 2016
@@ -54,6 +54,7 @@ const struct {
   { ARMBuildAttrs::ABI_FP_16bit_format, "Tag_ABI_FP_16bit_format" },
   { ARMBuildAttrs::MPextension_use, "Tag_MPextension_use" },
   { ARMBuildAttrs::DIV_use, "Tag_DIV_use" },
+  { ARMBuildAttrs::DSP_extension, "Tag_DSP_extension" },
   { ARMBuildAttrs::nodefaults, "Tag_nodefaults" },
   { ARMBuildAttrs::also_compatible_with, "Tag_also_compatible_with" },
   { ARMBuildAttrs::T2EE_use, "Tag_T2EE_use" },

Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Fri Jan 15 04:28:25 2016
@@ -807,6 +807,9 @@ void ARMAsmPrinter::emitAttributes() {
   if (STI.hasDivideInARMMode() && !STI.hasV8Ops())
     ATS.emitAttribute(ARMBuildAttrs::DIV_use, ARMBuildAttrs::AllowDIVExt);
 
+  if (STI.hasDSP() && isV8M(&STI))
+    ATS.emitAttribute(ARMBuildAttrs::DSP_extension, ARMBuildAttrs::Allowed);
+
   if (MMI) {
     if (const Module *SourceModule = MMI->getModule()) {
       // ABI_PCS_wchar_t to indicate wchar_t width

Modified: llvm/trunk/test/CodeGen/ARM/build-attributes-encoding.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/build-attributes-encoding.s?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/build-attributes-encoding.s (original)
+++ llvm/trunk/test/CodeGen/ARM/build-attributes-encoding.s Fri Jan 15 04:28:25 2016
@@ -54,6 +54,9 @@
 // Tag_DIV_use (=44)
 .eabi_attribute 44, 2
 
+// Tag_DSP_extension (=46)
+.eabi_attribute 46, 1
+
 // Tag_Virtualization_use (=68)
 .eabi_attribute 68, 3
 
@@ -71,15 +74,15 @@
 // CHECK-NEXT:     ]
 // CHECK-NEXT:     Address: 0x0
 // CHECK-NEXT:     Offset: 0x34
-// CHECK-NEXT:     Size: 71
+// CHECK-NEXT:     Size: 73
 // CHECK-NEXT:     Link: 0
 // CHECK-NEXT:     Info: 0
 // CHECK-NEXT:     AddressAlignment: 1
 // CHECK-NEXT:     EntrySize: 0
 // CHECK-NEXT:     SectionData (
-// CHECK-NEXT:       0000: 41460000 00616561 62690001 3C000000
+// CHECK-NEXT:       0000: 41480000 00616561 62690001 3E000000
 // CHECK-NEXT:       0010: 05636F72 7465782D 61380006 0A074108
 // CHECK-NEXT:       0020: 0109020A 030C0214 01150117 01180119
-// CHECK-NEXT:       0030: 011B001C 0124012A 012C0244 036EA001
-// CHECK-NEXT:       0040: 81013100 FA0101
+// CHECK-NEXT:       0030: 011B001C 0124012A 012C022E 0144036E
+// CHECK-NEXT:       0040: A0018101 3100FA01 01
 // CHECK-NEXT:     )

Modified: llvm/trunk/test/CodeGen/ARM/build-attributes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/build-attributes.ll?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/build-attributes.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/build-attributes.ll Fri Jan 15 04:28:25 2016
@@ -29,6 +29,7 @@
 ; RUN: llc < %s -mtriple=armv8-linux-gnueabi | FileCheck %s --check-prefix=V8-FPARMv8-NEON-CRYPTO
 ; RUN: llc < %s -mtriple=thumbv8m.base-linux-gnueabi | FileCheck %s --check-prefix=V8MBASELINE
 ; RUN: llc < %s -mtriple=thumbv8m.main-linux-gnueabi | FileCheck %s --check-prefix=V8MMAINLINE
+; RUN: llc < %s -mtriple=thumbv8m.main-linux-gnueabi -mattr=+dsp | FileCheck %s --check-prefix=V8MMAINLINE_DSP
 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a5 | FileCheck %s --check-prefix=CORTEX-A5-DEFAULT
 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a5  -enable-unsafe-fp-math -disable-fp-elim -enable-no-infs-fp-math -enable-no-nans-fp-math -fp-contract=fast | FileCheck %s --check-prefix=CORTEX-A5-DEFAULT-FAST
 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a5 -enable-sign-dependent-rounding-fp-math | FileCheck %s --check-prefix=DYN-ROUNDING
@@ -391,6 +392,14 @@
 ; V8MMAINLINE: .eabi_attribute 7, 77
 ; V8MMAINLINE: .eabi_attribute 8, 0
 ; V8MMAINLINE: .eabi_attribute 9, 3
+; V8MMAINLINE_DSP-NOT: .eabi_attribute 46
+
+; V8MMAINLINE_DSP: .syntax unified
+; V8MBASELINE_DSP: .eabi_attribute 6, 17
+; V8MBASELINE_DSP: .eabi_attribute 7, 77
+; V8MMAINLINE_DSP: .eabi_attribute 8, 0
+; V8MMAINLINE_DSP: .eabi_attribute 9, 3
+; V8MMAINLINE_DSP: .eabi_attribute 46, 1
 
 ; Tag_CPU_unaligned_access
 ; NO-STRICT-ALIGN: .eabi_attribute 34, 1
@@ -481,6 +490,9 @@
 ; CORTEX-A7-NOFPU: .eabi_attribute      44, 2
 ; CORTEX-A7-FPUV4: .eabi_attribute      44, 2
 
+; Tag_DSP_extension
+; CORTEX-A7-CHECK-NOT: .eabi_attribute      46
+
 ; Tag_Virtualization_use
 ; CORTEX-A7-CHECK: .eabi_attribute      68, 3
 ; CORTEX-A7-NOFPU: .eabi_attribute      68, 3

Modified: llvm/trunk/test/MC/ARM/directive-eabi_attribute.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/directive-eabi_attribute.s?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/directive-eabi_attribute.s (original)
+++ llvm/trunk/test/MC/ARM/directive-eabi_attribute.s Fri Jan 15 04:28:25 2016
@@ -209,6 +209,12 @@
 @ CHECK-OBJ-NEXT:   Value: 0
 @ CHECK-OBJ-NEXT:   TagName: DIV_use
 @ CHECK-OBJ-NEXT:   Description: If Available
+	.eabi_attribute Tag_DSP_extension, 0
+@ CHECK: .eabi_attribute 46, 0
+@ CHECK-OBJ:        Tag: 46
+@ CHECK-OBJ-NEXT:   Value: 0
+@ CHECK-OBJ-NEXT:   TagName: DSP_extension
+@ CHECK-OBJ-NEXT:   Description: Not Permitted
 	.eabi_attribute Tag_nodefaults, 0
 @ CHECK: .eabi_attribute 64, 0
 @ CHECK-OBJ:        Tag: 64

Modified: llvm/trunk/test/MC/ARM/thumbv8m.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumbv8m.s?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/thumbv8m.s (original)
+++ llvm/trunk/test/MC/ARM/thumbv8m.s Fri Jan 15 04:28:25 2016
@@ -4,16 +4,30 @@
 // RUN: not llvm-mc -triple=thumbv8m.main -show-encoding < %s 2>%t \
 // RUN:   | FileCheck --check-prefix=CHECK-MAINLINE --check-prefix=CHECK %s
 // RUN:     FileCheck --check-prefix=UNDEF-MAINLINE --check-prefix=UNDEF < %t %s
+// RUN: not llvm-mc -triple=thumbv8m.main -mattr=+dsp,+t2xtpk -show-encoding < %s 2>%t \
+// RUN:   | FileCheck --check-prefix=CHECK-MAINLINE_DSP --check-prefix=CHECK %s
+// RUN:     FileCheck --check-prefix=UNDEF-MAINLINE_DSP --check-prefix=UNDEF < %t %s
 
 // Simple check that baseline is v6M and mainline is v7M
 // UNDEF-BASELINE: error: instruction requires: thumb2
 // UNDEF-MAINLINE-NOT: error: instruction requires:
+// UNDEF-MAINLINE_DSP-NOT: error: instruction requires:
 mov.w r0, r0
 
 // Check that .arm is invalid
 // UNDEF: target does not support ARM mode
 .arm
 
+// And only +dsp,+t2xtpk has DSP and t2xtpk instructions
+// UNDEF-BASELINE: error: instruction requires: arm-mode
+// UNDEF-MAINLINE: error: instruction requires: arm-mode
+// UNDEF-MAINLINE_DSP-NOT: error: instruction requires:
+qadd16 r0, r0, r0
+// UNDEF-BASELINE: error: instruction requires: arm-mode
+// UNDEF-MAINLINE: error: instruction requires: arm-mode
+// UNDEF-MAINLINE_DSP-NOT: error: instruction requires:
+uxtab16 r0, r1, r2
+
 // Instruction availibility checks
 
 // 'Barrier instructions'
@@ -157,10 +171,12 @@ ttat r0, r1
 
 // UNDEF-BASELINE: error: instruction requires: armv8m.main
 // CHECK-MAINLINE: vlldm r5          @ encoding: [0x35,0xec,0x00,0x0a]
+// CHECK-MAINLINE_DSP: vlldm r5      @ encoding: [0x35,0xec,0x00,0x0a]
 vlldm r5
 
 // UNDEF-BASELINE: error: instruction requires: armv8m.main
 // CHECK-MAINLINE: vlstm r10         @ encoding: [0x2a,0xec,0x00,0x0a]
+// CHECK-MAINLINE_DSP: vlstm r10     @ encoding: [0x2a,0xec,0x00,0x0a]
 vlstm r10
 
 // New SYSm's

Modified: llvm/trunk/test/tools/llvm-readobj/ARM/attribute-0.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/ARM/attribute-0.s?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/ARM/attribute-0.s (original)
+++ llvm/trunk/test/tools/llvm-readobj/ARM/attribute-0.s Fri Jan 15 04:28:25 2016
@@ -225,6 +225,13 @@
 @CHECK-OBJ-NEXT: TagName: DIV_use
 @CHECK-OBJ-NEXT: Description: If Available
 
+.eabi_attribute  Tag_DSP_extension, 0
+ at CHECK:   .eabi_attribute 46, 0
+ at CHECK-OBJ: Tag: 46
+ at CHECK-OBJ-NEXT: Value: 0
+ at CHECK-OBJ-NEXT: TagName: DSP_extension
+ at CHECK-OBJ-NEXT: Description: Not Permitted
+
 .eabi_attribute  Tag_Virtualization_use, 0
 @CHECK:   .eabi_attribute 68, 0
 @CHECK-OBJ: Tag: 68

Modified: llvm/trunk/test/tools/llvm-readobj/ARM/attribute-1.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/ARM/attribute-1.s?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/ARM/attribute-1.s (original)
+++ llvm/trunk/test/tools/llvm-readobj/ARM/attribute-1.s Fri Jan 15 04:28:25 2016
@@ -211,6 +211,13 @@
 @CHECK-OBJ-NEXT: TagName: DIV_use
 @CHECK-OBJ-NEXT: Description: Not Permitted
 
+.eabi_attribute  Tag_DSP_extension, 1
+ at CHECK:   .eabi_attribute 46, 1
+ at CHECK-OBJ: Tag: 46
+ at CHECK-OBJ-NEXT: Value: 1
+ at CHECK-OBJ-NEXT: TagName: DSP_extension
+ at CHECK-OBJ-NEXT: Description: Permitted
+
 .eabi_attribute  Tag_Virtualization_use, 1
 @CHECK:   .eabi_attribute 68, 1
 @CHECK-OBJ: Tag: 68

Modified: llvm/trunk/tools/llvm-readobj/ARMAttributeParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMAttributeParser.cpp?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ARMAttributeParser.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ARMAttributeParser.cpp Fri Jan 15 04:28:25 2016
@@ -63,6 +63,7 @@ ARMAttributeParser::DisplayRoutines[] =
   ATTRIBUTE_HANDLER(ABI_FP_16bit_format),
   ATTRIBUTE_HANDLER(MPextension_use),
   ATTRIBUTE_HANDLER(DIV_use),
+  ATTRIBUTE_HANDLER(DSP_extension),
   ATTRIBUTE_HANDLER(T2EE_use),
   ATTRIBUTE_HANDLER(Virtualization_use),
   ATTRIBUTE_HANDLER(nodefaults)
@@ -513,6 +514,16 @@ void ARMAttributeParser::DIV_use(AttrTyp
 
   uint64_t Value = ParseInteger(Data, Offset);
   StringRef ValueDesc =
+    (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
+  PrintAttribute(Tag, Value, ValueDesc);
+}
+
+void ARMAttributeParser::DSP_extension(AttrType Tag, const uint8_t *Data,
+                                       uint32_t &Offset) {
+  static const char *const Strings[] = { "Not Permitted", "Permitted" };
+
+  uint64_t Value = ParseInteger(Data, Offset);
+  StringRef ValueDesc =
     (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
   PrintAttribute(Tag, Value, ValueDesc);
 }

Modified: llvm/trunk/tools/llvm-readobj/ARMAttributeParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMAttributeParser.h?rev=257885&r1=257884&r2=257885&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ARMAttributeParser.h (original)
+++ llvm/trunk/tools/llvm-readobj/ARMAttributeParser.h Fri Jan 15 04:28:25 2016
@@ -100,6 +100,8 @@ class ARMAttributeParser {
                        uint32_t &Offset);
   void DIV_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                uint32_t &Offset);
+  void DSP_extension(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
+                     uint32_t &Offset);
   void T2EE_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
                 uint32_t &Offset);
   void Virtualization_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,




More information about the llvm-commits mailing list