This is an archive of the discontinued LLVM Phabricator instance.

[Sparc][LEON] Fixes an erratum on UT699 LEON 3 processor changing rounding mode
ClosedPublic

Authored by lero_chris on Sep 16 2016, 7:02 AM.

Details

Summary

Changing rounding mode will not work on UT699 processors. This pass will detect the relevant call to fesetround, and issue a user warning that this has happened.

Diff Detail

Repository
rL LLVM

Event Timeline

lero_chris updated this revision to Diff 71639.Sep 16 2016, 7:02 AM
lero_chris retitled this revision from to [Sparc][LEON] Fixes an erratum on UT699 LEON 3 processor changing rounding mode.
lero_chris updated this object.
lero_chris added reviewers: jyknight, jacob_hansen.
lero_chris set the repository for this revision to rL LLVM.
dcederman added inline comments.Sep 28 2016, 7:46 AM
lib/Target/Sparc/LeonFeatures.td
67

There is a trailing whitespace here.

lib/Target/Sparc/LeonPasses.cpp
369

I do not think there is a reason to remove the call, a warning should be enough for what you are trying to achieve. If the program was written to use a special rounding mode then dropping the call would introduce strange errors, so it is better to leave that to the user. Also, what happens if the user is checking the return value of the function? It seems better to just warn, and leave it to the user to remove the call at the C level.

test/CodeGen/SPARC/LeonPreventRoundChangePassUT.ll
2

Is there a reason optimizations are disabled?

25–53

This seems very complex for a test that only checks if a call instruction has been remove or not.

lero_chris updated this revision to Diff 75003.Oct 18 2016, 7:53 AM
lero_chris updated this object.
lero_chris removed rL LLVM as the repository for this revision.

Per comments in review, converted this to detect a rounding change only. It issues an error with a message that this is an erratum on the processor that the user will need to handle in a source code change. The unit test tests that the error message is produced.

dcederman accepted this revision.Oct 19 2016, 6:12 AM
dcederman edited edge metadata.

Now it looks good to me.

I've noticed that some of the source files you have committed previously have accidentally been marked as executable. Perhaps you could change that for the files touched in this patch?

lib/Target/Sparc/LeonPasses.cpp
319

Modified is always false now, so you could return false directly to make it clearer that the pass does not change anything.

This revision is now accepted and ready to land.Oct 19 2016, 6:12 AM
lero_chris closed this revision.Oct 19 2016, 7:03 AM

Closed. May make small change as per last comment in a subsequent check-in.