Page MenuHomePhabricator

[PowerPC] Folding XForm to DForm loads requires alignment for some DForm loads.

Authored by stefanp on Sep 12 2018, 7:28 AM.



Going from LDX to LD requires that the LDX be word aligned in the first place. This is a requirement of the LD instruction bot not of the LDX instruction. If we are not word aligned we must leave the load as LDX.
This bug is causing a compile-time failure in the benchmark h264ref.

Diff Detail


Event Timeline

stefanp created this revision.Sep 12 2018, 7:28 AM
jsji added a subscriber: jsji.

This is added by QingShan Zhang in, add him as reviewer.

jsji added a comment.Sep 12 2018, 10:25 AM

Reduced testcases?

jsji edited reviewers, added: steven.zhang; removed: qshanz.Sep 12 2018, 10:27 AM
steven.zhang added inline comments.Sep 12 2018, 6:48 PM
3069 ↗(On Diff #165082)

isImmElgibleForForwarding() will check if the ImmMO is elgible for forwarding. And it will check the alignment there according to the restriction with different instructions.
For your case, if the ImmMO is Global, isImmElgibleForForwarding() will return false if it is not the operand of ADDItocL. It covers your case. This missing part is that, if it is global, we still need to check the alignment restriction.

Please add a test case that we used to transform to a D-Form and no longer do with your patch (preferably one for DS-Form and one for DQ-Form).

3067 ↗(On Diff #165082)

This comment also needs to be updated. The instruction does not require the data to be aligned, it requires the displacement to be a multiple of 4.
I suppose the problem is that unaligned data may reside at non-multiple-of-4 offsets from the base reg and we don't know yet if that is the case. However, adding the check here just shifts the bug because we could be handling an unaligned vector access with a DQ-Form instruction. If the data happens to be 4-byte aligned and the displacement ends up being 12, this check won't catch it and we're in just as much trouble.
So I am with Steven here that we should be doing the check in isImmElgibleForForwarding() where we have access to how this is being used and know what ImmMustBeMultipleOf.

nemanjai requested changes to this revision.Sep 14 2018, 8:14 AM
This revision now requires changes to proceed.Sep 14 2018, 8:14 AM
stefanp updated this revision to Diff 167549.Sep 28 2018, 2:33 PM

Moved condition to the correct location and added a test case.

nemanjai accepted this revision.Oct 1 2018, 8:56 AM


This revision is now accepted and ready to land.Oct 1 2018, 8:56 AM
This revision was automatically updated to reflect the committed changes.