This is an archive of the discontinued LLVM Phabricator instance.

[AVR] Fix incorrect expansion of the pseudo 'ELPMBRdZ' instruction
ClosedPublic

Authored by benshi001 on Jan 8 2023, 4:47 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 the pseudo
instruction ELPMBRdZ. But for devices without FeatureELPMX and
with only FeatureELPM, only the first form can be used.

Diff Detail

Event Timeline

benshi001 created this revision.Jan 8 2023, 4:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2023, 4:47 AM
Herald added subscribers: Jim, hiraditya. · View Herald Transcript
benshi001 requested review of this revision.Jan 8 2023, 4:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2023, 4:47 AM
benshi001 updated this revision to Diff 487163.Jan 8 2023, 4:48 AM
benshi001 edited the summary of this revision. (Show Details)
benshi001 added inline comments.Jan 8 2023, 4:50 AM
llvm/test/CodeGen/AVR/elpm.ll
296

The only difference between CHECK and NOX is that elpm rd, z is replaced by elpm + mov rd, r0.

benshi001 edited the summary of this revision. (Show Details)Jan 8 2023, 4:52 AM
benshi001 edited the summary of this revision. (Show Details)
benshi001 edited the summary of this revision. (Show Details)
benshi001 edited the summary of this revision. (Show Details)
benshi001 edited the summary of this revision. (Show Details)Jan 8 2023, 4:54 AM
benshi001 updated this revision to Diff 487165.Jan 8 2023, 5:08 AM
benshi001 updated this revision to Diff 487167.Jan 8 2023, 5:15 AM
benshi001 added inline comments.Jan 8 2023, 5:20 AM
llvm/lib/Target/AVR/AVRInstrInfo.td
1747

ELPMBRdZ does not clobber the Z register.

llvm/test/CodeGen/AVR/elpm.ll
246

The only difference between CHECK and NOX is that elpm rd, z is replaced by elpm + mov rd, r0.

benshi001 updated this revision to Diff 487254.Jan 8 2023, 5:59 PM
benshi001 edited the summary of this revision. (Show Details)Jan 8 2023, 8:16 PM
benshi001 edited the summary of this revision. (Show Details)
benshi001 edited the summary of this revision. (Show Details)
benshi001 updated this revision to Diff 487313.Jan 9 2023, 12:49 AM
This revision is now accepted and ready to land.Mar 20 2023, 7:22 PM