This is an archive of the discontinued LLVM Phabricator instance.

[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

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
15–16

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

17

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.

51–52

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)
67–104

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.