This is an archive of the discontinued LLVM Phabricator instance.

[Sparc] Select correct register class for FP register constraints
ClosedPublic

Authored by dcederman on May 23 2018, 7:04 AM.

Details

Summary

The fX version of floating-point registers only supports single precision. We need to map the name to dX for doubles and qX for long doubles if we want getRegForInlineAsmConstraint() to be able to pick the correct register class.

Diff Detail

Repository
rL LLVM

Event Timeline

dcederman created this revision.May 23 2018, 7:04 AM

Some test cases for the error cases would be good here (e.g. "{f1}" with a double).

lib/Target/Sparc/SparcISelLowering.cpp
3501–3504 ↗(On Diff #148203)

Ugh, unrelated to this commit, but this just made me notice that in Clang's inline asm code, we convert register names *to* r0-r31, only to convert it back, here. That's just silly.

3516 ↗(On Diff #148203)

As a note, that SparcAsmParser.cpp has to do something very similar in MorphToDoubleReg. It might be nice if they could use the same code. But, this seems fine for now.

Added tests for some error cases.

jyknight accepted this revision.May 29 2018, 1:00 PM
This revision is now accepted and ready to land.May 29 2018, 1:00 PM
This revision was automatically updated to reflect the committed changes.