[llvm] r302078 - [AArch64] Make the TargetParser add CPU exts provided by the arch.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 14:05:14 PDT 2017
On Wed, May 3, 2017 at 1:33 PM, Ahmed Bougacha via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: ab
> Date: Wed May 3 15:33:58 2017
> New Revision: 302078
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302078&view=rev
> Log:
> [AArch64] Make the TargetParser add CPU exts provided by the arch.
>
> Otherwise, each CPU has to manually specify the extensions it supports,
> even though they have to be a superset of the base arch extensions.
> And when there's redundant data there's stale data, so most of the CPUs
> lie about the features they support (almost none lists AEK_FP).
>
> Instead, do the saner thing: add the optional extensions on top of the
> base extensions provided by the architecture.
>
> The ARM TargetParser has the same behavior.
>
> Differential Revision: https://reviews.llvm.org/D32780
>
> Modified:
> llvm/trunk/include/llvm/Support/AArch64TargetParser.def
> llvm/trunk/lib/Support/TargetParser.cpp
> llvm/trunk/unittests/Support/TargetParserTest.cpp
>
> Modified: llvm/trunk/include/llvm/Support/AArch64TargetParser.def
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AArch64TargetParser.def?rev=302078&r1=302077&r2=302078&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/AArch64TargetParser.def (original)
> +++ llvm/trunk/include/llvm/Support/AArch64TargetParser.def Wed May 3 15:33:58 2017
> @@ -51,38 +51,37 @@ AARCH64_ARCH_EXT_NAME("ras", AArch64
> #define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT)
> #endif
> AARCH64_CPU_NAME("cortex-a35", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("cortex-a53", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, true,
> - ( AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("cortex-a57", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("cortex-a72", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("cortex-a73", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("cyclone", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_NONE))
> AARCH64_CPU_NAME("exynos-m1", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("exynos-m2", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("exynos-m3", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("falkor", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("kryo", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO))
> + (AArch64::AEK_CRC))
> AARCH64_CPU_NAME("thunderx2t99", AK_ARMV8_1A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_LSE | AArch64::AEK_CRC |
> - AArch64::AEK_CRYPTO))
> + (AArch64::AEK_NONE))
> AARCH64_CPU_NAME("thunderx", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP | AArch64::AEK_PROFILE))
> + (AArch64::AEK_CRC | AArch64::AEK_PROFILE))
> AARCH64_CPU_NAME("thunderxt88", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP | AArch64::AEK_PROFILE))
> + (AArch64::AEK_CRC | AArch64::AEK_PROFILE))
> AARCH64_CPU_NAME("thunderxt81", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP | AArch64::AEK_PROFILE))
> + (AArch64::AEK_CRC | AArch64::AEK_PROFILE))
> AARCH64_CPU_NAME("thunderxt83", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
> - (AArch64::AEK_SIMD | AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP | AArch64::AEK_PROFILE))
> + (AArch64::AEK_CRC | AArch64::AEK_PROFILE))
> // Invalid CPU
> AARCH64_CPU_NAME("invalid", AK_INVALID, FK_INVALID, true, AArch64::AEK_INVALID)
> #undef AARCH64_CPU_NAME
>
> Modified: llvm/trunk/lib/Support/TargetParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetParser.cpp?rev=302078&r1=302077&r2=302078&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/TargetParser.cpp (original)
> +++ llvm/trunk/lib/Support/TargetParser.cpp Wed May 3 15:33:58 2017
> @@ -423,7 +423,7 @@ unsigned llvm::AArch64::getDefaultExtens
>
> return StringSwitch<unsigned>(CPU)
> #define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
> - .Case(NAME, DEFAULT_EXT)
> + .Case(NAME, AArch64ARCHNames[(unsigned)ArchKind::ID].ArchBaseExtensions | DEFAULT_EXT)
g++ is not happy about this; should be fixed in r302081.
-Ahmed
> #include "llvm/Support/AArch64TargetParser.def"
> .Default(AArch64::AEK_INVALID);
> }
>
> Modified: llvm/trunk/unittests/Support/TargetParserTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TargetParserTest.cpp?rev=302078&r1=302077&r2=302078&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/Support/TargetParserTest.cpp (original)
> +++ llvm/trunk/unittests/Support/TargetParserTest.cpp Wed May 3 15:33:58 2017
> @@ -611,48 +611,58 @@ bool testAArch64CPU(StringRef CPUName, S
> TEST(TargetParserTest, testAArch64CPU) {
> EXPECT_TRUE(testAArch64CPU(
> "invalid", "invalid", "invalid",
> - AArch64::AEK_INVALID, ""));
> + AArch64::AEK_NONE, ""));
> EXPECT_TRUE(testAArch64CPU(
> "generic", "invalid", "none",
> AArch64::AEK_NONE, ""));
>
> EXPECT_TRUE(testAArch64CPU(
> "cortex-a35", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "cortex-a53", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "cortex-a57", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "cortex-a72", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "cortex-a73", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "cyclone", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRYPTO | AArch64::AEK_FP | AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "exynos-m1", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "exynos-m2", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "exynos-m3", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "falkor", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "kryo", "armv8-a", "crypto-neon-fp-armv8",
> - AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD, "8-A"));
> + AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
> + AArch64::AEK_SIMD, "8-A"));
> EXPECT_TRUE(testAArch64CPU(
> "thunderx2t99", "armv8.1-a", "crypto-neon-fp-armv8",
> AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_LSE |
> - AArch64::AEK_SIMD, "8.1-A"));
> + AArch64::AEK_FP | AArch64::AEK_SIMD, "8.1-A"));
> EXPECT_TRUE(testAArch64CPU(
> "thunderx", "armv8-a", "crypto-neon-fp-armv8",
> AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_SIMD |
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list