Skip to content

[AArch64] Add support for Armv9.6-A FEAT_PoPS architecture extension #113496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/test/Driver/aarch64-v96a.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@
// RUN: %clang -target aarch64 -march=armv9.6a+pcdphint -### -c %s 2>&1 | FileCheck -check-prefix=V96A-PCDPHINT %s
// RUN: %clang -target aarch64 -march=armv9.6-a+pcdphint -### -c %s 2>&1 | FileCheck -check-prefix=V96A-PCDPHINT %s
// V96A-PCDPHINT: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.6a"{{.*}} "-target-feature" "+pcdphint"

// RUN: %clang -target aarch64 -march=armv9.6a+pops -### -c %s 2>&1 | FileCheck -check-prefix=V96A-POPS %s
// RUN: %clang -target aarch64 -march=armv9.6-a+pops -### -c %s 2>&1 | FileCheck -check-prefix=V96A-POPS %s
// V96A-POPS: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.6a"{{.*}} "-target-feature" "+pops"
//
1 change: 1 addition & 0 deletions clang/test/Driver/print-supported-extensions-aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
// CHECK-NEXT: pauth-lr FEAT_PAuth_LR Enable Armv9.5-A PAC enhancements
// CHECK-NEXT: pcdphint FEAT_PCDPHINT Enable Armv9.6-A Producer Consumer Data Placement hints
// CHECK-NEXT: pmuv3 FEAT_PMUv3 Enable Armv8.0-A PMUv3 Performance Monitors extension
// CHECK-NEXT: pops FEAT_PoPS Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions
// CHECK-NEXT: predres FEAT_SPECRES Enable Armv8.5-A execution and data prediction invalidation instructions
// CHECK-NEXT: rng FEAT_RNG Enable Random Number generation instructions
// CHECK-NEXT: ras FEAT_RAS, FEAT_RASv1p1 Enable Armv8.0-A Reliability, Availability and Serviceability Extensions
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/AArch64/AArch64Features.td
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ def FeatureOCCMO: ExtensionWithMArch<"occmo", "OCCMO", "FEAT_OCCMO",
def FeaturePCDPHINT: ExtensionWithMArch<"pcdphint", "PCDPHINT", "FEAT_PCDPHINT",
"Enable Armv9.6-A Producer Consumer Data Placement hints">;

def FeaturePoPS: ExtensionWithMArch<"pops", "PoPS", "FEAT_PoPS",
"Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions">;

//===----------------------------------------------------------------------===//
// Other Features
//===----------------------------------------------------------------------===//
Expand Down
7 changes: 7 additions & 0 deletions llvm/lib/Target/AArch64/AArch64SystemOperands.td
Original file line number Diff line number Diff line change
Expand Up @@ -2061,3 +2061,10 @@ def : RWSysReg<"PMBSR_EL3", 0b11, 0b110, 0b1001, 0b1010, 0b011>;
def : RWSysReg<"TRBSR_EL12", 0b11, 0b101, 0b1001, 0b1011, 0b011>;
def : RWSysReg<"TRBSR_EL2", 0b11, 0b100, 0b1001, 0b1011, 0b011>;
def : RWSysReg<"TRBSR_EL3", 0b11, 0b110, 0b1001, 0b1011, 0b011>;

// v9.6 FEAT_PoPS
//
let Requires = [{ {AArch64::FeaturePoPS} }] in {
def : DC<"CIGDVAPS", 0b000, 0b0111, 0b1111, 0b101>;
def : DC<"CIVAPS", 0b000, 0b0111, 0b1111, 0b001>;
}
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3794,6 +3794,7 @@ static const struct Extension {
{"sme-fa64", {AArch64::FeatureSMEFA64}},
{"cpa", {AArch64::FeatureCPA}},
{"tlbiw", {AArch64::FeatureTLBIW}},
{"pops", {AArch64::FeaturePoPS}},
{"cmpbr", {AArch64::FeatureCMPBR}},
{"f8f32mm", {AArch64::FeatureF8F32MM}},
{"f8f16mm", {AArch64::FeatureF8F16MM}},
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/MC/AArch64/armv9.6a-ras.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: not llvm-mc -triple aarch64 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix NO-POPS
// RUN: llvm-mc -triple aarch64 -mattr=+pops -show-encoding < %s 2>&1 | FileCheck %s --check-prefix HAS-POPS

dc CIGDVAPS, x3
dc CIVAPS, x3
// NO-POPS: error: DC CIGDVAPS requires: pops
// NO-POPS: error: DC CIVAPS requires: pops

# HAS-POPS: .text

# HAS-POPS: dc cigdvaps, x3 // encoding: [0xa3,0x7f,0x08,0xd5]
# HAS-POPS-NEXT: dc civaps, x3 // encoding: [0x23,0x7f,0x08,0xd5]
11 changes: 11 additions & 0 deletions llvm/test/MC/Disassembler/AArch64/armv9.6a-ras.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RUN: llvm-mc -triple aarch64 -mattr=+pops -disassemble < %s | FileCheck %s

#------------------------------------------------------------------------------
# ARMV9.6-A RAS Extensions
#------------------------------------------------------------------------------

[0xa3,0x7f,0x08,0xd5]
# CHECK: dc cigdvaps, x3

[0x23,0x7f,0x08,0xd5]
# CHECK: dc civaps, x3
4 changes: 3 additions & 1 deletion llvm/unittests/TargetParser/TargetParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
AArch64::AEK_F8F16MM, AArch64::AEK_LSFE,
AArch64::AEK_FPRCVT, AArch64::AEK_CMPBR,
AArch64::AEK_LSUI, AArch64::AEK_OCCMO,
AArch64::AEK_PCDPHINT,
AArch64::AEK_PCDPHINT, AArch64::AEK_POPS,
};

std::vector<StringRef> Features;
Expand Down Expand Up @@ -1437,6 +1437,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
EXPECT_TRUE(llvm::is_contained(Features, "+lsui"));
EXPECT_TRUE(llvm::is_contained(Features, "+occmo"));
EXPECT_TRUE(llvm::is_contained(Features, "+pcdphint"));
EXPECT_TRUE(llvm::is_contained(Features, "+pops"));

// Assuming we listed every extension above, this should produce the same
// result.
Expand Down Expand Up @@ -1592,6 +1593,7 @@ TEST(TargetParserTest, AArch64ArchExtFeature) {
{"lsui", "nolsui", "+lsui", "-lsui"},
{"occmo", "nooccmo", "+occmo", "-occmo"},
{"pcdphint", "nopcdphint", "+pcdphint", "-pcdphint"},
{"pops", "nopops", "+pops", "-pops"},
};

for (unsigned i = 0; i < std::size(ArchExt); i++) {
Expand Down
Loading