Skip to content

Commit

Permalink
[ARM] Add ARMv8.2-A to TargetParser
Browse files Browse the repository at this point in the history
Add ARMv8.2-A to TargetParser, so that it can be used by the clang
command-line options and the .arch directive.

Most testing of this will be done in clang, checking that the
command-line options that this enables work.

Differential Revision: http://reviews.llvm.org/D15037



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254400 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ostannard committed Dec 1, 2015
1 parent f025ca3 commit 27fff2c
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/llvm/ADT/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class Triple {
enum SubArchType {
NoSubArch,

ARMSubArch_v8_2a,
ARMSubArch_v8_1a,
ARMSubArch_v8,
ARMSubArch_v7,
Expand Down
4 changes: 4 additions & 0 deletions include/llvm/Support/ARMTargetParser.def
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ ARM_ARCH("armv8-a", AK_ARMV8A, "8-A", "v8", ARMBuildAttrs::CPUArch::v8,
ARM_ARCH("armv8.1-a", AK_ARMV8_1A, "8.1-A", "v8.1a", ARMBuildAttrs::CPUArch::v8,
FK_CRYPTO_NEON_FP_ARMV8, (AEK_SEC | AEK_MP | AEK_VIRT | AEK_HWDIVARM |
AEK_HWDIV | AEK_DSP | AEK_CRC))
ARM_ARCH("armv8.2-a", AK_ARMV8_2A, "8.2-A", "v8.2a", ARMBuildAttrs::CPUArch::v8,
FK_CRYPTO_NEON_FP_ARMV8, (AEK_SEC | AEK_MP | AEK_VIRT | AEK_HWDIVARM |
AEK_HWDIV | AEK_DSP | AEK_CRC))
// Non-standard Arch names.
ARM_ARCH("iwmmxt", AK_IWMMXT, "iwmmxt", "", ARMBuildAttrs::CPUArch::v5TE,
FK_NONE, AEK_NONE)
Expand Down Expand Up @@ -115,6 +118,7 @@ ARM_ARCH_EXT_NAME("mp", AEK_MP, nullptr, nullptr)
ARM_ARCH_EXT_NAME("simd", AEK_SIMD, nullptr, nullptr)
ARM_ARCH_EXT_NAME("sec", AEK_SEC, nullptr, nullptr)
ARM_ARCH_EXT_NAME("virt", AEK_VIRT, nullptr, nullptr)
ARM_ARCH_EXT_NAME("fp16", AEK_FP16, "+fullfp16", "-fullfp16")
ARM_ARCH_EXT_NAME("os", AEK_OS, nullptr, nullptr)
ARM_ARCH_EXT_NAME("iwmmxt", AEK_IWMMXT, nullptr, nullptr)
ARM_ARCH_EXT_NAME("iwmmxt2", AEK_IWMMXT2, nullptr, nullptr)
Expand Down
1 change: 1 addition & 0 deletions include/llvm/Support/TargetParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ enum ArchExtKind : unsigned {
AEK_SEC = 0x100,
AEK_VIRT = 0x200,
AEK_DSP = 0x400,
AEK_FP16 = 0x800,
// Unsupported extensions.
AEK_OS = 0x8000000,
AEK_IWMMXT = 0x10000000,
Expand Down
3 changes: 3 additions & 0 deletions lib/Support/TargetParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ static StringRef getArchSynonym(StringRef Arch) {
.Case("v7em", "v7e-m")
.Cases("v8", "v8a", "aarch64", "arm64", "v8-a")
.Case("v8.1a", "v8.1-a")
.Case("v8.2a", "v8.2-a")
.Default(Arch);
}

Expand Down Expand Up @@ -554,6 +555,7 @@ unsigned llvm::ARM::parseArchProfile(StringRef Arch) {
case ARM::AK_ARMV7K:
case ARM::AK_ARMV8A:
case ARM::AK_ARMV8_1A:
case ARM::AK_ARMV8_2A:
return ARM::PK_A;
}
return ARM::PK_INVALID;
Expand Down Expand Up @@ -594,6 +596,7 @@ unsigned llvm::ARM::parseArchVersion(StringRef Arch) {
return 7;
case ARM::AK_ARMV8A:
case ARM::AK_ARMV8_1A:
case ARM::AK_ARMV8_2A:
return 8;
}
return 0;
Expand Down
2 changes: 2 additions & 0 deletions lib/Support/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ static Triple::SubArchType parseSubArch(StringRef SubArchName) {
return Triple::ARMSubArch_v8;
case ARM::AK_ARMV8_1A:
return Triple::ARMSubArch_v8_1a;
case ARM::AK_ARMV8_2A:
return Triple::ARMSubArch_v8_2a;
default:
return Triple::NoSubArch;
}
Expand Down
12 changes: 12 additions & 0 deletions lib/Target/ARM/ARM.td
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,18 @@ def ARMv81a : Architecture<"armv8.1-a", "ARMv81a", [HasV8_1aOps,
FeatureCrypto,
FeatureCRC]>;

def ARMv82a : Architecture<"armv8.2-a", "ARMv82a", [HasV8_2aOps,
FeatureAClass,
FeatureDB,
FeatureFPARMv8,
FeatureNEON,
FeatureDSP,
FeatureTrustZone,
FeatureMP,
FeatureVirtualization,
FeatureCrypto,
FeatureCRC]>;

// Aliases
def IWMMXT : Architecture<"iwmmxt", "ARMv5te", [ARMv5te]>;
def IWMMXT2 : Architecture<"iwmmxt2", "ARMv5te", [ARMv5te]>;
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/ARM/ARMSubtarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ARMSubtarget : public ARMGenSubtargetInfo {
enum ARMArchEnum {
ARMv2, ARMv2a, ARMv3, ARMv3m, ARMv4, ARMv4t, ARMv5, ARMv5t, ARMv5te,
ARMv5tej, ARMv6, ARMv6k, ARMv6kz, ARMv6t2, ARMv6m, ARMv6sm, ARMv7a, ARMv7r,
ARMv7m, ARMv7em, ARMv8a, ARMv81a
ARMv7m, ARMv7em, ARMv8a, ARMv81a, ARMv82a
};

/// ARMProcFamily - ARM processor family: Cortex-A8, Cortex-A9, and others.
Expand Down
1 change: 1 addition & 0 deletions lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9930,6 +9930,7 @@ static const struct {
{ ARM::AEK_SEC, Feature_HasV6K, {ARM::FeatureTrustZone} },
// FIXME: Only available in A-class, isel not predicated
{ ARM::AEK_VIRT, Feature_HasV7, {ARM::FeatureVirtualization} },
{ ARM::AEK_FP16, Feature_HasV8_2a, {ARM::FeatureFPARMv8, ARM::FeatureFullFP16} },
// FIXME: Unsupported extensions.
{ ARM::AEK_OS, Feature_None, {} },
{ ARM::AEK_IWMMXT, Feature_None, {} },
Expand Down
1 change: 1 addition & 0 deletions lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ void ARMTargetELFStreamer::emitArchDefaultAttributes() {

case ARM::AK_ARMV8A:
case ARM::AK_ARMV8_1A:
case ARM::AK_ARMV8_2A:
setAttributeItem(CPU_arch_profile, ApplicationProfile, false);
setAttributeItem(ARM_ISA_use, Allowed, false);
setAttributeItem(THUMB_ISA_use, AllowThumb32, false);
Expand Down
46 changes: 46 additions & 0 deletions test/MC/ARM/directive-arch-armv8.2-a.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@ Test the .arch directive for armv8.2-a

@ This test case will check the default .ARM.attributes value for the
@ armv8-a architecture.

@ RUN: llvm-mc -triple arm-eabi -filetype asm %s \
@ RUN: | FileCheck %s -check-prefix CHECK-ASM
@ RUN: llvm-mc -triple arm-eabi -filetype obj %s \
@ RUN: | llvm-readobj -arm-attributes | FileCheck %s -check-prefix CHECK-ATTR

.syntax unified
.arch armv8.2-a

@ CHECK-ASM: .arch armv8.2-a

@ CHECK-ATTR: FileAttributes {
@ CHECK-ATTR: Attribute {
@ CHECK-ATTR: TagName: CPU_name
@ CHECK-ATTR: Value: 8.2-A
@ CHECK-ATTR: }
@ CHECK-ATTR: Attribute {
@ CHECK-ATTR: TagName: CPU_arch
@ CHECK-ATTR: Description: ARM v8
@ CHECK-ATTR: }
@ CHECK-ATTR: Attribute {
@ CHECK-ATTR: TagName: CPU_arch_profile
@ CHECK-ATTR: Description: Application
@ CHECK-ATTR: }
@ CHECK-ATTR: Attribute {
@ CHECK-ATTR: TagName: ARM_ISA_use
@ CHECK-ATTR: Description: Permitted
@ CHECK-ATTR: }
@ CHECK-ATTR: Attribute {
@ CHECK-ATTR: TagName: THUMB_ISA_use
@ CHECK-ATTR: Description: Thumb-2
@ CHECK-ATTR: }
@ CHECK-ATTR: Attribute {
@ CHECK-ATTR: TagName: MPextension_use
@ CHECK-ATTR: Description: Permitted
@ CHECK-ATTR: }
@ CHECK-ATTR: Attribute {
@ CHECK-ATTR: TagName: Virtualization_use
@ CHECK-ATTR: Description: TrustZone + Virtualization Extensions
@ CHECK-ATTR: }
@ CHECK-ATTR: }

0 comments on commit 27fff2c

Please sign in to comment.