This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Optimize lowering of floating-point -0.0
ClosedPublic

Authored by frasercrmck on Jan 19 2022, 8:36 AM.

Details

Summary

This idea has come up in several reviews -- D115978 and D105902 -- so I
can't take any credit for the idea. Instead of using a constant pool to
lower -0.0, we can emit a sequence of two instructions:

fmv.[hwd].x freg, zero
fsgnjn.[hsd] freg, freg, freg

This is only done when the floating-point type is legal.

Diff Detail

Event Timeline

frasercrmck created this revision.Jan 19 2022, 8:36 AM
frasercrmck requested review of this revision.Jan 19 2022, 8:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2022, 8:36 AM
This revision is now accepted and ready to land.Jan 19 2022, 8:56 AM
This revision was automatically updated to reflect the committed changes.