This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Teach computeConstantRange that the maximum value of a half is 65504
ClosedPublic

Authored by dmgreen on Oct 28 2021, 2:08 AM.

Details

Summary

The maximal value of a half is 0x7bff, which is 65504 when converted to an integer. This patch teaches that to computeConstantRange to compute a constant range with the correct maximum value.
https://alive2.llvm.org/ce/z/BV_Spb
https://alive2.llvm.org/ce/z/Nwuqvb

The maximum value for a float converted in the same way is 3.4e38, which requires 129bits of data. I have not added that here as integer types so larger are rare, compared to integers types larger than 17 bits require for half floats.

The MVE tests change because instsimplify happens to be run as a port of the backend, where it doesn't tend to for other backends.

Diff Detail

Event Timeline

dmgreen created this revision.Oct 28 2021, 2:08 AM
dmgreen requested review of this revision.Oct 28 2021, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2021, 2:08 AM
This revision is now accepted and ready to land.Oct 28 2021, 3:23 AM
This revision was landed with ongoing or failed builds.Oct 30 2021, 6:27 AM
This revision was automatically updated to reflect the committed changes.