This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Modeling NZCV read/write for MOPS instructions
ClosedPublic

Authored by tyb0807 on Jan 20 2022, 1:51 AM.

Details

Summary

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.

Diff Detail

Event Timeline

tyb0807 created this revision.Jan 20 2022, 1:51 AM
tyb0807 requested review of this revision.Jan 20 2022, 1:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2022, 1:51 AM

Usually it would be good to have a test for these kinds of changes, but these instructions are never used anywhere (we will use the pseudos for codegen), and I'm not sure of a way to test it otherwise.

For these instructions, marking them as Def NZCV will show that they clobber nzcv which is good. As far as I understand the "P" instruction Defs' and the other ("M", "E") will read the value. Is it worth trying to specify that more precisely? It might not alter a lot atm, but may be good to make sure the info is correct.

tyb0807 updated this revision to Diff 401890.EditedJan 21 2022, 1:03 AM
tyb0807 edited the summary of this revision. (Show Details)

Be more precise about the behaviors of MOPS instructions w.r.t. NZCV flags. Update commit message accordingly

dmgreen accepted this revision.Jan 21 2022, 10:30 AM

Thanks. LGTM

This revision is now accepted and ready to land.Jan 21 2022, 10:30 AM
Matt added a subscriber: Matt.Jan 25 2022, 3:11 PM
This revision was landed with ongoing or failed builds.Jan 31 2022, 12:52 PM
This revision was automatically updated to reflect the committed changes.