2016-03-06 05:50:55 +01:00
|
|
|
//===----------- TargetParser.cpp - Target Parser -------------------------===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-03-06 05:50:55 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-06-06 13:06:56 +02:00
|
|
|
#include "llvm/Support/TargetParser.h"
|
2016-07-28 08:11:18 +02:00
|
|
|
#include "llvm/ADT/STLExtras.h"
|
2020-12-17 11:52:37 +01:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2016-07-28 08:11:18 +02:00
|
|
|
#include "llvm/Support/ARMBuildAttributes.h"
|
2020-12-17 11:52:37 +01:00
|
|
|
#include "llvm/Support/FormatVariadic.h"
|
2016-07-28 08:11:18 +02:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include <string>
|
2016-03-06 05:50:55 +01:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
2016-07-28 08:11:18 +02:00
|
|
|
const char *ARMArch[] = {
|
2018-09-26 14:48:21 +02:00
|
|
|
"armv2", "armv2a", "armv3", "armv3m", "armv4",
|
|
|
|
"armv4t", "armv5", "armv5t", "armv5e", "armv5te",
|
|
|
|
"armv5tej", "armv6", "armv6j", "armv6k", "armv6hl",
|
|
|
|
"armv6t2", "armv6kz", "armv6z", "armv6zk", "armv6-m",
|
|
|
|
"armv6m", "armv6sm", "armv6s-m", "armv7-a", "armv7",
|
|
|
|
"armv7a", "armv7ve", "armv7hl", "armv7l", "armv7-r",
|
|
|
|
"armv7r", "armv7-m", "armv7m", "armv7k", "armv7s",
|
|
|
|
"armv7e-m", "armv7em", "armv8-a", "armv8", "armv8a",
|
|
|
|
"armv8l", "armv8.1-a", "armv8.1a", "armv8.2-a", "armv8.2a",
|
2018-09-26 15:09:15 +02:00
|
|
|
"armv8.3-a", "armv8.3a", "armv8.4-a", "armv8.4a", "armv8.5-a",
|
2020-12-09 17:13:36 +01:00
|
|
|
"armv8.5a", "armv8.6-a", "armv8.6a", "armv8.7-a", "armv8.7a",
|
|
|
|
"armv8-r", "armv8r", "armv8-m.base","armv8m.base", "armv8-m.main",
|
|
|
|
"armv8m.main", "iwmmxt", "iwmmxt2", "xscale", "armv8.1-m.main",
|
2018-09-26 14:48:21 +02:00
|
|
|
};
|
2016-12-06 03:22:08 +01:00
|
|
|
|
2020-12-17 11:52:37 +01:00
|
|
|
template <ARM::ISAKind ISAKind>
|
|
|
|
std::string FormatExtensionFlags(uint64_t Flags) {
|
|
|
|
std::vector<StringRef> Features;
|
|
|
|
|
|
|
|
if (ISAKind == ARM::ISAKind::AARCH64) {
|
|
|
|
// AEK_NONE is not meant to be shown to the user so the target parser
|
|
|
|
// does not recognise it. It is relevant here though.
|
|
|
|
if (Flags & AArch64::AEK_NONE)
|
|
|
|
Features.push_back("none");
|
|
|
|
AArch64::getExtensionFeatures(Flags, Features);
|
|
|
|
} else {
|
|
|
|
if (Flags & ARM::AEK_NONE)
|
|
|
|
Features.push_back("none");
|
|
|
|
ARM::getExtensionFeatures(Flags, Features);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The target parser also includes every extension you don't have.
|
|
|
|
// E.g. if AEK_CRC is not set then it adds "-crc". Not useful here.
|
|
|
|
Features.erase(std::remove_if(Features.begin(), Features.end(),
|
|
|
|
[](StringRef extension) {
|
|
|
|
return extension.startswith("-");
|
|
|
|
}),
|
|
|
|
Features.end());
|
|
|
|
|
|
|
|
return llvm::join(Features, ", ");
|
|
|
|
}
|
|
|
|
|
|
|
|
template <ARM::ISAKind ISAKind>
|
|
|
|
testing::AssertionResult
|
|
|
|
AssertSameExtensionFlags(const char *m_expr, const char *n_expr,
|
|
|
|
uint64_t ExpectedFlags, uint64_t GotFlags) {
|
|
|
|
if (ExpectedFlags == GotFlags)
|
|
|
|
return testing::AssertionSuccess();
|
|
|
|
|
|
|
|
return testing::AssertionFailure() << llvm::formatv(
|
|
|
|
"Expected extension flags: {0} ({1:x})\n"
|
|
|
|
" Got extension flags: {2} ({3:x})\n",
|
|
|
|
FormatExtensionFlags<ISAKind>(ExpectedFlags), ExpectedFlags,
|
|
|
|
FormatExtensionFlags<ISAKind>(GotFlags), GotFlags);
|
|
|
|
}
|
|
|
|
|
2020-12-15 16:49:26 +01:00
|
|
|
struct ARMCPUTestParams {
|
|
|
|
ARMCPUTestParams(StringRef CPUName, StringRef ExpectedArch,
|
|
|
|
StringRef ExpectedFPU, uint64_t ExpectedFlags,
|
|
|
|
StringRef CPUAttr)
|
|
|
|
: CPUName(CPUName), ExpectedArch(ExpectedArch), ExpectedFPU(ExpectedFPU),
|
|
|
|
ExpectedFlags(ExpectedFlags), CPUAttr(CPUAttr) {}
|
|
|
|
|
|
|
|
friend std::ostream &operator<<(std::ostream &os,
|
|
|
|
const ARMCPUTestParams ¶ms) {
|
|
|
|
return os << "\"" << params.CPUName.str() << "\", \""
|
|
|
|
<< params.ExpectedArch.str() << "\", \""
|
|
|
|
<< params.ExpectedFPU.str() << "\", 0x" << std::hex
|
|
|
|
<< params.ExpectedFlags << ", \"" << params.CPUAttr.str() << "\"";
|
|
|
|
}
|
|
|
|
|
|
|
|
StringRef CPUName;
|
|
|
|
StringRef ExpectedArch;
|
|
|
|
StringRef ExpectedFPU;
|
|
|
|
uint64_t ExpectedFlags;
|
|
|
|
StringRef CPUAttr;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ARMCPUTestFixture : public ::testing::TestWithParam<ARMCPUTestParams> {};
|
|
|
|
|
|
|
|
TEST_P(ARMCPUTestFixture, ARMCPUTests) {
|
|
|
|
auto params = GetParam();
|
|
|
|
|
|
|
|
ARM::ArchKind AK = ARM::parseCPUArch(params.CPUName);
|
|
|
|
EXPECT_EQ(params.ExpectedArch, ARM::getArchName(AK));
|
|
|
|
|
|
|
|
unsigned FPUKind = ARM::getDefaultFPU(params.CPUName, AK);
|
|
|
|
EXPECT_EQ(params.ExpectedFPU, ARM::getFPUName(FPUKind));
|
|
|
|
|
|
|
|
uint64_t default_extensions = ARM::getDefaultExtensions(params.CPUName, AK);
|
2020-12-17 11:52:37 +01:00
|
|
|
EXPECT_PRED_FORMAT2(AssertSameExtensionFlags<ARM::ISAKind::ARM>,
|
|
|
|
params.ExpectedFlags, default_extensions);
|
2020-12-15 16:49:26 +01:00
|
|
|
|
|
|
|
EXPECT_EQ(params.CPUAttr, ARM::getCPUAttr(AK));
|
2016-12-06 03:22:08 +01:00
|
|
|
}
|
|
|
|
|
2020-12-15 16:49:26 +01:00
|
|
|
// Note that we include ARM::AEK_NONE even when there are other extensions
|
|
|
|
// we expect. This is because the default extensions for a CPU are the sum
|
|
|
|
// of the default extensions for its architecture and for the CPU.
|
|
|
|
// So if a CPU has no extra extensions, it adds AEK_NONE.
|
2021-05-14 19:15:20 +02:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2020-12-15 16:49:26 +01:00
|
|
|
ARMCPUTestsPart1, ARMCPUTestFixture,
|
|
|
|
::testing::Values(
|
|
|
|
ARMCPUTestParams("invalid", "invalid", "invalid", ARM::AEK_NONE, ""),
|
|
|
|
ARMCPUTestParams("generic", "invalid", "none", ARM::AEK_NONE, ""),
|
|
|
|
|
|
|
|
ARMCPUTestParams("arm2", "armv2", "none", ARM::AEK_NONE, "2"),
|
|
|
|
ARMCPUTestParams("arm3", "armv2a", "none", ARM::AEK_NONE, "2A"),
|
|
|
|
ARMCPUTestParams("arm6", "armv3", "none", ARM::AEK_NONE, "3"),
|
|
|
|
ARMCPUTestParams("arm7m", "armv3m", "none", ARM::AEK_NONE, "3M"),
|
|
|
|
ARMCPUTestParams("arm8", "armv4", "none", ARM::AEK_NONE, "4"),
|
|
|
|
ARMCPUTestParams("arm810", "armv4", "none", ARM::AEK_NONE, "4"),
|
|
|
|
ARMCPUTestParams("strongarm", "armv4", "none", ARM::AEK_NONE, "4"),
|
|
|
|
ARMCPUTestParams("strongarm110", "armv4", "none", ARM::AEK_NONE, "4"),
|
|
|
|
ARMCPUTestParams("strongarm1100", "armv4", "none", ARM::AEK_NONE, "4"),
|
|
|
|
ARMCPUTestParams("strongarm1110", "armv4", "none", ARM::AEK_NONE, "4"),
|
|
|
|
ARMCPUTestParams("arm7tdmi", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm7tdmi-s", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm710t", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm720t", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm9", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm9tdmi", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm920", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm920t", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm922t", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm9312", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm940t", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("ep9312", "armv4t", "none", ARM::AEK_NONE, "4T"),
|
|
|
|
ARMCPUTestParams("arm10tdmi", "armv5t", "none", ARM::AEK_NONE, "5T"),
|
|
|
|
ARMCPUTestParams("arm1020t", "armv5t", "none", ARM::AEK_NONE, "5T"),
|
|
|
|
ARMCPUTestParams("arm9e", "armv5te", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "5TE"),
|
|
|
|
ARMCPUTestParams("arm946e-s", "armv5te", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "5TE"),
|
|
|
|
ARMCPUTestParams("arm966e-s", "armv5te", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "5TE"),
|
|
|
|
ARMCPUTestParams("arm968e-s", "armv5te", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "5TE"),
|
|
|
|
ARMCPUTestParams("arm10e", "armv5te", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "5TE"),
|
|
|
|
ARMCPUTestParams("arm1020e", "armv5te", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "5TE"),
|
|
|
|
ARMCPUTestParams("arm1022e", "armv5te", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "5TE"),
|
|
|
|
ARMCPUTestParams("arm926ej-s", "armv5tej", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "5TEJ"),
|
|
|
|
ARMCPUTestParams("arm1136j-s", "armv6", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "6"),
|
|
|
|
ARMCPUTestParams("arm1136jf-s", "armv6", "vfpv2",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "6"),
|
|
|
|
ARMCPUTestParams("arm1136jz-s", "armv6", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "6"),
|
|
|
|
ARMCPUTestParams("arm1176jz-s", "armv6kz", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_SEC | ARM::AEK_DSP, "6KZ"),
|
|
|
|
ARMCPUTestParams("mpcore", "armv6k", "vfpv2",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "6K"),
|
|
|
|
ARMCPUTestParams("mpcorenovfp", "armv6k", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "6K"),
|
|
|
|
ARMCPUTestParams("arm1176jzf-s", "armv6kz", "vfpv2",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_SEC | ARM::AEK_DSP, "6KZ"),
|
|
|
|
ARMCPUTestParams("arm1156t2-s", "armv6t2", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "6T2"),
|
|
|
|
ARMCPUTestParams("arm1156t2f-s", "armv6t2", "vfpv2",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_DSP, "6T2"),
|
|
|
|
ARMCPUTestParams("cortex-m0", "armv6-m", "none", ARM::AEK_NONE, "6-M"),
|
|
|
|
ARMCPUTestParams("cortex-m0plus", "armv6-m", "none", ARM::AEK_NONE,
|
|
|
|
"6-M"),
|
|
|
|
ARMCPUTestParams("cortex-m1", "armv6-m", "none", ARM::AEK_NONE, "6-M"),
|
|
|
|
ARMCPUTestParams("sc000", "armv6-m", "none", ARM::AEK_NONE, "6-M"),
|
|
|
|
ARMCPUTestParams("cortex-a5", "armv7-a", "neon-vfpv4",
|
|
|
|
ARM::AEK_MP | ARM::AEK_SEC | ARM::AEK_DSP, "7-A"),
|
|
|
|
ARMCPUTestParams("cortex-a7", "armv7-a", "neon-vfpv4",
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_HWDIVARM | ARM::AEK_MP |
|
|
|
|
ARM::AEK_SEC | ARM::AEK_VIRT | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"7-A"),
|
|
|
|
ARMCPUTestParams("cortex-a8", "armv7-a", "neon",
|
2021-05-14 19:15:20 +02:00
|
|
|
ARM::AEK_SEC | ARM::AEK_DSP, "7-A")));
|
2020-12-15 16:49:26 +01:00
|
|
|
|
|
|
|
// gtest in llvm has a limit of 50 test cases when using ::Values so we split
|
|
|
|
// them into 2 blocks
|
2021-05-14 19:15:20 +02:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2020-12-15 16:49:26 +01:00
|
|
|
ARMCPUTestsPart2, ARMCPUTestFixture,
|
|
|
|
::testing::Values(
|
|
|
|
ARMCPUTestParams("cortex-a9", "armv7-a", "neon-fp16",
|
|
|
|
ARM::AEK_MP | ARM::AEK_SEC | ARM::AEK_DSP, "7-A"),
|
|
|
|
ARMCPUTestParams("cortex-a12", "armv7-a", "neon-vfpv4",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"7-A"),
|
|
|
|
ARMCPUTestParams("cortex-a15", "armv7-a", "neon-vfpv4",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"7-A"),
|
|
|
|
ARMCPUTestParams("cortex-a17", "armv7-a", "neon-vfpv4",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"7-A"),
|
|
|
|
ARMCPUTestParams("krait", "armv7-a", "neon-vfpv4",
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"7-A"),
|
|
|
|
ARMCPUTestParams("cortex-r4", "armv7-r", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
|
|
|
"7-R"),
|
|
|
|
ARMCPUTestParams("cortex-r4f", "armv7-r", "vfpv3-d16",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
|
|
|
"7-R"),
|
|
|
|
ARMCPUTestParams("cortex-r5", "armv7-r", "vfpv3-d16",
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_MP | ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"7-R"),
|
|
|
|
ARMCPUTestParams("cortex-r7", "armv7-r", "vfpv3-d16-fp16",
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_MP | ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"7-R"),
|
|
|
|
ARMCPUTestParams("cortex-r8", "armv7-r", "vfpv3-d16-fp16",
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_MP | ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"7-R"),
|
|
|
|
ARMCPUTestParams("cortex-r52", "armv8-r", "neon-fp-armv8",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_CRC | ARM::AEK_MP |
|
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
|
|
|
"8-R"),
|
|
|
|
ARMCPUTestParams("sc300", "armv7-m", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_HWDIVTHUMB, "7-M"),
|
|
|
|
ARMCPUTestParams("cortex-m3", "armv7-m", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_HWDIVTHUMB, "7-M"),
|
|
|
|
ARMCPUTestParams("cortex-m4", "armv7e-m", "fpv4-sp-d16",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
|
|
|
"7E-M"),
|
|
|
|
ARMCPUTestParams("cortex-m7", "armv7e-m", "fpv5-d16",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
|
|
|
"7E-M"),
|
|
|
|
ARMCPUTestParams("cortex-a32", "armv8-a", "crypto-neon-fp-armv8",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a35", "armv8-a", "crypto-neon-fp-armv8",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a53", "armv8-a", "crypto-neon-fp-armv8",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a55", "armv8.2-a", "crypto-neon-fp-armv8",
|
2017-08-21 10:43:06 +02:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP |
|
|
|
|
ARM::AEK_FP16 | ARM::AEK_RAS | ARM::AEK_DOTPROD,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a57", "armv8-a", "crypto-neon-fp-armv8",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a72", "armv8-a", "crypto-neon-fp-armv8",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a73", "armv8-a", "crypto-neon-fp-armv8",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a75", "armv8.2-a", "crypto-neon-fp-armv8",
|
2017-08-21 10:43:06 +02:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP |
|
|
|
|
ARM::AEK_FP16 | ARM::AEK_RAS | ARM::AEK_DOTPROD,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a76", "armv8.2-a", "crypto-neon-fp-armv8",
|
2019-02-25 16:08:27 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP |
|
|
|
|
ARM::AEK_FP16 | ARM::AEK_RAS | ARM::AEK_DOTPROD,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a76ae", "armv8.2-a", "crypto-neon-fp-armv8",
|
2019-02-25 16:08:27 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP |
|
|
|
|
ARM::AEK_FP16 | ARM::AEK_RAS | ARM::AEK_DOTPROD,
|
|
|
|
"8.2-A"),
|
2020-12-24 11:15:12 +01:00
|
|
|
ARMCPUTestParams("cortex-a78c", "armv8.2-a", "crypto-neon-fp-armv8",
|
2021-05-14 19:15:20 +02:00
|
|
|
ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT |
|
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP | ARM::AEK_CRC | ARM::AEK_RAS |
|
2020-12-24 11:15:12 +01:00
|
|
|
ARM::AEK_FP16 | ARM::AEK_DOTPROD,
|
|
|
|
"8.2-A"),
|
2020-12-15 16:49:26 +01:00
|
|
|
ARMCPUTestParams("cortex-a77", "armv8.2-a", "crypto-neon-fp-armv8",
|
[ARM] Add Cortex-A77 Support for Clang and LLVM
This patch upstreams support for the Arm-v8 Cortex-A77
processor for AArch64 and ARM.
In detail:
- Adding cortex-a77 as a cpu option for aarch64 and arm targets in clang
- Cortex-A77 CPU name and ProcessorModel in llvm
details of the CPU can be found here:
https://www.arm.com/products/silicon-ip-cpu/cortex-a/cortex-a77
and a similar submission to GCC can be found here:
https://github.com/gcc-mirror/gcc/commit/e0664b7a63ed8305e9f8539309df7fb3eb13babe
The following people contributed to this patch:
- Luke Geeson
- Mikhail Maltsev
Reviewers: t.p.northover, dmgreen, ostannard, SjoerdMeijer
Reviewed By: dmgreen
Subscribers: dmgreen, kristof.beyls, hiraditya, danielkiss, cfe-commits,
llvm-commits, miyuki
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D82887
2020-06-30 17:45:36 +02:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP |
|
|
|
|
ARM::AEK_FP16 | ARM::AEK_RAS | ARM::AEK_DOTPROD,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a78", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
ARM::AEK_DOTPROD | ARM::AEK_FP16 | ARM::AEK_SEC |
|
|
|
|
ARM::AEK_MP | ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP | ARM::AEK_CRC |
|
|
|
|
ARM::AEK_RAS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-x1", "armv8.2-a", "crypto-neon-fp-armv8",
|
2020-07-01 13:50:36 +02:00
|
|
|
ARM::AEK_RAS | ARM::AEK_FP16 | ARM::AEK_DOTPROD |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT |
|
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP | ARM::AEK_CRC | ARM::AEK_RAS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("neoverse-n1", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP |
|
|
|
|
ARM::AEK_FP16 | ARM::AEK_RAS | ARM::AEK_DOTPROD,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("neoverse-n2", "armv8.5-a", "crypto-neon-fp-armv8",
|
|
|
|
ARM::AEK_CRC | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_MP | ARM::AEK_SEC |
|
|
|
|
ARM::AEK_VIRT | ARM::AEK_DSP | ARM::AEK_BF16 |
|
|
|
|
ARM::AEK_DOTPROD | ARM::AEK_RAS | ARM::AEK_I8MM |
|
|
|
|
ARM::AEK_SB,
|
|
|
|
"8.5-A"),
|
|
|
|
ARMCPUTestParams("neoverse-v1", "armv8.4-a", "crypto-neon-fp-armv8",
|
2020-07-01 13:50:36 +02:00
|
|
|
ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB |
|
|
|
|
ARM::AEK_DSP | ARM::AEK_CRC | ARM::AEK_RAS |
|
|
|
|
ARM::AEK_FP16 | ARM::AEK_BF16 | ARM::AEK_DOTPROD,
|
|
|
|
"8.4-A"),
|
|
|
|
ARMCPUTestParams("cyclone", "armv8-a", "crypto-neon-fp-armv8",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2020-12-15 16:49:26 +01:00
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("exynos-m3", "armv8-a", "crypto-neon-fp-armv8",
|
2016-12-14 00:31:41 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("exynos-m4", "armv8.2-a", "crypto-neon-fp-armv8",
|
2018-06-06 20:56:00 +02:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP |
|
|
|
|
ARM::AEK_DOTPROD | ARM::AEK_FP16 | ARM::AEK_RAS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("exynos-m5", "armv8.2-a", "crypto-neon-fp-armv8",
|
2019-03-22 19:42:14 +01:00
|
|
|
ARM::AEK_CRC | ARM::AEK_SEC | ARM::AEK_MP |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP |
|
|
|
|
ARM::AEK_DOTPROD | ARM::AEK_FP16 | ARM::AEK_RAS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-m23", "armv8-m.base", "none",
|
|
|
|
ARM::AEK_NONE | ARM::AEK_HWDIVTHUMB, "8-M.Baseline"),
|
|
|
|
ARMCPUTestParams("cortex-m33", "armv8-m.main", "fpv5-sp-d16",
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP, "8-M.Mainline"),
|
|
|
|
ARMCPUTestParams("cortex-m35p", "armv8-m.main", "fpv5-sp-d16",
|
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP, "8-M.Mainline"),
|
|
|
|
ARMCPUTestParams("cortex-m55", "armv8.1-m.main",
|
|
|
|
"fp-armv8-fullfp16-d16",
|
2020-02-14 14:33:32 +01:00
|
|
|
ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP | ARM::AEK_SIMD |
|
2020-12-15 16:49:26 +01:00
|
|
|
ARM::AEK_FP | ARM::AEK_RAS | ARM::AEK_LOB |
|
|
|
|
ARM::AEK_FP16,
|
|
|
|
"8.1-M.Mainline"),
|
|
|
|
ARMCPUTestParams("iwmmxt", "iwmmxt", "none", ARM::AEK_NONE, "iwmmxt"),
|
|
|
|
ARMCPUTestParams("xscale", "xscale", "none", ARM::AEK_NONE, "xscale"),
|
|
|
|
ARMCPUTestParams("swift", "armv7s", "neon-vfpv4",
|
2017-04-20 11:38:25 +02:00
|
|
|
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
|
2021-05-14 19:15:20 +02:00
|
|
|
"7-S")));
|
2016-12-06 03:22:08 +01:00
|
|
|
|
2020-12-24 11:15:12 +01:00
|
|
|
static constexpr unsigned NumARMCPUArchs = 92;
|
2018-02-08 17:48:54 +01:00
|
|
|
|
|
|
|
TEST(TargetParserTest, testARMCPUArchList) {
|
|
|
|
SmallVector<StringRef, NumARMCPUArchs> List;
|
|
|
|
ARM::fillValidCPUArchList(List);
|
|
|
|
|
|
|
|
// No list exists for these in this test suite, so ensure all are
|
|
|
|
// valid, and match the expected 'magic' count.
|
|
|
|
EXPECT_EQ(List.size(), NumARMCPUArchs);
|
|
|
|
for(StringRef CPU : List) {
|
|
|
|
EXPECT_NE(ARM::parseCPUArch(CPU), ARM::ArchKind::INVALID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-20 12:32:43 +01:00
|
|
|
TEST(TargetParserTest, testInvalidARMArch) {
|
|
|
|
auto InvalidArchStrings = {"armv", "armv99", "noarm"};
|
|
|
|
for (const char* InvalidArch : InvalidArchStrings)
|
|
|
|
EXPECT_EQ(ARM::parseArch(InvalidArch), ARM::ArchKind::INVALID);
|
|
|
|
}
|
|
|
|
|
2016-12-06 03:22:08 +01:00
|
|
|
bool testARMArch(StringRef Arch, StringRef DefaultCPU, StringRef SubArch,
|
|
|
|
unsigned ArchAttr) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
ARM::ArchKind AK = ARM::parseArch(Arch);
|
2019-11-02 23:26:00 +01:00
|
|
|
bool Result = (AK != ARM::ArchKind::INVALID);
|
|
|
|
Result &= ARM::getDefaultCPU(Arch).equals(DefaultCPU);
|
|
|
|
Result &= ARM::getSubArch(AK).equals(SubArch);
|
|
|
|
Result &= (ARM::getArchAttr(AK) == ArchAttr);
|
|
|
|
return Result;
|
2016-12-06 03:22:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, testARMArch) {
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv2", "arm2", "v2",
|
|
|
|
ARMBuildAttrs::CPUArch::Pre_v4));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv2a", "arm3", "v2a",
|
|
|
|
ARMBuildAttrs::CPUArch::Pre_v4));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv3", "arm6", "v3",
|
|
|
|
ARMBuildAttrs::CPUArch::Pre_v4));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv3m", "arm7m", "v3m",
|
|
|
|
ARMBuildAttrs::CPUArch::Pre_v4));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv4", "strongarm", "v4",
|
|
|
|
ARMBuildAttrs::CPUArch::v4));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv4t", "arm7tdmi", "v4t",
|
|
|
|
ARMBuildAttrs::CPUArch::v4T));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv5t", "arm10tdmi", "v5",
|
|
|
|
ARMBuildAttrs::CPUArch::v5T));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv5te", "arm1022e", "v5e",
|
|
|
|
ARMBuildAttrs::CPUArch::v5TE));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv5tej", "arm926ej-s", "v5e",
|
|
|
|
ARMBuildAttrs::CPUArch::v5TEJ));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv6", "arm1136jf-s", "v6",
|
|
|
|
ARMBuildAttrs::CPUArch::v6));
|
|
|
|
EXPECT_TRUE(
|
2018-09-28 11:04:27 +02:00
|
|
|
testARMArch("armv6k", "mpcore", "v6k",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARMBuildAttrs::CPUArch::v6K));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv6t2", "arm1156t2-s", "v6t2",
|
|
|
|
ARMBuildAttrs::CPUArch::v6T2));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv6kz", "arm1176jzf-s", "v6kz",
|
|
|
|
ARMBuildAttrs::CPUArch::v6KZ));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv6-m", "cortex-m0", "v6m",
|
|
|
|
ARMBuildAttrs::CPUArch::v6_M));
|
|
|
|
EXPECT_TRUE(
|
2017-06-01 09:31:43 +02:00
|
|
|
testARMArch("armv7-a", "generic", "v7",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARMBuildAttrs::CPUArch::v7));
|
2017-02-10 00:29:14 +01:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv7ve", "generic", "v7ve",
|
|
|
|
ARMBuildAttrs::CPUArch::v7));
|
2016-12-06 03:22:08 +01:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv7-r", "cortex-r4", "v7r",
|
|
|
|
ARMBuildAttrs::CPUArch::v7));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv7-m", "cortex-m3", "v7m",
|
|
|
|
ARMBuildAttrs::CPUArch::v7));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv7e-m", "cortex-m4", "v7em",
|
|
|
|
ARMBuildAttrs::CPUArch::v7E_M));
|
|
|
|
EXPECT_TRUE(
|
2017-06-01 09:31:43 +02:00
|
|
|
testARMArch("armv8-a", "generic", "v8",
|
2016-12-06 03:22:08 +01:00
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8.1-a", "generic", "v8.1a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8.2-a", "generic", "v8.2a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2017-08-22 14:46:33 +02:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8.3-a", "generic", "v8.3a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2018-09-26 15:09:15 +02:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8.4-a", "generic", "v8.4a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2018-09-26 14:48:21 +02:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8.5-a", "generic", "v8.5a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
[PATCH] [ARM] ARMv8.6-a command-line + BFloat16 Asm Support
Summary:
This patch introduces command-line support for the Armv8.6-a architecture and assembly support for BFloat16. Details can be found
https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a
in addition to the GCC patch for the 8..6-a CLI:
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-11/msg02647.html
In detail this patch
- march options for armv8.6-a
- BFloat16 assembly
This is part of a patch series, starting with command-line and Bfloat16
assembly support. The subsequent patches will upstream intrinsics
support for BFloat16, followed by Matrix Multiplication and the
remaining Virtualization features of the armv8.6-a architecture.
Based on work by:
- labrinea
- MarkMurrayARM
- Luke Cheeseman
- Javed Asbar
- Mikhail Maltsev
- Luke Geeson
Reviewers: SjoerdMeijer, craig.topper, rjmccall, jfb, LukeGeeson
Reviewed By: SjoerdMeijer
Subscribers: stuij, kristof.beyls, hiraditya, dexonsmith, danielkiss, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D76062
2020-03-26 09:17:29 +01:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8.6-a", "generic", "v8.6a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2020-12-09 17:13:36 +01:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8.7-a", "generic", "v8.7a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2016-12-06 03:22:08 +01:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8-r", "cortex-r52", "v8r",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_R));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8-m.base", "generic", "v8m.base",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_M_Base));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8-m.main", "generic", "v8m.main",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_M_Main));
|
2019-05-30 14:57:04 +02:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv8.1-m.main", "generic", "v8.1m.main",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_1_M_Main));
|
2016-12-06 03:22:08 +01:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("iwmmxt", "iwmmxt", "",
|
|
|
|
ARMBuildAttrs::CPUArch::v5TE));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("iwmmxt2", "generic", "",
|
|
|
|
ARMBuildAttrs::CPUArch::v5TE));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("xscale", "xscale", "v5e",
|
|
|
|
ARMBuildAttrs::CPUArch::v5TE));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv7s", "swift", "v7s",
|
|
|
|
ARMBuildAttrs::CPUArch::v7));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testARMArch("armv7k", "generic", "v7k",
|
|
|
|
ARMBuildAttrs::CPUArch::v7));
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
bool testARMExtension(StringRef CPUName,ARM::ArchKind ArchKind, StringRef ArchExt) {
|
2016-12-06 03:22:08 +01:00
|
|
|
return ARM::getDefaultExtensions(CPUName, ArchKind) &
|
|
|
|
ARM::parseArchExt(ArchExt);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, testARMExtension) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("arm2", ARM::ArchKind::INVALID, "thumb"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm3", ARM::ArchKind::INVALID, "thumb"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm6", ARM::ArchKind::INVALID, "thumb"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm7m", ARM::ArchKind::INVALID, "thumb"));
|
|
|
|
EXPECT_FALSE(testARMExtension("strongarm", ARM::ArchKind::INVALID, "dsp"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm7tdmi", ARM::ArchKind::INVALID, "dsp"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm10tdmi",
|
|
|
|
ARM::ArchKind::INVALID, "simd"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm1022e", ARM::ArchKind::INVALID, "simd"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm926ej-s",
|
|
|
|
ARM::ArchKind::INVALID, "simd"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm1136jf-s",
|
|
|
|
ARM::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm1176j-s",
|
|
|
|
ARM::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm1156t2-s",
|
|
|
|
ARM::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("arm1176jzf-s",
|
|
|
|
ARM::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("cortex-m0",
|
|
|
|
ARM::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("cortex-a8",
|
|
|
|
ARM::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("cortex-r4",
|
|
|
|
ARM::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("cortex-m3",
|
|
|
|
ARM::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("cortex-a53",
|
|
|
|
ARM::ArchKind::INVALID, "ras"));
|
2018-08-17 13:26:57 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("cortex-a53",
|
|
|
|
ARM::ArchKind::INVALID, "fp16"));
|
|
|
|
EXPECT_TRUE(testARMExtension("cortex-a55",
|
|
|
|
ARM::ArchKind::INVALID, "fp16"));
|
2018-08-17 13:29:49 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("cortex-a55",
|
|
|
|
ARM::ArchKind::INVALID, "fp16fml"));
|
2018-08-17 13:26:57 +02:00
|
|
|
EXPECT_TRUE(testARMExtension("cortex-a75",
|
|
|
|
ARM::ArchKind::INVALID, "fp16"));
|
2018-08-17 13:29:49 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("cortex-a75",
|
|
|
|
ARM::ArchKind::INVALID, "fp16fml"));
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("cortex-r52",
|
|
|
|
ARM::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_FALSE(testARMExtension("iwmmxt", ARM::ArchKind::INVALID, "crc"));
|
|
|
|
EXPECT_FALSE(testARMExtension("xscale", ARM::ArchKind::INVALID, "crc"));
|
|
|
|
EXPECT_FALSE(testARMExtension("swift", ARM::ArchKind::INVALID, "crc"));
|
|
|
|
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV2, "thumb"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV2A, "thumb"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV3, "thumb"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV3M, "thumb"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV4, "dsp"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV4T, "dsp"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV5T, "simd"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV5TE, "simd"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV5TEJ, "simd"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV6, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV6K, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic",
|
|
|
|
ARM::ArchKind::ARMV6T2, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic",
|
|
|
|
ARM::ArchKind::ARMV6KZ, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV6M, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV7A, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV7R, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV7M, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic",
|
|
|
|
ARM::ArchKind::ARMV7EM, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8A, "ras"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8_1A, "ras"));
|
2018-11-09 20:32:08 +01:00
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8_2A, "profile"));
|
2018-08-17 13:26:57 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8_2A, "fp16"));
|
2018-08-17 13:29:49 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8_2A, "fp16fml"));
|
2018-08-17 13:26:57 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8_3A, "fp16"));
|
2018-08-17 13:29:49 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8_3A, "fp16fml"));
|
2018-08-17 13:26:57 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8_4A, "fp16"));
|
2018-08-17 13:29:49 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8_4A, "fp16fml"));
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV8R, "ras"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic",
|
|
|
|
ARM::ArchKind::ARMV8MBaseline, "crc"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic",
|
|
|
|
ARM::ArchKind::ARMV8MMainline, "crc"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::IWMMXT, "crc"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::IWMMXT2, "crc"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::XSCALE, "crc"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV7S, "crypto"));
|
|
|
|
EXPECT_FALSE(testARMExtension("generic", ARM::ArchKind::ARMV7K, "crypto"));
|
2016-03-06 05:50:55 +01:00
|
|
|
}
|
2016-06-08 16:30:00 +02:00
|
|
|
|
2016-07-28 08:11:18 +02:00
|
|
|
TEST(TargetParserTest, ARMFPUVersion) {
|
2018-12-03 15:00:47 +01:00
|
|
|
for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);
|
2016-07-28 08:11:18 +02:00
|
|
|
FK <= ARM::FPUKind::FK_LAST;
|
|
|
|
FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1))
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
if (FK == ARM::FK_LAST || ARM::getFPUName(FK) == "invalid" ||
|
|
|
|
ARM::getFPUName(FK) == "none" || ARM::getFPUName(FK) == "softvfp")
|
|
|
|
EXPECT_EQ(ARM::FPUVersion::NONE, ARM::getFPUVersion(FK));
|
2016-07-28 08:11:18 +02:00
|
|
|
else
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_NE(ARM::FPUVersion::NONE, ARM::getFPUVersion(FK));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMFPUNeonSupportLevel) {
|
|
|
|
for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);
|
|
|
|
FK <= ARM::FPUKind::FK_LAST;
|
|
|
|
FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1))
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
if (FK == ARM::FK_LAST ||
|
|
|
|
ARM::getFPUName(FK).find("neon") == std::string::npos)
|
|
|
|
EXPECT_EQ(ARM::NeonSupportLevel::None,
|
|
|
|
ARM::getFPUNeonSupportLevel(FK));
|
2016-07-28 08:11:18 +02:00
|
|
|
else
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_NE(ARM::NeonSupportLevel::None,
|
|
|
|
ARM::getFPUNeonSupportLevel(FK));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMFPURestriction) {
|
|
|
|
for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);
|
|
|
|
FK <= ARM::FPUKind::FK_LAST;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1)) {
|
|
|
|
if (FK == ARM::FK_LAST ||
|
|
|
|
(ARM::getFPUName(FK).find("d16") == std::string::npos &&
|
|
|
|
ARM::getFPUName(FK).find("vfpv3xd") == std::string::npos))
|
|
|
|
EXPECT_EQ(ARM::FPURestriction::None, ARM::getFPURestriction(FK));
|
2016-07-28 08:11:18 +02:00
|
|
|
else
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_NE(ARM::FPURestriction::None, ARM::getFPURestriction(FK));
|
|
|
|
}
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMExtensionFeatures) {
|
[ARM] Make ARM::ArchExtKind use 64-bit underlying type, NFCI
Summary:
This patch changes the underlying type of the ARM::ArchExtKind
enumeration to uint64_t and adjusts the related code.
The goal of the patch is to prepare the code base for a new
architecture extension.
Reviewers: simon_tatham, eli.friedman, ostannard, dmgreen
Reviewed By: dmgreen
Subscribers: merge_guards_bot, kristof.beyls, hiraditya, cfe-commits, llvm-commits, pbarrio
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D73906
2020-02-04 12:22:07 +01:00
|
|
|
std::map<uint64_t, std::vector<StringRef>> Extensions;
|
2019-06-20 11:33:11 +02:00
|
|
|
|
2019-07-14 20:32:42 +02:00
|
|
|
for (auto &Ext : ARM::ARCHExtNames) {
|
|
|
|
if (Ext.Feature && Ext.NegFeature)
|
|
|
|
Extensions[Ext.ID] = { StringRef(Ext.Feature),
|
|
|
|
StringRef(Ext.NegFeature) };
|
|
|
|
}
|
|
|
|
|
2019-06-20 11:33:11 +02:00
|
|
|
Extensions[ARM::AEK_HWDIVARM] = { "+hwdiv-arm", "-hwdiv-arm" };
|
|
|
|
Extensions[ARM::AEK_HWDIVTHUMB] = { "+hwdiv", "-hwdiv" };
|
|
|
|
|
2019-06-19 20:03:36 +02:00
|
|
|
std::vector<StringRef> Features;
|
2016-07-28 08:11:18 +02:00
|
|
|
|
2019-07-14 20:32:42 +02:00
|
|
|
EXPECT_FALSE(ARM::getExtensionFeatures(ARM::AEK_INVALID, Features));
|
2019-06-20 11:33:11 +02:00
|
|
|
|
|
|
|
for (auto &E : Extensions) {
|
|
|
|
// test +extension
|
2019-06-19 20:03:36 +02:00
|
|
|
Features.clear();
|
2019-06-20 11:33:11 +02:00
|
|
|
ARM::getExtensionFeatures(E.first, Features);
|
2020-08-02 06:49:38 +02:00
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, E.second.at(0)));
|
2019-06-20 11:33:11 +02:00
|
|
|
EXPECT_TRUE(Extensions.size() == Features.size());
|
|
|
|
|
|
|
|
// test -extension
|
|
|
|
Features.clear();
|
|
|
|
ARM::getExtensionFeatures(~E.first, Features);
|
2020-08-02 06:49:38 +02:00
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, E.second.at(1)));
|
2019-06-20 11:33:11 +02:00
|
|
|
EXPECT_TRUE(Extensions.size() == Features.size());
|
2019-07-14 20:32:42 +02:00
|
|
|
}
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMFPUFeatures) {
|
2016-10-07 10:37:29 +02:00
|
|
|
std::vector<StringRef> Features;
|
2016-07-28 08:11:18 +02:00
|
|
|
for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);
|
|
|
|
FK <= ARM::FPUKind::FK_LAST;
|
|
|
|
FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1))
|
|
|
|
EXPECT_TRUE((FK == ARM::FK_INVALID || FK >= ARM::FK_LAST)
|
|
|
|
? !ARM::getFPUFeatures(FK, Features)
|
|
|
|
: ARM::getFPUFeatures(FK, Features));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMArchExtFeature) {
|
|
|
|
const char *ArchExt[][4] = {{"crc", "nocrc", "+crc", "-crc"},
|
|
|
|
{"crypto", "nocrypto", "+crypto", "-crypto"},
|
|
|
|
{"dsp", "nodsp", "+dsp", "-dsp"},
|
|
|
|
{"fp", "nofp", nullptr, nullptr},
|
|
|
|
{"idiv", "noidiv", nullptr, nullptr},
|
|
|
|
{"mp", "nomp", nullptr, nullptr},
|
|
|
|
{"simd", "nosimd", nullptr, nullptr},
|
|
|
|
{"sec", "nosec", nullptr, nullptr},
|
|
|
|
{"virt", "novirt", nullptr, nullptr},
|
|
|
|
{"fp16", "nofp16", "+fullfp16", "-fullfp16"},
|
2018-08-17 13:29:49 +02:00
|
|
|
{"fp16fml", "nofp16fml", "+fp16fml", "-fp16fml"},
|
2016-07-28 08:11:18 +02:00
|
|
|
{"ras", "noras", "+ras", "-ras"},
|
2017-08-21 10:43:06 +02:00
|
|
|
{"dotprod", "nodotprod", "+dotprod", "-dotprod"},
|
2016-07-28 08:11:18 +02:00
|
|
|
{"os", "noos", nullptr, nullptr},
|
|
|
|
{"iwmmxt", "noiwmmxt", nullptr, nullptr},
|
|
|
|
{"iwmmxt2", "noiwmmxt2", nullptr, nullptr},
|
|
|
|
{"maverick", "maverick", nullptr, nullptr},
|
2019-01-03 13:09:12 +01:00
|
|
|
{"xscale", "noxscale", nullptr, nullptr},
|
2019-05-30 14:57:04 +02:00
|
|
|
{"sb", "nosb", "+sb", "-sb"},
|
2020-04-10 00:00:22 +02:00
|
|
|
{"i8mm", "noi8mm", "+i8mm", "-i8mm"},
|
2019-05-30 14:57:04 +02:00
|
|
|
{"mve", "nomve", "+mve", "-mve"},
|
|
|
|
{"mve.fp", "nomve.fp", "+mve.fp", "-mve.fp"}};
|
2016-07-28 08:11:18 +02:00
|
|
|
|
|
|
|
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
|
2016-10-07 10:37:29 +02:00
|
|
|
EXPECT_EQ(StringRef(ArchExt[i][2]), ARM::getArchExtFeature(ArchExt[i][0]));
|
|
|
|
EXPECT_EQ(StringRef(ArchExt[i][3]), ARM::getArchExtFeature(ArchExt[i][1]));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-05 16:19:03 +01:00
|
|
|
static bool
|
|
|
|
testArchExtDependency(const char *ArchExt,
|
|
|
|
const std::initializer_list<const char *> &Expected) {
|
|
|
|
std::vector<StringRef> Features;
|
2020-07-21 18:18:20 +02:00
|
|
|
unsigned FPUID;
|
2020-02-05 16:19:03 +01:00
|
|
|
|
|
|
|
if (!ARM::appendArchExtFeatures("", ARM::ArchKind::ARMV8_1MMainline, ArchExt,
|
2020-07-21 18:18:20 +02:00
|
|
|
Features, FPUID))
|
2020-02-05 16:19:03 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return llvm::all_of(Expected, [&](StringRef Ext) {
|
|
|
|
return llvm::is_contained(Features, Ext);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMArchExtDependencies) {
|
|
|
|
EXPECT_TRUE(testArchExtDependency("mve", {"+mve", "+dsp"}));
|
|
|
|
EXPECT_TRUE(testArchExtDependency("mve.fp", {"+mve.fp", "+mve", "+dsp"}));
|
|
|
|
EXPECT_TRUE(testArchExtDependency("nodsp", {"-dsp", "-mve", "-mve.fp"}));
|
|
|
|
EXPECT_TRUE(testArchExtDependency("nomve", {"-mve", "-mve.fp"}));
|
|
|
|
}
|
|
|
|
|
2016-07-28 08:11:18 +02:00
|
|
|
TEST(TargetParserTest, ARMparseHWDiv) {
|
|
|
|
const char *hwdiv[] = {"thumb", "arm", "arm,thumb", "thumb,arm"};
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < array_lengthof(hwdiv); i++)
|
|
|
|
EXPECT_NE(ARM::AEK_INVALID, ARM::parseHWDiv((StringRef)hwdiv[i]));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMparseArchEndianAndISA) {
|
|
|
|
const char *Arch[] = {
|
2018-01-09 18:49:25 +01:00
|
|
|
"v2", "v2a", "v3", "v3m", "v4", "v4t", "v5", "v5t",
|
|
|
|
"v5e", "v5te", "v5tej", "v6", "v6j", "v6k", "v6hl", "v6t2",
|
|
|
|
"v6kz", "v6z", "v6zk", "v6-m", "v6m", "v6sm", "v6s-m", "v7-a",
|
|
|
|
"v7", "v7a", "v7ve", "v7hl", "v7l", "v7-r", "v7r", "v7-m",
|
|
|
|
"v7m", "v7k", "v7s", "v7e-m", "v7em", "v8-a", "v8", "v8a",
|
2018-09-26 15:09:15 +02:00
|
|
|
"v8l", "v8.1-a", "v8.1a", "v8.2-a", "v8.2a", "v8.3-a", "v8.3a", "v8.4-a",
|
2020-12-09 17:13:36 +01:00
|
|
|
"v8.4a", "v8.5-a","v8.5a", "v8.6-a", "v8.6a", "v8.7-a", "v8.7a", "v8-r",
|
|
|
|
"v8m.base", "v8m.main", "v8.1m.main"
|
2018-09-26 14:48:21 +02:00
|
|
|
};
|
2016-07-28 08:11:18 +02:00
|
|
|
|
|
|
|
for (unsigned i = 0; i < array_lengthof(Arch); i++) {
|
|
|
|
std::string arm_1 = "armeb" + (std::string)(Arch[i]);
|
|
|
|
std::string arm_2 = "arm" + (std::string)(Arch[i]) + "eb";
|
|
|
|
std::string arm_3 = "arm" + (std::string)(Arch[i]);
|
|
|
|
std::string thumb_1 = "thumbeb" + (std::string)(Arch[i]);
|
|
|
|
std::string thumb_2 = "thumb" + (std::string)(Arch[i]) + "eb";
|
|
|
|
std::string thumb_3 = "thumb" + (std::string)(Arch[i]);
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::EndianKind::BIG, ARM::parseArchEndian(arm_1));
|
|
|
|
EXPECT_EQ(ARM::EndianKind::BIG, ARM::parseArchEndian(arm_2));
|
|
|
|
EXPECT_EQ(ARM::EndianKind::LITTLE, ARM::parseArchEndian(arm_3));
|
2016-07-28 08:11:18 +02:00
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::ISAKind::ARM, ARM::parseArchISA(arm_1));
|
|
|
|
EXPECT_EQ(ARM::ISAKind::ARM, ARM::parseArchISA(arm_2));
|
|
|
|
EXPECT_EQ(ARM::ISAKind::ARM, ARM::parseArchISA(arm_3));
|
2016-07-28 08:11:18 +02:00
|
|
|
if (i >= 4) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::EndianKind::BIG, ARM::parseArchEndian(thumb_1));
|
|
|
|
EXPECT_EQ(ARM::EndianKind::BIG, ARM::parseArchEndian(thumb_2));
|
|
|
|
EXPECT_EQ(ARM::EndianKind::LITTLE, ARM::parseArchEndian(thumb_3));
|
2016-07-28 08:11:18 +02:00
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::ISAKind::THUMB, ARM::parseArchISA(thumb_1));
|
|
|
|
EXPECT_EQ(ARM::ISAKind::THUMB, ARM::parseArchISA(thumb_2));
|
|
|
|
EXPECT_EQ(ARM::ISAKind::THUMB, ARM::parseArchISA(thumb_3));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::EndianKind::LITTLE, ARM::parseArchEndian("aarch64"));
|
2019-05-15 14:01:04 +02:00
|
|
|
EXPECT_EQ(ARM::EndianKind::LITTLE, ARM::parseArchEndian("arm64_32"));
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::EndianKind::BIG, ARM::parseArchEndian("aarch64_be"));
|
2016-07-28 08:11:18 +02:00
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::ISAKind::AARCH64, ARM::parseArchISA("aarch64"));
|
|
|
|
EXPECT_EQ(ARM::ISAKind::AARCH64, ARM::parseArchISA("aarch64_be"));
|
|
|
|
EXPECT_EQ(ARM::ISAKind::AARCH64, ARM::parseArchISA("arm64"));
|
|
|
|
EXPECT_EQ(ARM::ISAKind::AARCH64, ARM::parseArchISA("arm64_be"));
|
2019-05-15 14:01:04 +02:00
|
|
|
EXPECT_EQ(ARM::ISAKind::AARCH64, ARM::parseArchISA("arm64_32"));
|
|
|
|
EXPECT_EQ(ARM::ISAKind::AARCH64, ARM::parseArchISA("aarch64_32"));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMparseArchProfile) {
|
|
|
|
for (unsigned i = 0; i < array_lengthof(ARMArch); i++) {
|
|
|
|
switch (ARM::parseArch(ARMArch[i])) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
case ARM::ArchKind::ARMV6M:
|
|
|
|
case ARM::ArchKind::ARMV7M:
|
|
|
|
case ARM::ArchKind::ARMV7EM:
|
|
|
|
case ARM::ArchKind::ARMV8MMainline:
|
|
|
|
case ARM::ArchKind::ARMV8MBaseline:
|
2019-05-30 14:57:04 +02:00
|
|
|
case ARM::ArchKind::ARMV8_1MMainline:
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::ProfileKind::M, ARM::parseArchProfile(ARMArch[i]));
|
|
|
|
break;
|
|
|
|
case ARM::ArchKind::ARMV7R:
|
|
|
|
case ARM::ArchKind::ARMV8R:
|
|
|
|
EXPECT_EQ(ARM::ProfileKind::R, ARM::parseArchProfile(ARMArch[i]));
|
|
|
|
break;
|
|
|
|
case ARM::ArchKind::ARMV7A:
|
|
|
|
case ARM::ArchKind::ARMV7VE:
|
|
|
|
case ARM::ArchKind::ARMV7K:
|
|
|
|
case ARM::ArchKind::ARMV8A:
|
|
|
|
case ARM::ArchKind::ARMV8_1A:
|
|
|
|
case ARM::ArchKind::ARMV8_2A:
|
2017-08-22 14:46:33 +02:00
|
|
|
case ARM::ArchKind::ARMV8_3A:
|
2018-09-26 15:09:15 +02:00
|
|
|
case ARM::ArchKind::ARMV8_4A:
|
2018-09-26 14:48:21 +02:00
|
|
|
case ARM::ArchKind::ARMV8_5A:
|
[PATCH] [ARM] ARMv8.6-a command-line + BFloat16 Asm Support
Summary:
This patch introduces command-line support for the Armv8.6-a architecture and assembly support for BFloat16. Details can be found
https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a
in addition to the GCC patch for the 8..6-a CLI:
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-11/msg02647.html
In detail this patch
- march options for armv8.6-a
- BFloat16 assembly
This is part of a patch series, starting with command-line and Bfloat16
assembly support. The subsequent patches will upstream intrinsics
support for BFloat16, followed by Matrix Multiplication and the
remaining Virtualization features of the armv8.6-a architecture.
Based on work by:
- labrinea
- MarkMurrayARM
- Luke Cheeseman
- Javed Asbar
- Mikhail Maltsev
- Luke Geeson
Reviewers: SjoerdMeijer, craig.topper, rjmccall, jfb, LukeGeeson
Reviewed By: SjoerdMeijer
Subscribers: stuij, kristof.beyls, hiraditya, dexonsmith, danielkiss, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D76062
2020-03-26 09:17:29 +01:00
|
|
|
case ARM::ArchKind::ARMV8_6A:
|
2020-12-09 17:13:36 +01:00
|
|
|
case ARM::ArchKind::ARMV8_7A:
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_EQ(ARM::ProfileKind::A, ARM::parseArchProfile(ARMArch[i]));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
EXPECT_EQ(ARM::ProfileKind::INVALID, ARM::parseArchProfile(ARMArch[i]));
|
|
|
|
break;
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, ARMparseArchVersion) {
|
|
|
|
for (unsigned i = 0; i < array_lengthof(ARMArch); i++)
|
|
|
|
if (((std::string)ARMArch[i]).substr(0, 4) == "armv")
|
2016-07-28 23:42:12 +02:00
|
|
|
EXPECT_EQ((ARMArch[i][4] - 48u), ARM::parseArchVersion(ARMArch[i]));
|
2016-07-28 08:11:18 +02:00
|
|
|
else
|
2016-07-28 23:42:12 +02:00
|
|
|
EXPECT_EQ(5u, ARM::parseArchVersion(ARMArch[i]));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
|
2020-12-15 16:49:26 +01:00
|
|
|
class AArch64CPUTestFixture
|
|
|
|
: public ::testing::TestWithParam<ARMCPUTestParams> {};
|
2016-12-06 03:22:08 +01:00
|
|
|
|
2020-12-15 16:49:26 +01:00
|
|
|
TEST_P(AArch64CPUTestFixture, testAArch64CPU) {
|
|
|
|
ARMCPUTestParams params = GetParam();
|
2016-12-06 03:22:08 +01:00
|
|
|
|
2020-12-15 16:49:26 +01:00
|
|
|
AArch64::ArchKind AK = AArch64::parseCPUArch(params.CPUName);
|
|
|
|
EXPECT_EQ(params.ExpectedArch, AArch64::getArchName(AK));
|
2020-12-15 17:17:28 +01:00
|
|
|
|
2020-12-15 16:49:26 +01:00
|
|
|
uint64_t default_extensions =
|
|
|
|
AArch64::getDefaultExtensions(params.CPUName, AK);
|
2020-12-17 11:52:37 +01:00
|
|
|
EXPECT_PRED_FORMAT2(AssertSameExtensionFlags<ARM::ISAKind::AARCH64>,
|
|
|
|
params.ExpectedFlags, default_extensions);
|
2016-12-06 03:22:08 +01:00
|
|
|
|
2020-12-15 16:49:26 +01:00
|
|
|
unsigned FPUKind = AArch64::getDefaultFPU(params.CPUName, AK);
|
|
|
|
EXPECT_EQ(params.ExpectedFPU, ARM::getFPUName(FPUKind));
|
2016-12-06 03:22:08 +01:00
|
|
|
|
2020-12-15 16:49:26 +01:00
|
|
|
EXPECT_EQ(params.CPUAttr, AArch64::getCPUAttr(AK));
|
2016-12-06 03:22:08 +01:00
|
|
|
}
|
|
|
|
|
2021-05-14 19:15:20 +02:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2020-12-15 16:49:26 +01:00
|
|
|
AArch64CPUTests, AArch64CPUTestFixture,
|
|
|
|
::testing::Values(
|
|
|
|
ARMCPUTestParams("invalid", "invalid", "invalid", AArch64::AEK_NONE,
|
|
|
|
""),
|
|
|
|
ARMCPUTestParams("generic", "invalid", "none", AArch64::AEK_NONE, ""),
|
|
|
|
|
|
|
|
ARMCPUTestParams("cortex-a34", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a35", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a53", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a55", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_RCPC,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a57", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a65", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a65ae", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a72", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a73", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("cortex-a75", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_RCPC,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a76", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a76ae", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a77", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cortex-a78", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
2020-12-24 11:15:12 +01:00
|
|
|
ARMCPUTestParams("cortex-a78c", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_CRC |
|
|
|
|
AArch64::AEK_CRYPTO | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_DOTPROD |
|
|
|
|
AArch64::AEK_RCPC | AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
2020-12-15 16:49:26 +01:00
|
|
|
ARMCPUTestParams(
|
|
|
|
"neoverse-v1", "armv8.4-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_SVE | AArch64::AEK_SSBS |
|
|
|
|
AArch64::AEK_RCPC | AArch64::AEK_CRC | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
|
|
|
|
AArch64::AEK_CRYPTO | AArch64::AEK_FP16 | AArch64::AEK_BF16,
|
|
|
|
"8.4-A"),
|
|
|
|
ARMCPUTestParams("cortex-r82", "armv8-r", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SSBS | AArch64::AEK_DOTPROD |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_FP16FML |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_SB,
|
|
|
|
"8-R"),
|
|
|
|
ARMCPUTestParams("cortex-x1", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("cyclone", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_NONE | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("apple-a7", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_NONE | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("apple-a8", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_NONE | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("apple-a9", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_NONE | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("apple-a10", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("apple-a11", "armv8.2-a", "crypto-neon-fp-armv8",
|
2021-03-02 15:38:58 +01:00
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_FP16,
|
2020-12-15 16:49:26 +01:00
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("apple-a12", "armv8.3-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_FP16,
|
|
|
|
"8.3-A"),
|
|
|
|
ARMCPUTestParams("apple-a13", "armv8.4-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_FP16FML,
|
|
|
|
"8.4-A"),
|
2021-01-14 10:09:54 +01:00
|
|
|
ARMCPUTestParams("apple-a14", "armv8.5-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_FP16FML,
|
|
|
|
"8.5-A"),
|
2021-04-15 04:34:55 +02:00
|
|
|
ARMCPUTestParams("apple-m1", "armv8.5-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP16 |
|
|
|
|
AArch64::AEK_FP16FML,
|
|
|
|
"8.5-A"),
|
2020-12-15 16:49:26 +01:00
|
|
|
ARMCPUTestParams("apple-s4", "armv8.3-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_FP16,
|
|
|
|
"8.3-A"),
|
|
|
|
ARMCPUTestParams("apple-s5", "armv8.3-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_FP16,
|
|
|
|
"8.3-A"),
|
|
|
|
ARMCPUTestParams("exynos-m3", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("exynos-m4", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("exynos-m5", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("falkor", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_RDM,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("kryo", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("neoverse-e1", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("neoverse-n1", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_PROFILE | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_RCPC | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_SSBS,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("neoverse-n2", "armv8.5-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_SVE |
|
|
|
|
AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_MTE |
|
|
|
|
AArch64::AEK_SSBS | AArch64::AEK_SB |
|
|
|
|
AArch64::AEK_SVE2 | AArch64::AEK_SVE2BITPERM |
|
|
|
|
AArch64::AEK_BF16 | AArch64::AEK_I8MM,
|
|
|
|
"8.5-A"),
|
|
|
|
ARMCPUTestParams("thunderx2t99", "armv8.1-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_NONE | AArch64::AEK_CRC |
|
|
|
|
AArch64::AEK_CRYPTO | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_SIMD,
|
|
|
|
"8.1-A"),
|
|
|
|
ARMCPUTestParams("thunderx3t110", "armv8.3-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RDM |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_PROFILE | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_RAND | AArch64::AEK_RCPC,
|
|
|
|
"8.3-A"),
|
|
|
|
ARMCPUTestParams("thunderx", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_PROFILE,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("thunderxt81", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_PROFILE,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("thunderxt83", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_PROFILE,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("thunderxt88", "armv8-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_SIMD | AArch64::AEK_FP |
|
|
|
|
AArch64::AEK_PROFILE,
|
|
|
|
"8-A"),
|
|
|
|
ARMCPUTestParams("tsv110", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_RAS | AArch64::AEK_LSE |
|
|
|
|
AArch64::AEK_RDM | AArch64::AEK_PROFILE |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_FP16FML |
|
|
|
|
AArch64::AEK_DOTPROD,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("a64fx", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_SVE |
|
|
|
|
AArch64::AEK_RDM,
|
|
|
|
"8.2-A"),
|
|
|
|
ARMCPUTestParams("carmel", "armv8.2-a", "crypto-neon-fp-armv8",
|
|
|
|
AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
|
|
|
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
|
|
|
AArch64::AEK_FP16 | AArch64::AEK_RAS |
|
|
|
|
AArch64::AEK_LSE | AArch64::AEK_RDM,
|
2021-05-14 19:15:20 +02:00
|
|
|
"8.2-A")));
|
2020-12-15 16:49:26 +01:00
|
|
|
|
2021-04-15 04:34:55 +02:00
|
|
|
static constexpr unsigned NumAArch64CPUArchs = 48;
|
2018-02-08 17:48:54 +01:00
|
|
|
|
|
|
|
TEST(TargetParserTest, testAArch64CPUArchList) {
|
|
|
|
SmallVector<StringRef, NumAArch64CPUArchs> List;
|
|
|
|
AArch64::fillValidCPUArchList(List);
|
|
|
|
|
|
|
|
// No list exists for these in this test suite, so ensure all are
|
|
|
|
// valid, and match the expected 'magic' count.
|
|
|
|
EXPECT_EQ(List.size(), NumAArch64CPUArchs);
|
|
|
|
for(StringRef CPU : List) {
|
|
|
|
EXPECT_NE(AArch64::parseCPUArch(CPU), AArch64::ArchKind::INVALID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-06 03:22:08 +01:00
|
|
|
bool testAArch64Arch(StringRef Arch, StringRef DefaultCPU, StringRef SubArch,
|
|
|
|
unsigned ArchAttr) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
AArch64::ArchKind AK = AArch64::parseArch(Arch);
|
|
|
|
return (AK != AArch64::ArchKind::INVALID) &
|
2016-12-06 03:22:08 +01:00
|
|
|
AArch64::getDefaultCPU(Arch).equals(DefaultCPU) &
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
AArch64::getSubArch(AK).equals(SubArch) &
|
|
|
|
(AArch64::getArchAttr(AK) == ArchAttr);
|
2016-12-06 03:22:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, testAArch64Arch) {
|
|
|
|
EXPECT_TRUE(testAArch64Arch("armv8-a", "cortex-a53", "v8",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
|
|
|
EXPECT_TRUE(testAArch64Arch("armv8.1-a", "generic", "v8.1a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
|
|
|
EXPECT_TRUE(testAArch64Arch("armv8.2-a", "generic", "v8.2a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2017-08-22 14:46:33 +02:00
|
|
|
EXPECT_TRUE(testAArch64Arch("armv8.3-a", "generic", "v8.3a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2018-09-26 15:09:15 +02:00
|
|
|
EXPECT_TRUE(testAArch64Arch("armv8.4-a", "generic", "v8.4a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2018-09-26 14:48:21 +02:00
|
|
|
EXPECT_TRUE(testAArch64Arch("armv8.5-a", "generic", "v8.5a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
[PATCH] [ARM] ARMv8.6-a command-line + BFloat16 Asm Support
Summary:
This patch introduces command-line support for the Armv8.6-a architecture and assembly support for BFloat16. Details can be found
https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a
in addition to the GCC patch for the 8..6-a CLI:
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-11/msg02647.html
In detail this patch
- march options for armv8.6-a
- BFloat16 assembly
This is part of a patch series, starting with command-line and Bfloat16
assembly support. The subsequent patches will upstream intrinsics
support for BFloat16, followed by Matrix Multiplication and the
remaining Virtualization features of the armv8.6-a architecture.
Based on work by:
- labrinea
- MarkMurrayARM
- Luke Cheeseman
- Javed Asbar
- Mikhail Maltsev
- Luke Geeson
Reviewers: SjoerdMeijer, craig.topper, rjmccall, jfb, LukeGeeson
Reviewed By: SjoerdMeijer
Subscribers: stuij, kristof.beyls, hiraditya, dexonsmith, danielkiss, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D76062
2020-03-26 09:17:29 +01:00
|
|
|
EXPECT_TRUE(testAArch64Arch("armv8.6-a", "generic", "v8.6a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2020-11-16 15:48:22 +01:00
|
|
|
EXPECT_TRUE(testAArch64Arch("armv8.7-a", "generic", "v8.7a",
|
|
|
|
ARMBuildAttrs::CPUArch::v8_A));
|
2016-12-06 03:22:08 +01:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
bool testAArch64Extension(StringRef CPUName, AArch64::ArchKind AK,
|
2016-12-06 03:22:08 +01:00
|
|
|
StringRef ArchExt) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
return AArch64::getDefaultExtensions(CPUName, AK) &
|
2016-12-06 03:22:08 +01:00
|
|
|
AArch64::parseArchExt(ArchExt);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, testAArch64Extension) {
|
2020-02-11 17:57:25 +01:00
|
|
|
EXPECT_FALSE(testAArch64Extension("cortex-a34",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension("cortex-a35",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("cortex-a53",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
2017-08-21 10:43:06 +02:00
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-a55",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
2020-12-10 13:48:20 +01:00
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-a55",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("cortex-a55",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16fml"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-a55",
|
|
|
|
AArch64::ArchKind::INVALID, "dotprod"));
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension("cortex-a57",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("cortex-a72",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("cortex-a73",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
2017-08-21 10:43:06 +02:00
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-a75",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
2020-12-10 13:48:20 +01:00
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-a75",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("cortex-a75",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16fml"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-a75",
|
|
|
|
AArch64::ArchKind::INVALID, "dotprod"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-r82",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-r82",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-r82",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16fml"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-r82",
|
|
|
|
AArch64::ArchKind::INVALID, "dotprod"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("cortex-r82",
|
|
|
|
AArch64::ArchKind::INVALID, "lse"));
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension("cyclone",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
2017-12-15 00:13:04 +01:00
|
|
|
EXPECT_FALSE(testAArch64Extension("exynos-m3",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
2019-01-11 19:54:25 +01:00
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m4",
|
2019-03-21 19:54:58 +01:00
|
|
|
AArch64::ArchKind::INVALID, "dotprod"));
|
2019-01-11 19:54:25 +01:00
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m4",
|
2019-03-21 19:54:58 +01:00
|
|
|
AArch64::ArchKind::INVALID, "fp16"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m4",
|
|
|
|
AArch64::ArchKind::INVALID, "lse"));
|
2019-01-11 19:54:25 +01:00
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m4",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m4",
|
2019-03-21 19:54:58 +01:00
|
|
|
AArch64::ArchKind::INVALID, "rdm"));
|
2019-03-22 19:42:14 +01:00
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m5",
|
|
|
|
AArch64::ArchKind::INVALID, "dotprod"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m5",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m5",
|
|
|
|
AArch64::ArchKind::INVALID, "lse"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m5",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("exynos-m5",
|
|
|
|
AArch64::ArchKind::INVALID, "rdm"));
|
2017-08-24 16:30:44 +02:00
|
|
|
EXPECT_TRUE(testAArch64Extension("falkor",
|
|
|
|
AArch64::ArchKind::INVALID, "rdm"));
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension("kryo",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
2017-09-25 16:05:00 +02:00
|
|
|
EXPECT_TRUE(testAArch64Extension("saphira",
|
|
|
|
AArch64::ArchKind::INVALID, "crc"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("saphira",
|
|
|
|
AArch64::ArchKind::INVALID, "lse"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("saphira",
|
|
|
|
AArch64::ArchKind::INVALID, "rdm"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("saphira",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("saphira",
|
|
|
|
AArch64::ArchKind::INVALID, "rcpc"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("saphira",
|
|
|
|
AArch64::ArchKind::INVALID, "profile"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("saphira",
|
2018-08-17 13:26:57 +02:00
|
|
|
AArch64::ArchKind::INVALID, "fp16"));
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension("thunderx2t99",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("thunderx",
|
|
|
|
AArch64::ArchKind::INVALID, "lse"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("thunderxt81",
|
|
|
|
AArch64::ArchKind::INVALID, "lse"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("thunderxt83",
|
|
|
|
AArch64::ArchKind::INVALID, "lse"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("thunderxt88",
|
|
|
|
AArch64::ArchKind::INVALID, "lse"));
|
2018-11-09 20:32:08 +01:00
|
|
|
EXPECT_TRUE(testAArch64Extension("tsv110",
|
|
|
|
AArch64::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("tsv110",
|
|
|
|
AArch64::ArchKind::INVALID, "sha3"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("tsv110",
|
|
|
|
AArch64::ArchKind::INVALID, "sm4"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("tsv110",
|
|
|
|
AArch64::ArchKind::INVALID, "ras"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("tsv110",
|
|
|
|
AArch64::ArchKind::INVALID, "profile"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("tsv110",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("tsv110",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16fml"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("tsv110",
|
|
|
|
AArch64::ArchKind::INVALID, "dotprod"));
|
2020-03-03 13:52:27 +01:00
|
|
|
EXPECT_TRUE(testAArch64Extension("a64fx",
|
|
|
|
AArch64::ArchKind::INVALID, "fp16"));
|
|
|
|
EXPECT_TRUE(testAArch64Extension("a64fx",
|
|
|
|
AArch64::ArchKind::INVALID, "sve"));
|
|
|
|
EXPECT_FALSE(testAArch64Extension("a64fx",
|
|
|
|
AArch64::ArchKind::INVALID, "sve2"));
|
[AArch64] Add NVIDIA Carmel support
Summary:
NVIDIA's Carmel ARM64 cores are used in Tegra194 chips found in Jetson AGX Xavier, DRIVE AGX Xavier and DRIVE AGX Pegasus.
References:
* https://devblogs.nvidia.com/nvidia-jetson-agx-xavier-32-teraops-ai-robotics/#h.huq9xtg75a5e
* NVIDIA Xavier Series System-on-Chip Technical Reference Manual 1.3 (https://developer.nvidia.com/embedded/downloads#?search=Xavier%20Series%20SoC%20Technical%20Reference%20Manual)
Reviewers: sdesmalen, paquette
Reviewed By: sdesmalen
Subscribers: llvm-commits, ianshmean, kristof.beyls, hiraditya, jfb, danielkiss, cfe-commits, t.p.northover
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D77940
2020-05-04 12:45:35 +02:00
|
|
|
EXPECT_TRUE(
|
|
|
|
testAArch64Extension("carmel", AArch64::ArchKind::INVALID, "crypto"));
|
|
|
|
EXPECT_TRUE(
|
|
|
|
testAArch64Extension("carmel", AArch64::ArchKind::INVALID, "fp16"));
|
2016-12-06 03:22:08 +01:00
|
|
|
|
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
"generic", AArch64::ArchKind::ARMV8A, "ras"));
|
2016-12-06 03:22:08 +01:00
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
"generic", AArch64::ArchKind::ARMV8_1A, "ras"));
|
2016-12-06 03:22:08 +01:00
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
2018-11-09 20:32:08 +01:00
|
|
|
"generic", AArch64::ArchKind::ARMV8_2A, "profile"));
|
2018-08-17 13:26:57 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
|
|
|
"generic", AArch64::ArchKind::ARMV8_2A, "fp16"));
|
2018-08-17 13:29:49 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
|
|
|
"generic", AArch64::ArchKind::ARMV8_2A, "fp16fml"));
|
2018-08-17 13:26:57 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
|
|
|
"generic", AArch64::ArchKind::ARMV8_3A, "fp16"));
|
2018-08-17 13:29:49 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
|
|
|
"generic", AArch64::ArchKind::ARMV8_3A, "fp16fml"));
|
2018-08-17 13:26:57 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
|
|
|
"generic", AArch64::ArchKind::ARMV8_4A, "fp16"));
|
2018-08-17 13:29:49 +02:00
|
|
|
EXPECT_FALSE(testAArch64Extension(
|
|
|
|
"generic", AArch64::ArchKind::ARMV8_4A, "fp16fml"));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, AArch64ExtensionFeatures) {
|
2020-09-17 21:13:22 +02:00
|
|
|
std::vector<uint64_t> Extensions = {
|
2019-06-20 11:33:11 +02:00
|
|
|
AArch64::AEK_CRC, AArch64::AEK_CRYPTO,
|
|
|
|
AArch64::AEK_FP, AArch64::AEK_SIMD,
|
|
|
|
AArch64::AEK_FP16, AArch64::AEK_PROFILE,
|
|
|
|
AArch64::AEK_RAS, AArch64::AEK_LSE,
|
|
|
|
AArch64::AEK_RDM, AArch64::AEK_DOTPROD,
|
|
|
|
AArch64::AEK_SVE, AArch64::AEK_SVE2,
|
|
|
|
AArch64::AEK_SVE2AES, AArch64::AEK_SVE2SM4,
|
2019-07-26 17:57:50 +02:00
|
|
|
AArch64::AEK_SVE2SHA3, AArch64::AEK_SVE2BITPERM,
|
2019-06-20 11:33:11 +02:00
|
|
|
AArch64::AEK_RCPC, AArch64::AEK_FP16FML };
|
|
|
|
|
2016-10-07 10:37:29 +02:00
|
|
|
std::vector<StringRef> Features;
|
2019-06-20 11:33:11 +02:00
|
|
|
|
2020-09-17 21:13:22 +02:00
|
|
|
uint64_t ExtVal = 0;
|
2019-06-24 10:44:29 +02:00
|
|
|
for (auto Ext : Extensions)
|
|
|
|
ExtVal |= Ext;
|
|
|
|
|
|
|
|
EXPECT_FALSE(AArch64::getExtensionFeatures(AArch64::AEK_INVALID, Features));
|
|
|
|
EXPECT_TRUE(!Features.size());
|
2019-06-20 11:33:11 +02:00
|
|
|
|
|
|
|
AArch64::getExtensionFeatures(ExtVal, Features);
|
2019-06-24 10:44:29 +02:00
|
|
|
EXPECT_TRUE(Extensions.size() == Features.size());
|
|
|
|
|
2020-08-02 06:49:38 +02:00
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+crc"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+crypto"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+fp-armv8"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+neon"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+fullfp16"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+spe"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+ras"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+lse"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+rdm"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+dotprod"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+rcpc"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+fp16fml"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+sve"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+sve2"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+sve2-aes"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+sve2-sm4"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+sve2-sha3"));
|
|
|
|
EXPECT_TRUE(llvm::is_contained(Features, "+sve2-bitperm"));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, AArch64ArchFeatures) {
|
2016-10-07 10:37:29 +02:00
|
|
|
std::vector<StringRef> Features;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
|
2018-12-10 15:26:06 +01:00
|
|
|
for (auto AK : AArch64::ArchKinds)
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-27 18:27:56 +02:00
|
|
|
EXPECT_TRUE((AK == AArch64::ArchKind::INVALID)
|
2016-07-28 08:11:18 +02:00
|
|
|
? !AArch64::getArchFeatures(AK, Features)
|
|
|
|
: AArch64::getArchFeatures(AK, Features));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TargetParserTest, AArch64ArchExtFeature) {
|
|
|
|
const char *ArchExt[][4] = {{"crc", "nocrc", "+crc", "-crc"},
|
|
|
|
{"crypto", "nocrypto", "+crypto", "-crypto"},
|
2021-01-05 13:10:04 +01:00
|
|
|
{"flagm", "noflagm", "+flagm", "-flagm"},
|
2016-07-28 08:11:18 +02:00
|
|
|
{"fp", "nofp", "+fp-armv8", "-fp-armv8"},
|
|
|
|
{"simd", "nosimd", "+neon", "-neon"},
|
|
|
|
{"fp16", "nofp16", "+fullfp16", "-fullfp16"},
|
2018-08-17 13:29:49 +02:00
|
|
|
{"fp16fml", "nofp16fml", "+fp16fml", "-fp16fml"},
|
2016-07-28 08:11:18 +02:00
|
|
|
{"profile", "noprofile", "+spe", "-spe"},
|
2017-07-13 17:19:56 +02:00
|
|
|
{"ras", "noras", "+ras", "-ras"},
|
2017-08-24 16:30:44 +02:00
|
|
|
{"lse", "nolse", "+lse", "-lse"},
|
|
|
|
{"rdm", "nordm", "+rdm", "-rdm"},
|
2017-08-21 10:43:06 +02:00
|
|
|
{"sve", "nosve", "+sve", "-sve"},
|
[AArch64][SVE2] Add SVE2 target features to backend and TargetParser
Summary:
This patch adds the following features defined by Arm SVE2 architecture
extension:
sve2, sve2-aes, sve2-sm4, sve2-sha3, bitperm
For existing CPUs these features are declared as unsupported to prevent
scheduler errors.
The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest
Reviewers: SjoerdMeijer, sdesmalen, ostannard, rovka
Reviewed By: SjoerdMeijer, rovka
Subscribers: rovka, javed.absar, tschuett, kristof.beyls, kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61513
llvm-svn: 360573
2019-05-13 12:10:24 +02:00
|
|
|
{"sve2", "nosve2", "+sve2", "-sve2"},
|
|
|
|
{"sve2-aes", "nosve2-aes", "+sve2-aes",
|
|
|
|
"-sve2-aes"},
|
|
|
|
{"sve2-sm4", "nosve2-sm4", "+sve2-sm4",
|
|
|
|
"-sve2-sm4"},
|
|
|
|
{"sve2-sha3", "nosve2-sha3", "+sve2-sha3",
|
|
|
|
"-sve2-sha3"},
|
2019-07-26 17:57:50 +02:00
|
|
|
{"sve2-bitperm", "nosve2-bitperm",
|
|
|
|
"+sve2-bitperm", "-sve2-bitperm"},
|
2017-08-21 10:43:06 +02:00
|
|
|
{"dotprod", "nodotprod", "+dotprod", "-dotprod"},
|
2018-09-27 16:01:40 +02:00
|
|
|
{"rcpc", "norcpc", "+rcpc", "-rcpc" },
|
2018-10-02 11:36:28 +02:00
|
|
|
{"rng", "norng", "+rand", "-rand"},
|
2018-12-03 15:00:47 +01:00
|
|
|
{"memtag", "nomemtag", "+mte", "-mte"},
|
2019-07-31 14:52:17 +02:00
|
|
|
{"tme", "notme", "+tme", "-tme"},
|
2021-01-04 14:45:49 +01:00
|
|
|
{"pauth", "nopauth", "+pauth", "-pauth"},
|
2018-12-28 18:14:58 +01:00
|
|
|
{"ssbs", "nossbs", "+ssbs", "-ssbs"},
|
2019-01-04 12:04:18 +01:00
|
|
|
{"sb", "nosb", "+sb", "-sb"},
|
2020-04-10 00:00:22 +02:00
|
|
|
{"predres", "nopredres", "+predres", "-predres"},
|
|
|
|
{"i8mm", "noi8mm", "+i8mm", "-i8mm"},
|
|
|
|
{"f32mm", "nof32mm", "+f32mm", "-f32mm"},
|
|
|
|
{"f64mm", "nof64mm", "+f64mm", "-f64mm"},
|
2019-01-04 12:04:18 +01:00
|
|
|
};
|
2016-07-28 08:11:18 +02:00
|
|
|
|
|
|
|
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
|
2016-12-06 03:22:08 +01:00
|
|
|
EXPECT_EQ(StringRef(ArchExt[i][2]),
|
|
|
|
AArch64::getArchExtFeature(ArchExt[i][0]));
|
|
|
|
EXPECT_EQ(StringRef(ArchExt[i][3]),
|
|
|
|
AArch64::getArchExtFeature(ArchExt[i][1]));
|
2016-07-28 08:11:18 +02:00
|
|
|
}
|
|
|
|
}
|
2020-12-15 16:49:26 +01:00
|
|
|
|
|
|
|
} // namespace
|