This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Don't fold vmerge into ops if fp exception can be raised
ClosedPublic

Authored by luke on Jul 11 2023, 9:25 AM.

Details

Summary

We are already checking for fp exceptions if VL changes, but I believe we
should also be checking for them if the mask changes as well, since that also
affects the set of active elements. From the spec:

A vector floating-point exception at any active floating-point element sets
the standard FP exception flags in the fflags register. Inactive elements do
not set FP exception flags.

Note that we don't change the mask if IsMasked is true, i.e. True is masked
already, since in that case we keep the existing mask.

Diff Detail

Event Timeline

luke created this revision.Jul 11 2023, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 9:25 AM
luke requested review of this revision.Jul 11 2023, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 9:25 AM
reames accepted this revision.Jul 12 2023, 5:15 PM

LGTM w/comments.

p.s. For the record, we can infer safety in a bunch more cases, but this doesn't matter for anything but fp.strict code. (i.e. not the default.)

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
3303–3304

Can you reword this comment? It no longer seems to apply to the code it's adjacent to.

3313

Slight tweak in wording: can't raise any observable fp exceptions

doesn't -> can't - a bound on the actual behavior, not the actual behavior

observable - i.e. non strict is fine.

This revision is now accepted and ready to land.Jul 12 2023, 5:15 PM
This revision was landed with ongoing or failed builds.Jul 13 2023, 3:42 AM
This revision was automatically updated to reflect the committed changes.
luke marked 2 inline comments as done.