This is an archive of the discontinued LLVM Phabricator instance.

Clarified the direction rounding occurs in uitofp and sitofp is unspecified
Needs RevisionPublic

Authored by mswadling on Jan 12 2015, 4:23 PM.

Details

Summary

LLVM does not specify which direction to round ints when converting to floating point numbers. On x86, the direction depends on the status register. By specifying this in the LangRef it ensures no assumptions are made.

Diff Detail

Repository
rL LLVM

Event Timeline

mswadling updated this revision to Diff 18061.Jan 12 2015, 4:23 PM
mswadling retitled this revision from to Clarified the direction rounding occurs in uitofp and sitofp is unspecified.
mswadling updated this object.
mswadling edited the test plan for this revision. (Show Details)
mswadling set the repository for this revision to rL LLVM.
mswadling added a subscriber: Unknown Object (MLST).Jan 12 2015, 4:26 PM
scanon edited edge metadata.Mar 9 2015, 6:14 AM

I'm uncomfortable with this change, as I believe that it makes the llvm conversions incompatible with IEEE-754 conversion (which round according to the dynamic rounding mode unless they're in a (language defined) block with static rounding attribute).

I would much prefer that we say something like "On targets with dynamic rounding modes, [su]itofp rounds according to the dynamic mode. On targets without dynamic rounding, [su]itofp uses default rounding."

chandlerc requested changes to this revision.Mar 29 2015, 2:25 PM
chandlerc edited edge metadata.

What scanon said.

This revision now requires changes to proceed.Mar 29 2015, 2:25 PM