llvm-project/llvm/test/CodeGen/AVR
Dylan McKay ccd819ad94 [AVR] Implement stacksave/stackrestore by expanding (PR31342)
Summary:
Authored by Florian Zeitz.

This implements the missing stacksave/stackrestore intrinsics via expansion.

Output of `llc -O0 -march=avr ~/devel/llvm/test/CodeGen/Generic/stacksave-restore.ll` for sanity checking (comments mine):

```
	.text
	.file	".../llvm/test/CodeGen/Generic/stacksave-restore.ll"
	.globl	test
	.p2align	1
	.type	test,@function
test:                                   ; @test
; BB#0:
	push	r28
	push	r29

	in	r28, 61
	in	r29, 62
	sbiw	r28, 4
	in	r0, 63
	cli
	out	62, r29
	out	63, r0
	out	61, r28

	in	r18, 61
	in	r19, 62

	mov	r20, r22
	mov	r21, r23

	in	r30, 61
	in	r31, 62

	lsl	r22
	rol	r23
	lsl	r22
	rol	r23
	in	r26, 61
	in	r27, 62
	sub	r26, r22
	sbc	r27, r23
	andi	r26, 252
	in	r0, 63
	cli
	out	62, r27
	out	63, r0
	out	61, r26

	in	r0, 63
	cli
	out	62, r31
	out	63, r0
	out	61, r30

	in	r30, 61
	in	r31, 62
	sub	r30, r22
	sbc	r31, r23
	andi	r30, 252
	in	r0, 63
	cli
	out	62, r31
	out	63, r0
	out	61, r30

	std	Y+3, r24                ; 2-byte Folded Spill
	std	Y+4, r25                ; 2-byte Folded Spill

	mov	r24, r26
	mov	r25, r27

	in	r0, 63
	cli
	out	62, r19
	out	63, r0
	out	61, r18

	std	Y+1, r20                ; 2-byte Folded Spill
	std	Y+2, r21                ; 2-byte Folded Spill

	adiw	r28, 4
	in	r0, 63
	cli
	out	62, r29
	out	63, r0
	out	61, r28

	pop	r29
	pop	r28
	ret
.Lfunc_end0:
	.size	test, .Lfunc_end0-test
```

Reviewers: dylanmckay

Reviewed By: dylanmckay

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29553

llvm-svn: 294146
2017-02-05 21:35:45 +00:00
..
atomics [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
calling-conv/c [AVR] Add calling convention CodeGen tests 2016-12-11 07:09:45 +00:00
features [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
inline-asm [AVR] Fix and clean up the inline assembly tests 2016-12-10 11:49:07 +00:00
instrumentation [AVR] Support floats in the instrumention pass 2016-12-15 11:02:41 +00:00
integration [AVR] Optimize 16-bit ORs with '0' 2016-12-30 00:21:56 +00:00
intrinsics [AVR] Implement stacksave/stackrestore by expanding (PR31342) 2017-02-05 21:35:45 +00:00
pseudo [AVR] Marm MIR test functions as tracking liveness information 2017-02-05 20:25:34 +00:00
relax-mem [AVR] Add an 'relax memory operation' pass 2016-12-13 05:53:14 +00:00
PR31344.ll [AVR] Optimize 16-bit ORs with '0' 2016-12-30 00:21:56 +00:00
PR31345.ll [AVR] Optimize 16-bit ANDs with '1' 2016-12-31 01:07:14 +00:00
add.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
alloca.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
and.ll [AVR] Optimize 16-bit ANDs with '1' 2016-12-31 01:07:14 +00:00
brind.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
call.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
cmp.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
com.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
ctlz.ll [AVR] Fix basic block naming in ctlz and cttz tests 2016-11-16 22:48:38 +00:00
ctpop.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
cttz.ll [AVR] Fix basic block naming in ctlz and cttz tests 2016-11-16 22:48:38 +00:00
directmem.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
div.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
dynalloca.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
eor.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
expand-integer-failure.ll [AVR] Expand 'SELECT_CC' nodes whereever possible 2016-12-07 12:34:47 +00:00
frame.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
high-pressure-on-ptrregs.ll Un-XFAIL an AVR CodeGen test 2016-11-26 01:07:32 +00:00
impossible-reg-to-reg-copy.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
interrupts.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
io.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
issue-cannot-select-bswap.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
large-return-size.ll Allow a maximum of 64 bits to be returned in registers 2016-10-08 01:05:09 +00:00
lit.local.cfg [AVR] Remove some accidentally-commited code that broke the bots 2016-11-17 00:09:38 +00:00
load.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
lower-formal-arguments-assertion.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
mul.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
neg.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
no-print-operand-twice.ll [AVR] Fix a bug where asm operands are printed twice 2017-02-05 10:42:49 +00:00
or.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
progmem-extended.ll [AVR] Add tests for a large number of pseudo instructions 2016-12-09 07:49:04 +00:00
progmem.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
rem.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
return.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
runtime-trig.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
select-must-add-unconditional-jump.ll [CodeGenPrep] Skip merging empty case blocks 2016-12-16 20:38:39 +00:00
sext.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
shift.ll [AVR] Add a test for 64-bit left shifts 2016-12-16 11:40:00 +00:00
sign-extension.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
smul-with-overflow.ll [AVR] Expand MULHS for all types 2016-10-08 01:01:49 +00:00
store-undef.ll [AVR] Explicitly set the target in all CodeGen tests 2016-12-10 11:23:16 +00:00
store.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
sub.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
trunc.ll [AVR] Add a selection of CodeGen tests 2016-11-09 23:46:52 +00:00
umul-with-overflow.ll [AVR] Expand MULHS for all types 2016-10-08 01:01:49 +00:00
varargs.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
xor.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00
zext.ll [AVR] Add the pseudo instruction expansion pass 2016-11-16 21:58:04 +00:00