Skip to content

Commit a907351

Browse files
[AArch64] Add support for Armv9.6-A FEAT_PoPS architecture extension
Add support for the following Armv9.6-A architecture extensions: * FEAT_PoPS - Point of Physical Storage as documented here: https://developer.arm.com/documentation/109697/2024_09/Feature-descriptions/The-Armv9-6-architecture-extension Co-authored-by: Alfie Richards <[email protected]>
1 parent e2766b2 commit a907351

File tree

8 files changed

+42
-1
lines changed

8 files changed

+42
-1
lines changed

clang/test/Driver/aarch64-v96a.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,8 @@
6565
// RUN: %clang -target aarch64 -march=armv9.6a+pcdphint -### -c %s 2>&1 | FileCheck -check-prefix=V96A-PCDPHINT %s
6666
// RUN: %clang -target aarch64 -march=armv9.6-a+pcdphint -### -c %s 2>&1 | FileCheck -check-prefix=V96A-PCDPHINT %s
6767
// V96A-PCDPHINT: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.6a"{{.*}} "-target-feature" "+pcdphint"
68+
69+
// RUN: %clang -target aarch64 -march=armv9.6a+pops -### -c %s 2>&1 | FileCheck -check-prefix=V96A-POPS %s
70+
// RUN: %clang -target aarch64 -march=armv9.6-a+pops -### -c %s 2>&1 | FileCheck -check-prefix=V96A-POPS %s
71+
// V96A-POPS: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.6a"{{.*}} "-target-feature" "+pops"
6872
//

clang/test/Driver/print-supported-extensions-aarch64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
// CHECK-NEXT: pauth-lr FEAT_PAuth_LR Enable Armv9.5-A PAC enhancements
5151
// CHECK-NEXT: pcdphint FEAT_PCDPHINT Enable Armv9.6-A Producer Consumer Data Placement hints
5252
// CHECK-NEXT: pmuv3 FEAT_PMUv3 Enable Armv8.0-A PMUv3 Performance Monitors extension
53+
// CHECK-NEXT: pops FEAT_PoPS Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions
5354
// CHECK-NEXT: predres FEAT_SPECRES Enable Armv8.5-A execution and data prediction invalidation instructions
5455
// CHECK-NEXT: rng FEAT_RNG Enable Random Number generation instructions
5556
// CHECK-NEXT: ras FEAT_RAS, FEAT_RASv1p1 Enable Armv8.0-A Reliability, Availability and Serviceability Extensions

llvm/lib/Target/AArch64/AArch64Features.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ def FeatureOCCMO: ExtensionWithMArch<"occmo", "OCCMO", "FEAT_OCCMO",
564564
def FeaturePCDPHINT: ExtensionWithMArch<"pcdphint", "PCDPHINT", "FEAT_PCDPHINT",
565565
"Enable Armv9.6-A Producer Consumer Data Placement hints">;
566566

567+
def FeaturePoPS: ExtensionWithMArch<"pops", "PoPS", "FEAT_PoPS",
568+
"Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions">;
569+
567570
//===----------------------------------------------------------------------===//
568571
// Other Features
569572
//===----------------------------------------------------------------------===//

llvm/lib/Target/AArch64/AArch64SystemOperands.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,3 +2048,10 @@ let Requires = [{ {AArch64::FeaturePCDPHINT} }] in {
20482048

20492049
// v9.6a Realm management extension enhancements
20502050
def : RWSysReg<"GPCBW_EL3", 0b11, 0b110, 0b0010, 0b0001, 0b101>;
2051+
2052+
// v9.6 FEAT_PoPS
2053+
//
2054+
let Requires = [{ {AArch64::FeaturePoPS} }] in {
2055+
def : DC<"CIGDVAPS", 0b000, 0b0111, 0b1111, 0b101>;
2056+
def : DC<"CIVAPS", 0b000, 0b0111, 0b1111, 0b001>;
2057+
}

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3794,6 +3794,7 @@ static const struct Extension {
37943794
{"sme-fa64", {AArch64::FeatureSMEFA64}},
37953795
{"cpa", {AArch64::FeatureCPA}},
37963796
{"tlbiw", {AArch64::FeatureTLBIW}},
3797+
{"pops", {AArch64::FeaturePoPS}},
37973798
{"cmpbr", {AArch64::FeatureCMPBR}},
37983799
{"f8f32mm", {AArch64::FeatureF8F32MM}},
37993800
{"f8f16mm", {AArch64::FeatureF8F16MM}},

llvm/test/MC/AArch64/armv9.6a-ras.s

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: not llvm-mc -triple aarch64 -show-encoding < %s 2>&1 | FileCheck %s --check-prefix NO-POPS
2+
// RUN: llvm-mc -triple aarch64 -mattr=+pops -show-encoding < %s 2>&1 | FileCheck %s --check-prefix HAS-POPS
3+
4+
dc CIGDVAPS, x3
5+
dc CIVAPS, x3
6+
// NO-POPS: error: DC CIGDVAPS requires: pops
7+
// NO-POPS: error: DC CIVAPS requires: pops
8+
9+
# HAS-POPS: .text
10+
11+
# HAS-POPS: dc cigdvaps, x3 // encoding: [0xa3,0x7f,0x08,0xd5]
12+
# HAS-POPS-NEXT: dc civaps, x3 // encoding: [0x23,0x7f,0x08,0xd5]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RUN: llvm-mc -triple aarch64 -mattr=+pops -disassemble < %s | FileCheck %s
2+
3+
#------------------------------------------------------------------------------
4+
# ARMV9.6-A RAS Extensions
5+
#------------------------------------------------------------------------------
6+
7+
[0xa3,0x7f,0x08,0xd5]
8+
# CHECK: dc cigdvaps, x3
9+
10+
[0x23,0x7f,0x08,0xd5]
11+
# CHECK: dc civaps, x3

llvm/unittests/TargetParser/TargetParserTest.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
13331333
AArch64::AEK_F8F16MM, AArch64::AEK_LSFE,
13341334
AArch64::AEK_FPRCVT, AArch64::AEK_CMPBR,
13351335
AArch64::AEK_LSUI, AArch64::AEK_OCCMO,
1336-
AArch64::AEK_PCDPHINT,
1336+
AArch64::AEK_PCDPHINT, AArch64::AEK_POPS,
13371337
};
13381338

13391339
std::vector<StringRef> Features;
@@ -1437,6 +1437,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
14371437
EXPECT_TRUE(llvm::is_contained(Features, "+lsui"));
14381438
EXPECT_TRUE(llvm::is_contained(Features, "+occmo"));
14391439
EXPECT_TRUE(llvm::is_contained(Features, "+pcdphint"));
1440+
EXPECT_TRUE(llvm::is_contained(Features, "+pops"));
14401441

14411442
// Assuming we listed every extension above, this should produce the same
14421443
// result.
@@ -1592,6 +1593,7 @@ TEST(TargetParserTest, AArch64ArchExtFeature) {
15921593
{"lsui", "nolsui", "+lsui", "-lsui"},
15931594
{"occmo", "nooccmo", "+occmo", "-occmo"},
15941595
{"pcdphint", "nopcdphint", "+pcdphint", "-pcdphint"},
1596+
{"pops", "nopops", "+pops", "-pops"},
15951597
};
15961598

15971599
for (unsigned i = 0; i < std::size(ArchExt); i++) {

0 commit comments

Comments
 (0)