Skip to content

Commit 1822754

Browse files
authored
[AArch64] Allow SVE_AES instructions in streaming mode with SSVE_AES (llvm#115526)
In accordance with https://developer.arm.com/documentation/ddi0602/latest/, the following SVE2 instructions are available in streaming SVE mode if the target has FEAT_SSVE_AES - PMULLB, PMULLT (128-bit element) - AESE (vectors) - AESD (vectors) - AESMC - AESIMC This patch updates the predication of these instructions to reflect this architecture change. Note that the assembler predicates here always require at least one of sve2,ssve-aes due to the following condition on [FEAT_SVE_AES](https://developer.arm.com/documentation/109697/2024_09/Feature-descriptions/The-Armv9-0-architecture-extension?lang=en#md457-the-armv90-architecture-extension__feat_FEAT_SVE_AES) >If FEAT_SVE_AES is implemented, then FEAT_SVE2 or FEAT_SSVE_AES is implemented.
1 parent 91aad9b commit 1822754

File tree

11 files changed

+52
-40
lines changed

11 files changed

+52
-40
lines changed

llvm/lib/Target/AArch64/AArch64.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ let F = [HasSME2p2, HasSVE2p2orSME2p2, HasNonStreamingSVEorSME2p2,
7878
def SME2p2Unsupported : AArch64Unsupported;
7979

8080
def SME2p1Unsupported : AArch64Unsupported {
81-
let F = !listconcat([HasSME2p1, HasSVE2p1_or_HasSME2p1, HasSVE2p1orSSVE_AES],
81+
let F = !listconcat([HasSME2p1, HasSVE2p1_or_HasSME2p1, HasNonStreamingSVE2p1orSSVE_AES],
8282
SME2p2Unsupported.F);
8383
}
8484

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def HasSVE2orSME2
257257
: Predicate<"Subtarget->hasSVE2() || (Subtarget->isStreaming() && Subtarget->hasSME2())">,
258258
AssemblerPredicateWithAll<(any_of FeatureSVE2, FeatureSME2),
259259
"sve2 or sme2">;
260-
def HasSVE2orSSVE_AES
260+
def HasNonStreamingSVE2orSSVE_AES
261261
: Predicate<"(Subtarget->isSVEAvailable() && Subtarget->hasSVE2()) ||"
262262
"(Subtarget->isSVEorStreamingSVEAvailable() && Subtarget->hasSSVE_AES())">,
263263
AssemblerPredicateWithAll<(any_of FeatureSVE2, FeatureSSVE_AES), "sve2 or ssve-aes">;
@@ -273,7 +273,7 @@ def HasSVE2p1_or_HasSME2p1
273273
def HasSVE2p2orSME2p2
274274
: Predicate<"Subtarget->isSVEorStreamingSVEAvailable() && (Subtarget->hasSVE2p2() || Subtarget->hasSME2p2())">,
275275
AssemblerPredicateWithAll<(any_of FeatureSME2p2, FeatureSVE2p2), "sme2p2 or sve2p2">;
276-
def HasSVE2p1orSSVE_AES
276+
def HasNonStreamingSVE2p1orSSVE_AES
277277
: Predicate<"(Subtarget->isSVEAvailable() && Subtarget->hasSVE2p1()) ||"
278278
"(Subtarget->isSVEorStreamingSVEAvailable() && Subtarget->hasSSVE_AES())">,
279279
AssemblerPredicateWithAll<(any_of FeatureSVE2p1, FeatureSSVE_AES), "sve2p1 or ssve-aes">;

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3906,7 +3906,7 @@ let Predicates = [HasSVE2orSME] in {
39063906
defm WHILERW_PXX : sve2_int_while_rr<0b1, "whilerw", "int_aarch64_sve_whilerw">;
39073907
} // End HasSVE2orSME
39083908

3909-
let Predicates = [HasSVE2, HasSVEAES] in {
3909+
let Predicates = [HasSVEAES, HasNonStreamingSVE2orSSVE_AES] in {
39103910
// SVE2 crypto destructive binary operations
39113911
defm AESE_ZZZ_B : sve2_crypto_des_bin_op<0b00, "aese", ZPR8, int_aarch64_sve_aese, nxv16i8>;
39123912
defm AESD_ZZZ_B : sve2_crypto_des_bin_op<0b01, "aesd", ZPR8, int_aarch64_sve_aesd, nxv16i8>;
@@ -3941,7 +3941,7 @@ let Predicates = [HasSVE2BitPerm] in {
39413941
defm BGRP_ZZZ : sve2_misc_bitwise<0b1110, "bgrp", int_aarch64_sve_bgrp_x>;
39423942
} // End HasSVE2BitPerm
39433943

3944-
let Predicates = [HasSVEAES2, HasSVE2p1orSSVE_AES] in {
3944+
let Predicates = [HasSVEAES2, HasNonStreamingSVE2p1orSSVE_AES] in {
39453945
// SVE_AES2 multi-vector instructions (x2)
39463946
def AESE_2ZZI_B : sve_crypto_binary_multi2<0b000, "aese">;
39473947
def AESD_2ZZI_B : sve_crypto_binary_multi2<0b010, "aesd">;
@@ -3956,7 +3956,7 @@ let Predicates = [HasSVEAES2, HasSVE2p1orSSVE_AES] in {
39563956
// SVE_AES2 multi-vector polynomial multiply
39573957
def PMLAL_2ZZZ_Q : sve_crypto_pmlal_multi<"pmlal">;
39583958
def PMULL_2ZZZ_Q : sve_crypto_pmull_multi<"pmull">;
3959-
} // End HasSVEAES2, HasSVE2p1orSSVE_AES
3959+
}
39603960

39613961
//===----------------------------------------------------------------------===//
39623962
// SME or SVE2.1 instructions

llvm/test/MC/AArch64/SVE2/aesd.s

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
33
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2,+sve-aes < %s \
44
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
5+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+ssve-aes,+sve-aes < %s \
6+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
57
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
68
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
79
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s 2>&1 \
810
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
9-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
10-
// RUN: | llvm-objdump -d --mattr=+sve2-aes - | FileCheck %s --check-prefix=CHECK-INST
11-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
12-
// RUN: | llvm-objdump -d --mattr=-sve2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
11+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
12+
// RUN: | llvm-objdump -d --mattr=+sve2,+sve-aes - | FileCheck %s --check-prefix=CHECK-INST
13+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
14+
// RUN: | llvm-objdump -d --mattr=-sve-aes - | FileCheck %s --check-prefix=CHECK-UNKNOWN
1315

1416

1517
aesd z0.b, z0.b, z31.b
1618
// CHECK-INST: aesd z0.b, z0.b, z31.b
1719
// CHECK-ENCODING: [0xe0,0xe7,0x22,0x45]
18-
// CHECK-ERROR: instruction requires: sve2 sve-aes
20+
// CHECK-ERROR: instruction requires: sve2 or ssve-aes sve-aes
1921
// CHECK-UNKNOWN: 4522e7e0 <unknown>

llvm/test/MC/AArch64/SVE2/aese.s

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
33
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2,+sve-aes < %s \
44
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
5+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+ssve-aes,+sve-aes < %s \
6+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
57
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
68
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
79
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s 2>&1 \
810
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
9-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
10-
// RUN: | llvm-objdump -d --mattr=+sve2-aes - | FileCheck %s --check-prefix=CHECK-INST
11-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
12-
// RUN: | llvm-objdump -d --mattr=-sve2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
11+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
12+
// RUN: | llvm-objdump -d --mattr=+sve2,+sve-aes - | FileCheck %s --check-prefix=CHECK-INST
13+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
14+
// RUN: | llvm-objdump -d --mattr=-sve-aes - | FileCheck %s --check-prefix=CHECK-UNKNOWN
1315

1416

1517
aese z0.b, z0.b, z31.b
1618
// CHECK-INST: aese z0.b, z0.b, z31.b
1719
// CHECK-ENCODING: [0xe0,0xe3,0x22,0x45]
18-
// CHECK-ERROR: instruction requires: sve2 sve-aes
20+
// CHECK-ERROR: instruction requires: sve2 or ssve-aes sve-aes
1921
// CHECK-UNKNOWN: 4522e3e0 <unknown>

llvm/test/MC/AArch64/SVE2/aesimc.s

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@
22
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
33
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2,+sve-aes < %s \
44
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
5+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+ssve-aes,+sve-aes < %s \
6+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
57
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
68
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
79
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s 2>&1 \
810
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
9-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
10-
// RUN: | llvm-objdump -d --mattr=+sve2-aes - | FileCheck %s --check-prefix=CHECK-INST
11-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
12-
// RUN: | llvm-objdump -d --mattr=-sve2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
11+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
12+
// RUN: | llvm-objdump -d --mattr=+sve2,+sve-aes - | FileCheck %s --check-prefix=CHECK-INST
13+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
14+
// RUN: | llvm-objdump -d --mattr=-sve-aes - | FileCheck %s --check-prefix=CHECK-UNKNOWN
1315

1416

1517
aesimc z0.b, z0.b
1618
// CHECK-INST: aesimc z0.b, z0.b
1719
// CHECK-ENCODING: [0x00,0xe4,0x20,0x45]
18-
// CHECK-ERROR: instruction requires: sve2 sve-aes
20+
// CHECK-ERROR: instruction requires: sve2 or ssve-aes sve-aes
1921
// CHECK-UNKNOWN: 4520e400 <unknown>
2022

2123
aesimc z31.b, z31.b
2224
// CHECK-INST: aesimc z31.b, z31.b
2325
// CHECK-ENCODING: [0x1f,0xe4,0x20,0x45]
24-
// CHECK-ERROR: instruction requires: sve2 sve-aes
26+
// CHECK-ERROR: instruction requires: sve2 or ssve-aes sve-aes
2527
// CHECK-UNKNOWN: 4520e41f <unknown>

llvm/test/MC/AArch64/SVE2/aesmc.s

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@
22
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
33
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2,+sve-aes < %s \
44
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
5+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+ssve-aes,+sve-aes < %s \
6+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
57
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
68
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
79
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s 2>&1 \
810
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
9-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
10-
// RUN: | llvm-objdump -d --mattr=+sve2-aes - | FileCheck %s --check-prefix=CHECK-INST
11-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
12-
// RUN: | llvm-objdump -d --mattr=-sve2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
11+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
12+
// RUN: | llvm-objdump -d --mattr=+sve2,+sve-aes - | FileCheck %s --check-prefix=CHECK-INST
13+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
14+
// RUN: | llvm-objdump -d --mattr=-sve-aes - | FileCheck %s --check-prefix=CHECK-UNKNOWN
1315

1416

1517
aesmc z0.b, z0.b
1618
// CHECK-INST: aesmc z0.b, z0.b
1719
// CHECK-ENCODING: [0x00,0xe0,0x20,0x45]
18-
// CHECK-ERROR: instruction requires: sve2 sve-aes
20+
// CHECK-ERROR: instruction requires: sve2 or ssve-aes sve-aes
1921
// CHECK-UNKNOWN: 4520e000 <unknown>
2022

2123
aesmc z31.b, z31.b
2224
// CHECK-INST: aesmc z31.b, z31.b
2325
// CHECK-ENCODING: [0x1f,0xe0,0x20,0x45]
24-
// CHECK-ERROR: instruction requires: sve2 sve-aes
26+
// CHECK-ERROR: instruction requires: sve2 or ssve-aes sve-aes
2527
// CHECK-UNKNOWN: 4520e01f <unknown>

llvm/test/MC/AArch64/SVE2/directive-arch_extension-negative.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tbx z0.b, z1.b, z2.b
99
.arch_extension sve-aes
1010
.arch_extension nosve-aes
1111
aesd z23.b, z23.b, z13.b
12-
// CHECK: error: instruction requires: sve2 sve-aes
12+
// CHECK: error: instruction requires: sve2 or ssve-aes sve-aes
1313
// CHECK-NEXT: aesd z23.b, z23.b, z13.b
1414

1515
// nosve2-aes should disable sve-aes but not sve2.

llvm/test/MC/AArch64/SVE2/directive-cpu-negative.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ aesd z23.b, z23.b, z13.b
1414

1515
.cpu generic+sve-aes+nosve-aes
1616
aesd z23.b, z23.b, z13.b
17-
// CHECK: error: instruction requires: sve2 sve-aes
17+
// CHECK: error: instruction requires: sve2 or ssve-aes sve-aes
1818
// CHECK-NEXT: aesd z23.b, z23.b, z13.b
1919

2020
.cpu generic+sve2-sm4

llvm/test/MC/AArch64/SVE2/pmullb-128.s

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
33
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2,sve-aes < %s \
44
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
5+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+ssve-aes,+sve-aes < %s \
6+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
57
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
68
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
79
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s 2>&1 \
810
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
9-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
10-
// RUN: | llvm-objdump -d --mattr=+sve2-aes - | FileCheck %s --check-prefix=CHECK-INST
11-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
12-
// RUN: | llvm-objdump -d --mattr=-sve2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
11+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
12+
// RUN: | llvm-objdump -d --mattr=+sve2,+sve-aes - | FileCheck %s --check-prefix=CHECK-INST
13+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
14+
// RUN: | llvm-objdump -d --mattr=-sve-aes - | FileCheck %s --check-prefix=CHECK-UNKNOWN
1315

1416

1517
pmullb z29.q, z30.d, z31.d
1618
// CHECK-INST: pmullb z29.q, z30.d, z31.d
1719
// CHECK-ENCODING: [0xdd,0x6b,0x1f,0x45]
18-
// CHECK-ERROR: instruction requires: sve2 sve-aes
20+
// CHECK-ERROR: instruction requires: sve2 or ssve-aes sve-aes
1921
// CHECK-UNKNOWN: 451f6bdd <unknown>

llvm/test/MC/AArch64/SVE2/pmullt-128.s

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
33
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2,+sve-aes < %s \
44
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
5+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+ssve-aes,+sve-aes < %s \
6+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
57
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
68
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
79
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sme < %s 2>&1 \
810
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
9-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
10-
// RUN: | llvm-objdump -d --mattr=+sve2-aes - | FileCheck %s --check-prefix=CHECK-INST
11-
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2-aes < %s \
12-
// RUN: | llvm-objdump -d --mattr=-sve2 - | FileCheck %s --check-prefix=CHECK-UNKNOWN
11+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
12+
// RUN: | llvm-objdump -d --mattr=+sve2,+sve-aes - | FileCheck %s --check-prefix=CHECK-INST
13+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sve2,+sve-aes < %s \
14+
// RUN: | llvm-objdump -d --mattr=-sve-aes - | FileCheck %s --check-prefix=CHECK-UNKNOWN
1315

1416

1517
pmullt z29.q, z30.d, z31.d
1618
// CHECK-INST: pmullt z29.q, z30.d, z31.d
1719
// CHECK-ENCODING: [0xdd,0x6f,0x1f,0x45]
18-
// CHECK-ERROR: instruction requires: sve2 sve-aes
20+
// CHECK-ERROR: instruction requires: sve2 or ssve-aes sve-aes
1921
// CHECK-UNKNOWN: 451f6fdd <unknown>

0 commit comments

Comments
 (0)