This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Reduce amount of boilerplate code used to select load instruction opcode.
ClosedPublic

Authored by tra on Mar 1 2017, 3:04 PM.

Details

Summary

Make opcode selection code for the load instruction a bit easier
to read and maintain.

This patch also catches number of f16 load variants that were not
handled before.

Diff Detail

Repository
rL LLVM

Event Timeline

tra created this revision.Mar 1 2017, 3:04 PM
jlebar edited edge metadata.Mar 1 2017, 3:06 PM

As I've said before, red *is* my favorite color. :)

This patch also catches number of f16 load variants that were not handled before.

Do we want to add tests so we don't regress this?

lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
795 ↗(On Diff #90239)

Do we want to use optional<unsigned> here instead so you can't forget to check for the default case?

tra updated this revision to Diff 90256.Mar 1 2017, 4:30 PM

pickOpcodeForVT now returns Optional<unsigned>.

It's also used for all loads/stores now.

tra marked an inline comment as done.Mar 1 2017, 4:33 PM

This patch also catches number of f16 load variants that were not handled before.

Do we want to add tests so we don't regress this?

Some of these instructions need additional help during lowering, so there's no easy way to emit them now.
I'll send another patch which will fix f16 load/store lowering and will include better tests.

jlebar accepted this revision.Mar 1 2017, 4:34 PM

OK, sgtm.

This revision is now accepted and ready to land.Mar 1 2017, 4:34 PM
This revision was automatically updated to reflect the committed changes.