Skip to content
This repository has been archived by the owner on Sep 2, 2018. It is now read-only.

Commit

Permalink
[AVR] Add 16-bit STS instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan McKay committed Sep 29, 2016
1 parent e9d48fc commit 7b66c6e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Target/AVR/AVRInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -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<imm,
[{
Expand Down Expand Up @@ -1275,6 +1276,16 @@ def STSKRr : F32DM<0b1,
[(store i8:$rd, imm:$k)]>,
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:
Expand Down
7 changes: 7 additions & 0 deletions lib/Target/AVR/AVRRegisterInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -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,
(
Expand Down

0 comments on commit 7b66c6e

Please sign in to comment.