This is an archive of the discontinued LLVM Phabricator instance.

[AVR] Fix incorrect expansion of pseudo instructions LPMWRdZ/ELPMWRdZ
ClosedPublic

Authored by benshi001 on Jan 9 2023, 1:46 AM.

Details

Summary

The ELPM instruction has three forms:


formfeature
ELPMhasELPM
ELPM Rd, ZhasELPMX
ELPM Rd, Z+hasELPMX

The second form is always used in the expansion of pseudo instructions
LPMWRdZ/ELPMWRdZ. But for devices without ELPMX and with only ELPM,
only the first form can be used.

Diff Detail

Event Timeline

benshi001 created this revision.Jan 9 2023, 1:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 1:46 AM
Herald added subscribers: Jim, hiraditya. · View Herald Transcript
benshi001 requested review of this revision.Jan 9 2023, 1:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 1:46 AM
benshi001 updated this revision to Diff 487347.Jan 9 2023, 2:17 AM

This code modifies the pointer register, without restoring it. The pointer register should be restored to the previous value if it is is not killed (subtract one from the pointer value). See the expansion of LDDWRdPtrQ for avrtiny for example.

benshi001 updated this revision to Diff 490748.Jan 20 2023, 1:15 AM

This code modifies the pointer register, without restoring it. The pointer register should be restored to the previous value if it is is not killed (subtract one from the pointer value). See the expansion of LDDWRdPtrQ for avrtiny for example.

Thanks for your suggestion. I have added restoring the Z pointer register, and corresponding tests.

benshi001 updated this revision to Diff 511284.Apr 5 2023, 11:16 PM
benshi001 added a reviewer: Miss_Grape.
Miss_Grape accepted this revision.Apr 5 2023, 11:40 PM
This revision is now accepted and ready to land.Apr 5 2023, 11:40 PM
This revision was landed with ongoing or failed builds.Apr 6 2023, 12:27 AM
This revision was automatically updated to reflect the committed changes.