This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Fix halfword load merging for big-endian targets
ClosedPublic

Authored by olista01 on Nov 10 2015, 2:36 AM.

Details

Summary

For big-endian targets, when we merge two halfword loads into a word load, the order of the halfwords in the loaded value is reversed compared to little-endian, so the load-store optimiser needs to swap the destination registers.

This does not affect merging of two word loads, as we use ldp, which treats the memory as two separate 32-bit words.

Diff Detail

Event Timeline

olista01 updated this revision to Diff 39798.Nov 10 2015, 2:36 AM
olista01 retitled this revision from to [AArch64] Fix halfword load merging for big-endian targets.
olista01 updated this object.
olista01 added reviewers: junbuml, mcrosier.
olista01 set the repository for this revision to rL LLVM.
olista01 added a subscriber: llvm-commits.
rengolin accepted this revision.Nov 10 2015, 2:57 AM
rengolin added a reviewer: rengolin.

If the answer to my question is "yes", LGTM. If not, an assert somewhere would fix it. Thanks!

lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
568

I'm guessing the code makes it Rt2MI and RtMI the *only* two possible options?

This revision is now accepted and ready to land.Nov 10 2015, 2:57 AM
olista01 added inline comments.Nov 10 2015, 3:05 AM
lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
568

Yep, ExtDestMI and Rt2MI are both set to either I or Paired earlier in this function.

olista01 closed this revision.Nov 10 2015, 3:07 AM

Committed revision 252597.

mcrosier edited edge metadata.Nov 10 2015, 5:07 AM

Thanks, Oliver!!!