0008-RISCV-Support-b-letter-in-march-string.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. From 7f3eaa0f7b494f9091b1916f208d78ba681b19a3 Mon Sep 17 00:00:00 2001
  2. From: "max.ma" <max.ma@starfivetech.com>
  3. Date: Fri, 15 Apr 2022 02:16:43 -0700
  4. Subject: [PATCH 8/9] [RISCV] Support "b" letter in march string
  5. ---
  6. llvm/lib/Support/RISCVISAInfo.cpp | 9 ++++++++-
  7. llvm/lib/Target/RISCV/RISCVFeatures.td | 12 ++++++++++++
  8. 2 files changed, 20 insertions(+), 1 deletion(-)
  9. diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
  10. index 7cb1147d4265..8b3dcc91746b 100644
  11. --- a/llvm/lib/Support/RISCVISAInfo.cpp
  12. +++ b/llvm/lib/Support/RISCVISAInfo.cpp
  13. @@ -64,6 +64,7 @@ static const RISCVSupportedExtension SupportedExtensions[] = {
  14. {"zbb", RISCVExtensionVersion{1, 0}},
  15. {"zbc", RISCVExtensionVersion{1, 0}},
  16. {"zbs", RISCVExtensionVersion{1, 0}},
  17. + {"b", RISCVExtensionVersion{1, 0}},
  18. {"zbkb", RISCVExtensionVersion{1, 0}},
  19. {"zbkc", RISCVExtensionVersion{1, 0}},
  20. @@ -707,7 +708,13 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
  21. "unsupported standard user-level extension '%c'",
  22. C);
  23. }
  24. - ISAInfo->addExtension(std::string(1, C), Major, Minor);
  25. + if (C == 'b') {
  26. + ISAInfo->addExtension("zba", Major, Minor);
  27. + ISAInfo->addExtension("zbb", Major, Minor);
  28. + ISAInfo->addExtension("zbc", Major, Minor);
  29. + ISAInfo->addExtension("zbs", Major, Minor);
  30. + } else
  31. + ISAInfo->addExtension(std::string(1, C), Major, Minor);
  32. // Consume full extension name and version, including any optional '_'
  33. // between this extension and the next
  34. diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td
  35. index be8834fd4c2f..c0443eddeb90 100644
  36. --- a/llvm/lib/Target/RISCV/RISCVFeatures.td
  37. +++ b/llvm/lib/Target/RISCV/RISCVFeatures.td
  38. @@ -547,3 +547,15 @@ def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
  39. "AllowTaggedGlobals",
  40. "true", "Use an instruction sequence for taking the address of a global "
  41. "that allows a memory tag in the upper address bits">;
  42. +
  43. +def FeatureStdExtB
  44. + : SubtargetFeature<"b", "HasStdExtB", "true",
  45. + "'B' (Bit Manipulation Instructions)",
  46. + [FeatureStdExtZba,
  47. + FeatureStdExtZbb,
  48. + FeatureStdExtZbc,
  49. + FeatureStdExtZbs]>;
  50. +def HasStdExtB : Predicate<"Subtarget->hasStdExtB()">,
  51. + AssemblerPredicate<(all_of FeatureStdExtB),
  52. + "'B' (Bit Manipulation Instructions)">;
  53. +
  54. --
  55. 2.25.1