This is an archive of the discontinued LLVM Phabricator instance.

[PPC] Fix code generation for bswap(int32) followed by store16
ClosedPublic

Authored by Carrot on Feb 24 2017, 4:10 PM.

Details

Summary

This patch fixes pr32063.

Current code in PPCTargetLowering::PerformDAGCombine can transform

bswap
store

into a single PPCISD::STBRX instruction. but it doesn't consider the case that the operand size of bswap may be larger than store size. When it occurs, we need 2 modifications,

1 For the last operand of PPCISD::STBRX, we should not use DAG.getValueType(N->getOperand(1).getValueType()), instead we should use cast<StoreSDNode>(N)->getMemoryVT().

2 Before PPCISD::STBRX, we need to shift the original operand of bswap to the right side.

Diff Detail

Repository
rL LLVM

Event Timeline

Carrot created this revision.Feb 24 2017, 4:10 PM
echristo accepted this revision.Feb 28 2017, 1:24 PM

I think this is still outstanding, and unless I've missed something LGTM.

-eric

This revision is now accepted and ready to land.Feb 28 2017, 1:24 PM
This revision was automatically updated to reflect the committed changes.