[AVR] Fix incorrect expansion of pseudo instructions LPMWRdZ/ELPMWRdZ
authorBen Shi <powerman1st@163.com>
Mon, 9 Jan 2023 08:15:41 +0000 (16:15 +0800)
committerBen Shi <powerman1st@163.com>
Thu, 6 Apr 2023 07:27:04 +0000 (15:27 +0800)
commitacb4d143bdb75930eae8dc700e16e4950b8cc2c8
treeb6cdc3e47627de081fa7042c2a6a34fe59b96177
parenteffdfa7d5f49b00b4c0d36f7c6835b519b0f46bb
[AVR] Fix incorrect expansion of pseudo instructions LPMWRdZ/ELPMWRdZ

The 'ELPM' instruction has three forms:

--------------------------
| form        | feature  |
| ----------- | -------- |
| ELPM        | hasELPM  |
| ELPM Rd, Z  | hasELPMX |
| 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.

Reviewed By: aykevl, Miss_Grape

Differential Revision: https://reviews.llvm.org/D141264
llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp
llvm/lib/Target/AVR/AVRInstrInfo.td
llvm/test/CodeGen/AVR/elpm.ll
llvm/test/CodeGen/AVR/pseudo/ELPMWRdZ.mir