diff options
author | mingmingl <mingmingl@google.com> | 2025-02-04 11:11:14 -0800 |
---|---|---|
committer | mingmingl <mingmingl@google.com> | 2025-02-04 11:11:14 -0800 |
commit | e91747a92d27ecf799427bf563f9f64f7c4d2447 (patch) | |
tree | 7aa5a8a9170deec293e152bdf2be804399dcd612 /llvm/unittests/TargetParser | |
parent | 3a8d9337d816aef41c3ca1484be8b933a71a3c46 (diff) | |
parent | 53d6e59b594639417cdbfcfa2d18cea64acb4009 (diff) | |
download | llvm-users/mingmingl-llvm/spr/sdpglobalvariable.zip llvm-users/mingmingl-llvm/spr/sdpglobalvariable.tar.gz llvm-users/mingmingl-llvm/spr/sdpglobalvariable.tar.bz2 |
Merge branch 'main' into users/mingmingl-llvm/spr/sdpglobalvariableusers/mingmingl-llvm/spr/sdpglobalvariable
Diffstat (limited to 'llvm/unittests/TargetParser')
-rw-r--r-- | llvm/unittests/TargetParser/TargetParserTest.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp index c594d38..1f346c9 100644 --- a/llvm/unittests/TargetParser/TargetParserTest.cpp +++ b/llvm/unittests/TargetParser/TargetParserTest.cpp @@ -10,6 +10,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/ARMBuildAttributes.h" #include "llvm/Support/Debug.h" #include "llvm/Support/FormatVariadic.h" @@ -2085,4 +2086,54 @@ INSTANTIATE_TEST_SUITE_P( AArch64ExtensionDependenciesBaseCPUTestFixture, ::testing::ValuesIn(AArch64ExtensionDependenciesCPUData)); +struct CheckFindSinglePrecisionFpuTest { + StringRef Cpu; + ARM::ArchKind Arch; + StringRef Archext; + std::vector<StringRef> Features; + ARM::FPUKind Fpu; + ARM::FPUKind Output; +}; + +TEST(TargetParserTest, checkFindSinglePrecisionFPU) { + CheckFindSinglePrecisionFpuTest tests[] = { + {"cortex-r4f", + ARM::ArchKind::ARMV7R, + "nofp.dp", + {}, + ARM::FK_INVALID, + ARM::FK_VFPV3XD}, + {"cortex-r7", + ARM::ArchKind::ARMV7R, + "nofp.dp", + {}, + ARM::FK_INVALID, + ARM::FK_VFPV3XD_FP16}, + {"cortex-a7", + ARM::ArchKind::ARMV7A, + "nofp.dp", + {}, + ARM::FK_INVALID, + ARM::FK_FPV4_SP_D16}, + {"cortex-r52", + ARM::ArchKind::ARMV8R, + "nofp.dp", + {}, + ARM::FK_INVALID, + ARM::FK_FPV5_SP_D16}, + {"cortex-m55", + ARM::ArchKind::ARMV8_1MMainline, + "nofp.dp", + {}, + ARM::FK_INVALID, + ARM::FK_FP_ARMV8_FULLFP16_SP_D16}}; + + for (auto X : tests) { + ARM::FPUKind FPU = X.Fpu; + EXPECT_TRUE( + ARM::appendArchExtFeatures(X.Cpu, X.Arch, X.Archext, X.Features, FPU)); + EXPECT_EQ(FPU, X.Output); + } +} + } // namespace |