This is an archive of the discontinued LLVM Phabricator instance.

[mips] Introducing option -mabs=[legacy/2008]
ClosedPublic

Authored by abeserminji on Jul 28 2017, 2:00 AM.

Details

Summary

In patch D3274 using abs.[ds] instruction is forced, as they should behave in accordance with flags Has2008 and ABS2008. Unfortunately for revisions prior mips32r6 and mips64r6, abs.[ds] is not generating correct result when working with NaNs. To generate a sequence which always produce a correct result but also to allow user more control on how his code is compiled, option -mabs is added where user can choose legacy or 2008. By default legacy mode is used on revisions prior R6. Mips32r6 and mips64r6 use abs2008 mode by default.

This is Clang part of patch. LLVM part can be found here: D35983

Depends on D36824.

Diff Detail

Repository
rL LLVM

Event Timeline

abeserminji created this revision.Jul 28 2017, 2:00 AM
abeserminji edited the summary of this revision. (Show Details)Jul 28 2017, 2:01 AM
abeserminji edited the summary of this revision. (Show Details)

Is it possible to factor out Nan => IEEE754 renaming into the separate patch?

sdardis requested changes to this revision.Aug 11 2017, 7:59 AM

Follow @atanasyan 's suggestion and post a patch that renames that enum along with other changes.

One comment inlined.

clang/Basic/DiagnosticDriverKinds.td
282–287 ↗(On Diff #108596)

These require tests. You should test that abs2008 is ignored pre-r2, legacy and abs2008 is accepted up to r5 and legacy is ignored for R6.

This revision now requires changes to proceed.Aug 11 2017, 7:59 AM
abeserminji marked an inline comment as done.Aug 16 2017, 6:30 AM
abeserminji updated this revision to Diff 111492.EditedAug 17 2017, 4:47 AM
abeserminji edited edge metadata.

On @atanasyan 's suggestion, part of the patch is separated here D36824, and this patch now depends on it.

Comments resolved.

sdardis accepted this revision.Aug 17 2017, 9:06 AM

LGTM with a test for warnings. See test/Driver/mips-abicalls.c for reference.

This revision is now accepted and ready to land.Aug 17 2017, 9:06 AM

Added test test/Driver/mips-mabs-warning.c as suggested in comments.

This revision was automatically updated to reflect the committed changes.