Skip to content

Commit 52274fe

Browse files
committed
[AArch64][SVE] Mark AES instructions commutable.
We are already doing this for the Neon versions of the instructions, just not for SVE.
1 parent 0395584 commit 52274fe

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4064,8 +4064,8 @@ let Predicates = [HasSVE2_or_SME] in {
40644064

40654065
let Predicates = [HasSVEAES, HasNonStreamingSVE2_or_SSVE_AES] in {
40664066
// SVE2 crypto destructive binary operations
4067-
defm AESE_ZZZ_B : sve2_crypto_des_bin_op<0b00, "aese", ZPR8, int_aarch64_sve_aese, nxv16i8>;
4068-
defm AESD_ZZZ_B : sve2_crypto_des_bin_op<0b01, "aesd", ZPR8, int_aarch64_sve_aesd, nxv16i8>;
4067+
defm AESE_ZZZ_B : sve2_crypto_des_bin_op<0b00, "aese", ZPR8, int_aarch64_sve_aese, nxv16i8, /*commutable=*/1>;
4068+
defm AESD_ZZZ_B : sve2_crypto_des_bin_op<0b01, "aesd", ZPR8, int_aarch64_sve_aesd, nxv16i8, /*commutable=*/1>;
40694069

40704070
// SVE2 crypto unary operations
40714071
defm AESMC_ZZ_B : sve2_crypto_unary_op<0b0, "aesmc", int_aarch64_sve_aesmc>;

llvm/lib/Target/AArch64/SVEInstrFormats.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9254,7 +9254,9 @@ class sve2_crypto_des_bin_op<bits<2> opc, string asm, ZPRRegOp zprty>
92549254
}
92559255

92569256
multiclass sve2_crypto_des_bin_op<bits<2> opc, string asm, ZPRRegOp zprty,
9257-
SDPatternOperator op, ValueType vt> {
9257+
SDPatternOperator op, ValueType vt,
9258+
bit commutable = 0> {
9259+
let isCommutable = commutable in
92589260
def NAME : sve2_crypto_des_bin_op<opc, asm, zprty>;
92599261
def : SVE_2_Op_Pat<vt, op, vt, vt, !cast<Instruction>(NAME)>;
92609262
}

llvm/test/CodeGen/AArch64/sve2-intrinsics-crypto.ll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ define <vscale x 16 x i8> @aesd_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b)
1919
define <vscale x 16 x i8> @aesd_i8_commuted(<vscale x 16 x i8> %a,
2020
; CHECK-LABEL: aesd_i8_commuted:
2121
; CHECK: // %bb.0:
22-
; CHECK-NEXT: aesd z1.b, z1.b, z0.b
23-
; CHECK-NEXT: mov z0.d, z1.d
22+
; CHECK-NEXT: aesd z0.b, z0.b, z1.b
2423
; CHECK-NEXT: ret
2524
<vscale x 16 x i8> %b) {
2625
%out = call <vscale x 16 x i8> @llvm.aarch64.sve.aesd(<vscale x 16 x i8> %b,
@@ -58,8 +57,7 @@ define <vscale x 16 x i8> @aese_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b)
5857
define <vscale x 16 x i8> @aese_i8_commuted(<vscale x 16 x i8> %a,
5958
; CHECK-LABEL: aese_i8_commuted:
6059
; CHECK: // %bb.0:
61-
; CHECK-NEXT: aese z1.b, z1.b, z0.b
62-
; CHECK-NEXT: mov z0.d, z1.d
60+
; CHECK-NEXT: aese z0.b, z0.b, z1.b
6361
; CHECK-NEXT: ret
6462
<vscale x 16 x i8> %b) {
6563
%out = call <vscale x 16 x i8> @llvm.aarch64.sve.aese(<vscale x 16 x i8> %b,

0 commit comments

Comments
 (0)