This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Support select-cc for VSX
ClosedPublic

Authored by wschmidt on Oct 21 2014, 11:43 AM.

Details

Reviewers
seurer
hfinkel
Summary

The tests test/CodeGen/Generic/select-cc.ll and test/CodeGen/PowerPC/select-cc.ll both fail with VSX enabled. The problem is that the lowering logic for the SELECT and SELECT_CC operations doesn't currently support the VSX registers. This patch fixes that.

In lib/Target/PowerPC/PPCInstrInfo.td, we have pseudos to handle this for other register classes. Similar pseudos are added in PPCInstrVSX.td (they must be there, because the "vsrc" register class
definition appears there) for the VSRC register class. The SELECT_VSRC pseudo is then used in pattern matching for SELECT_CC.

The rest of the patch just adds logic for SELECT_VSRC wherever similar logic appears for SELECT_VRRC.

There are no new test cases because the existing tests above test this, along with a variant in test/CodeGen/PowerPC/vsx.ll.

One question is whether we want to add similar code for the VSFRC register class. We currently have _F8 variants of these pseudos to support the f64 type. We could add _VSFRC variants that override these in PPCInstrVSX.td. It's not a priori clear to me whether this would be helpful; there may be random effects of introducing copies between the F8RC and VFRC registers, but obviously the benefit is to allow RA to use all 64 scalar float regs. Thoughts?

Diff Detail

Event Timeline

wschmidt updated this revision to Diff 15197.Oct 21 2014, 11:43 AM
wschmidt retitled this revision from to [PowerPC] Support select-cc for VSX .
wschmidt updated this object.
wschmidt edited the test plan for this revision. (Show Details)
wschmidt added reviewers: hfinkel, seurer.
wschmidt added subscribers: wschmidt, hfinkel, seurer, Unknown Object (MLST).
hfinkel accepted this revision.Oct 21 2014, 12:47 PM
hfinkel edited edge metadata.

LGTM, thanks!

One question is whether we want to add similar code for the VSFRC register class. We currently have _F8 variants of these pseudos to support the f64 type. We could add _VSFRC variants that override these in PPCInstrVSX.td. It's not a priori clear to me whether this would be helpful; there may be random effects of introducing copies between the F8RC and VFRC registers, but obviously the benefit is to allow RA to use all 64 scalar float regs. Thoughts?

Yes, I think this sounds like a good idea. I don't think it will introduce any *more* copying than any of the other patterns already do, and reducing register pressure is normally a win.

This revision is now accepted and ready to land.Oct 21 2014, 12:47 PM
wschmidt closed this revision.Oct 22 2014, 6:24 AM

r220385, thanks!

I'll work on a follow-up patch for VSFRC.