[AArch64] Modeling NZCV read/write for MOPS instructions

According to the specification, MOPS instructions define/use NZCV flags as
part of their semantics (see discussion in
https://reviews.llvm.org/D116157).

More specifically, the specification of the MOPS extension states that
each memcpy/memset/memmov operation will be performed by a series
of three MOPS instructions P, M and E. The P instruction writes to the
NZCV flags, while the others (M and E) reads from the NZCV flags.

This is part 2/4 of a series of patches split from
https://reviews.llvm.org/D117405 to facilitate reviewing.

Differential Revision: https://reviews.llvm.org/D117757
This commit is contained in:
tyb0807 2022-01-18 19:24:11 +00:00
parent 51e188d079
commit 13660715e6
1 changed files with 23 additions and 13 deletions

View File

@ -8333,23 +8333,33 @@ let Predicates = [HasLS64] in {
}
let Predicates = [HasMOPS] in {
defm CPYFP : MOPSMemoryCopyInsns<0b00, "cpyfp">;
defm CPYFM : MOPSMemoryCopyInsns<0b01, "cpyfm">;
defm CPYFE : MOPSMemoryCopyInsns<0b10, "cpyfe">;
let Defs = [NZCV] in {
defm CPYFP : MOPSMemoryCopyInsns<0b00, "cpyfp">;
defm CPYP : MOPSMemoryMoveInsns<0b00, "cpyp">;
defm CPYM : MOPSMemoryMoveInsns<0b01, "cpym">;
defm CPYE : MOPSMemoryMoveInsns<0b10, "cpye">;
defm CPYP : MOPSMemoryMoveInsns<0b00, "cpyp">;
defm SETP : MOPSMemorySetInsns<0b00, "setp">;
defm SETM : MOPSMemorySetInsns<0b01, "setm">;
defm SETE : MOPSMemorySetInsns<0b10, "sete">;
defm SETP : MOPSMemorySetInsns<0b00, "setp">;
}
let Uses = [NZCV] in {
defm CPYFM : MOPSMemoryCopyInsns<0b01, "cpyfm">;
defm CPYFE : MOPSMemoryCopyInsns<0b10, "cpyfe">;
defm CPYM : MOPSMemoryMoveInsns<0b01, "cpym">;
defm CPYE : MOPSMemoryMoveInsns<0b10, "cpye">;
defm SETM : MOPSMemorySetInsns<0b01, "setm">;
defm SETE : MOPSMemorySetInsns<0b10, "sete">;
}
}
let Predicates = [HasMOPS, HasMTE] in {
defm SETGP : MOPSMemorySetTaggingInsns<0b00, "setgp">;
defm SETGM : MOPSMemorySetTaggingInsns<0b01, "setgm">;
// Can't use SETGE because it's a reserved name in TargetSelectionDAG.td
defm MOPSSETGE : MOPSMemorySetTaggingInsns<0b10, "setge">;
let Defs = [NZCV] in {
defm SETGP : MOPSMemorySetTaggingInsns<0b00, "setgp">;
}
let Uses = [NZCV] in {
defm SETGM : MOPSMemorySetTaggingInsns<0b01, "setgm">;
// Can't use SETGE because it's a reserved name in TargetSelectionDAG.td
defm MOPSSETGE : MOPSMemorySetTaggingInsns<0b10, "setge">;
}
}
let Defs = [X16, X17], mayStore = 1, isCodeGenOnly = 1 in