diff --git a/lib/Target/AVR/AVRInstrInfo.td b/lib/Target/AVR/AVRInstrInfo.td index f30cbf0b2e2..e200e4158c0 100644 --- a/lib/Target/AVR/AVRInstrInfo.td +++ b/lib/Target/AVR/AVRInstrInfo.td @@ -87,6 +87,7 @@ def imm0_63_neg : PatLeaf<(imm), }], imm16_neg_XFORM>; def uimm6 : PatLeaf<(imm), [{ return isUInt<6>(N->getZExtValue()); }]>; +def uimm7 : PatLeaf<(imm), [{ return isUInt<7>(N->getZExtValue()); }]>; def ioaddr_XFORM : SDNodeXForm, Requires<[HasSRAM]>; +// Indirect store from register to data space. +// FIXME: +// - make this a physical instruction (not a pseudo) +// - map r0..r15 onto r16..r31 so that the numbers match up. +// - do weird MSB inversion as specified in datsheet +def STS16KRr : Pseudo<(outs), + (ins uimm7:$k, GPR8hi:$rd), + "sts\t$k, $rd", + [store i8:$rd, imm:$k]>, + Requires<[HasTinyEncoding]>; + // STSW K+1:K, Rr+1:Rr // // Expands to: diff --git a/lib/Target/AVR/AVRRegisterInfo.td b/lib/Target/AVR/AVRRegisterInfo.td index 32650fc6675..c5d9589d531 100644 --- a/lib/Target/AVR/AVRRegisterInfo.td +++ b/lib/Target/AVR/AVRRegisterInfo.td @@ -130,6 +130,13 @@ def GPR8lo : RegisterClass<"AVR", [i8], 8, add R15, R14, R13, R12, R11, R10, R9, R8, R7, R6, R5, R4, R3, R2, R0, R1 )>; +// Upper registers r0..r15 +def GPR8hi : RegisterClass<"AVR", [i8], 8, + ( + add R16, R17, R18, R19, R20, R21, R22, R23, + R24, R25, R26, R27, R28, R29, R30, R31 + )>; + // 8-bit register class for instructions which take immediates. def LD8 : RegisterClass<"AVR", [i8], 8, (