Page MenuHomePhabricator

[NVPTX] Fix lowering of frem for negative values
ClosedPublic

Authored by ThomasRaoux on May 14 2021, 1:18 PM.

Details

Summary

to match fmod frem result must have the dividend sign. Previous implementation had the wrong sign when passing negative numbers. For ex: frem(-16, 7) was returning 5 instead of -2. We should just a ftrunc instead of floor when lowering to get the right behavior.

Diff Detail

Event Timeline

ThomasRaoux created this revision.May 14 2021, 1:18 PM
ThomasRaoux requested review of this revision.May 14 2021, 1:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2021, 1:18 PM
mravishankar accepted this revision.May 17 2021, 10:47 AM

Nice catch! Looks good to me. Maybe wait for Justin to take a look as well.

This revision is now accepted and ready to land.May 17 2021, 10:47 AM
This revision was automatically updated to reflect the committed changes.