Skip to content

Commit

Permalink
[CPU] Add support for parsing AArch64 cpu features. (iree-org#19881)
Browse files Browse the repository at this point in the history
A step towards iree-org#19873

---------

Signed-off-by: hanhanW <hanhan0912@gmail.com>
Signed-off-by: Hyunsung Lee <ita9naiwa@gmail.com>
  • Loading branch information
hanhanW authored and ita9naiwa committed Feb 4, 2025
1 parent 67c38d5 commit 55a6fed
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions compiler/plugins/target/LLVMCPU/ResolveCPUAndCPUFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "compiler/plugins/target/LLVMCPU/ResolveCPUAndCPUFeatures.h"

#include "llvm/TargetParser/AArch64TargetParser.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/RISCVTargetParser.h"
#include "llvm/TargetParser/SubtargetFeature.h"
Expand Down Expand Up @@ -61,6 +62,14 @@ resolveCPUFeaturesForCPU(const llvm::Triple &triple, std::string &cpu,
} else if (triple.isRISCV64()) {
llvm::SmallVector<std::string> cpuFeatureList;
addCpuFeatures(llvm::RISCV::getFeaturesForCPU, cpuFeatureList);
} else if (triple.isAArch64()) {
std::vector<llvm::StringRef> cpuFeatureList;
const llvm::AArch64::ArchInfo *cpuArch = llvm::AArch64::getArchForCpu(cpu);
llvm::AArch64::getExtensionFeatures(cpuArch->DefaultExts, cpuFeatureList);
targetCpuFeatures.AddFeature(cpuArch->ArchFeature);
for (const auto &feature : cpuFeatureList) {
targetCpuFeatures.AddFeature(feature);
}
} else {
return ResolveCPUAndCPUFeaturesStatus::UnimplementedMapping;
}
Expand Down

0 comments on commit 55a6fed

Please sign in to comment.