From 7b66c6efff8641c74583d8c2e5539639579aa0c8 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Fri, 30 Sep 2016 04:26:03 +1300 Subject: [PATCH] [AVR] Add 16-bit STS instruction --- lib/Target/AVR/AVRInstrInfo.td | 11 +++++++++++ lib/Target/AVR/AVRRegisterInfo.td | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/lib/Target/AVR/AVRInstrInfo.td b/lib/Target/AVR/AVRInstrInfo.td index f30cbf0b2e2..e9111f48f3c 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 pseudi) +// - map r0..r15 onto r16..r31 so that the numbers match up. +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, (