Page MenuHomePhabricator

[mips][FastISel] Implement bswap.
ClosedPublic

Authored by vkalintiris on Jan 27 2015, 6:31 PM.

Details

Summary

Implement bswap intrinsic for MIPS FastISel. It's very different for MIPS32 R1/R2.

Based on a patch by Reed Kotler.

Diff Detail

Repository
rL LLVM

Event Timeline

rkotler updated this revision to Diff 18873.Jan 27 2015, 6:31 PM
rkotler retitled this revision from to Implement bswap for mips fast-isel.
rkotler updated this object.
rkotler edited the test plan for this revision. (Show Details)
rkotler added a reviewer: dsanders.
rkotler added a subscriber: rfuhler.
rkotler added a subscriber: Unknown Object (MLST).

Submit to commits list for comments too.

vkalintiris commandeered this revision.Apr 16 2015, 5:48 AM
vkalintiris added a reviewer: rkotler.
dsanders added inline comments.May 12 2015, 6:56 AM
test/CodeGen/Mips/Fast-ISel/bswap1.ll
14–15 ↗(On Diff #18873)

Please use multiple FileCheck prefixes to handle things that are the same for both commands.

16 ↗(On Diff #18873)

As mentioned in D6774, we can significantly simplify this using arguments and returns.

As noted there, I don't mind if this is part of the big cleanup.

50–51 ↗(On Diff #18873)

It's possible to shave off one instruction here. At the moment this code is equivalent to this expression:

R = (X << 24) | (X >> 24) | ((X >> 8) & 0xFF00) | ((X << 8) & 0xFF0000)

The '& 0xFF0000' requires an lui+and but with a slight change to the expression we could use an andi instead:

R = (X << 24) | (X >> 24) | ((X >> 8) & 0xFF00) | ((X & 0xFF00) << 8)
66–103 ↗(On Diff #18873)

Unnecessary

vkalintiris retitled this revision from Implement bswap for mips fast-isel to [mips][FastISel] Implement bswap..
vkalintiris updated this object.

Rebased, removed redundant instruction & cleaned up the tests.

dsanders accepted this revision.May 19 2015, 3:56 AM
dsanders edited edge metadata.

LGTM

This revision is now accepted and ready to land.May 19 2015, 3:56 AM
This revision was automatically updated to reflect the committed changes.