[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] avr-gcc 4.5.1 doing bad reloads using X
From: |
Georg Lay |
Subject: |
[avr-gcc-list] avr-gcc 4.5.1 doing bad reloads using X |
Date: |
Tue, 02 Nov 2010 17:41:36 +0100 |
User-agent: |
Thunderbird 2.0.0.24 (X11/20100302) |
Hi, I compiled one of my projects with hard real-time constraints
using avr-gcc-4.5.1 and observed the following issue concerning both
code density and speed.
avr-gcc-4.5.1 prefers to use X-reg to reload addresses. Just note the
*movqi/3 and *movqi/4 sequences in the asm-printout below:
...
adiw r26,18 ; 250 *movqi/4 [length = 3]
ld r20,X
sbiw r26,18
adiw r26,25 ; 251 *movqi/4 [length = 3]
ld r21,X
sbiw r26,25
add r20,r21 ; 252 addqi3/1 [length = 1]
mul r24,r19 ; 253 *mulqi3_enh [length = 3]
mov r24,r0
clr r1
add r20,r24 ; 254 addqi3/1 [length = 1]
adiw r26,20 ; 255 *movqi/3 [length = 3]
st X,r20
sbiw r26,20
mul r18,r19 ; 256 *mulqi3_enh [length = 3]
mov r18,r0
clr r1
adiw r26,19 ; 257 *movqi/4 [length = 3]
ld r24,X
sbiw r26,19
add r18,r24 ; 258 addqi3/1 [length = 1]
adiw r26,21 ; 259 *movqi/3 [length = 3]
st X,r18
sbiw r26,21
sbi 62-0x20,5 ; 264 *sbi [length = 1]
adiw r26,23 ; 265 *movqi/4 [length = 3]
ld r24,X
sbiw r26,23
subi r24,lo8(-(2)) ; 266 addqi3/2 [length = 1]
adiw r26,23 ; 267 *movqi/3 [length = 3]
st X,r24
sbiw r26,23
rjmp .L58 ; 710 jump [length = 1]
.L22:
adiw r26,11+1 ; 272 *movhi/3 [length = 4]
st X,r31
st -X,r30
sbiw r26,11
adiw r26,16 ; 273 *movqi/4 [length = 3]
ld r21,X
sbiw r26,16
tst r21 ; 274 *cmpqi/1 [length = 1]
brne .L25 ; 275 branch [length = 1]
tst r18 ; 277 *cmpqi/1 [length = 1]
brne .L25 ; 278 branch [length = 1]
adiw r26,20 ; 280 *movqi/4 [length = 3]
ld r21,X
...
All these memory accesses could be made by means of Y+const and most
of the code consists of adding/subtracting constants to/from X.
Hacking source (or using avr-gcc-3.4.6) so that Y gets used to address
SRAM leads to code deflation from ~1200 bytes to ~950 bytes.
Without tracking it down, I think it's an avr backend issue because it
is lying at IRA and reports wrong reload costs: Both X+const, Y+const
and Z+const are handled by the same constraint alternative(s), but the
costs of X+const are considerably higher because there is no native
instruction for it. IRA uses X and not Y because Y would cause
prologue/epilogue costs. However, the accumulated additional costs of
using X are much higher than the prologue/epilogue costs that would
arise if Y was used.
So the backend badly needs new memory constraints that report costs to
IRA. I would highly recommend to use multi-letter constraints for that
so that the backend won't run out of constraint letters sooner or later...
Being not familiar with LEGITIMIZE_RELOAD_ADDRESS, I wonder if there
is a way to describe costs therein, or maybe that hook is an
anachronism that it no more needed with IRA?
To reproduce this, I attached some precompiled sources. The excerpt
abive is compiled from vektor-zeichen-i.c. They basically do indirect
accesses to struct components of one struct in SRAM, so nothing
complicated. Register pressure is quite low so that is no issue.
Compiled with
avr-gcc-4.5.1 vektor-zeichen-i.c -S -Os -mmcu=atmega168 -ffixed-6
-ffixed-7 -mmcu=atmega168 -dp -fverbose-asm
avr-gcc-4.5.1 snake-i.c -S -Os -dp -mmcu=atmega168 -fverbose-asm
-std=gnu99
Cheers, Georg
.file "vektor-zeichen-i.c"
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
; GNU C (GCC) version 4.5.1 (avr)
; compiled by GNU C version 4.1.0 (SUSE Linux), GMP version 4.3.1, MPFR
version 2.4.2, MPC version 0.8.1
; GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
; options passed: -fpreprocessed vektor-zeichen-i.i -mmcu=atmega168
; -mmcu=atmega168 -Os -ffixed-6 -ffixed-7 -fverbose-asm
; options enabled: -falign-loops -fargument-alias -fauto-inc-dec
; -fbranch-count-reg -fcaller-saves -fcommon -fcprop-registers
; -fcrossjumping -fcse-follow-jumps -fdefer-pop -fearly-inlining
; -feliminate-unused-debug-types -fexpensive-optimizations
; -fforward-propagate -ffunction-cse -fgcse -fgcse-lm
; -fguess-branch-probability -fident -fif-conversion -fif-conversion2
; -findirect-inlining -finline -finline-functions
; -finline-functions-called-once -finline-small-functions -fipa-cp
; -fipa-pure-const -fipa-reference -fipa-sra -fira-share-save-slots
; -fira-share-spill-slots -fivopts -fkeep-static-consts
; -fleading-underscore -fmath-errno -fmerge-constants
; -fmerge-debug-strings -fmove-loop-invariants -fomit-frame-pointer
; -foptimize-register-move -foptimize-sibling-calls -fpeephole
; -fpeephole2 -freg-struct-return -fregmove -freorder-blocks
; -freorder-functions -frerun-cse-after-loop
; -fsched-critical-path-heuristic -fsched-dep-count-heuristic
; -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic
; -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic
; -fsched-stalled-insns-dep -fshow-column -fsigned-zeros
; -fsplit-ivs-in-unroller -fsplit-wide-types -fstrict-aliasing
; -fstrict-overflow -fthread-jumps -ftoplevel-reorder -ftrapping-math
; -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop
; -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse
; -ftree-forwprop -ftree-fre -ftree-loop-im -ftree-loop-ivcanon
; -ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop
; -ftree-pre -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
; -ftree-slp-vectorize -ftree-sra -ftree-switch-conversion -ftree-ter
; -ftree-vect-loop-version -ftree-vrp -funit-at-a-time -fverbose-asm
; -fzero-initialized-in-bss
; Compiler executable checksum: 1009e10776a492a4930a8528eab0e20f
.text
.global vecfont_draw_letters
.type vecfont_draw_letters, @function
vecfont_draw_letters:
push r28 ; ; 658 *pushqi/1 [length = 1]
push r29 ; ; 659 *pushqi/1 [length = 1]
/* prologue: function */
/* frame size = 0 */
/* stack size = 2 */
.L__stack_usage = 2
movw r26,r24 ; vf, vf ; 2 *movhi/1 [length = 1]
ldi r25,lo8(1) ; dy, ; 19 *movqi/2 [length = 1]
.L58:
adiw r26,23 ; vf_32(D)->iLine ; 36 *movqi/4 [length
= 3]
ld r18,X ; iLine
sbiw r26,23 ; vf_32(D)->iLine
adiw r26,16 ; vf_32(D)->iPixel ; 37 *movqi/4 [length
= 3]
ld r24,X ; vf_32(D)->iPixel
sbiw r26,16 ; vf_32(D)->iPixel
tst r24 ; vf_32(D)->iPixel ; 38 *cmpqi/1 [length = 1]
breq .+2 ; ; 39 branch [length = 2]
rjmp .L3 ;
tst r18 ; iLine ; 41 *cmpqi/1 [length = 1]
breq .+2 ; ; 42 branch [length = 2]
rjmp .L4 ;
adiw r26,17 ; vf_32(D)->itext ; 44 *movqi/4 [length
= 3]
ld r19,X ; itext
sbiw r26,17 ; vf_32(D)->itext
tst r19 ; itext ; 45 *cmpqi/1 [length = 1]
brne .L5 ; , ; 46 branch [length = 1]
adiw r26,6 ; vf_32(D)->start.x ; 48 *movqi/4 [length
= 3]
ld r24,X ; vf_32(D)->start.x
sbiw r26,6 ; vf_32(D)->start.x
adiw r26,18 ; vf_32(D)->p.x ; 49 *movqi/3 [length
= 3]
st X,r24 ; vf_32(D)->start.x
sbiw r26,18 ; vf_32(D)->p.x
adiw r26,7 ; vf_32(D)->start.y ; 50 *movqi/4 [length
= 3]
ld r24,X ; vf_32(D)->start.y
sbiw r26,7 ; vf_32(D)->start.y
adiw r26,19 ; vf_32(D)->p.y ; 51 *movqi/3 [length
= 3]
st X,r24 ; vf_32(D)->start.y
sbiw r26,19 ; vf_32(D)->p.y
.L5:
ld r30,X+ ; pzeichen ; 55 *movhi/2 [length = 3]
ld r31,X ; pzeichen
sbiw r26,1
add r30,r19 ; pzeichen, itext ; 56 *addhi3_zero_extend
[length = 2]
adc r31,__zero_reg__ ; pzeichen
ld r24,Z ; D.2040,* pzeichen ; 57 *movqi/4 [length
= 1]
adiw r26,10 ; vf_32(D)->text_in_flash ; 58 *movqi/4
[length = 3]
ld r20,X ; vf_32(D)->text_in_flash
sbiw r26,10 ; vf_32(D)->text_in_flash
tst r20 ; vf_32(D)->text_in_flash ; 59 *cmpqi/1 [length
= 1]
breq .L7 ; , ; 60 branch [length = 1]
/* #APP */
; 109 "vektor-zeichen-i.c" 1
lpm r24, Z ; zeichen
; 0 "" 2
/* #NOAPP */
.L7:
subi r19,lo8(-(1)) ; tmp203, ; 71 addqi3/2 [length
= 1]
adiw r26,17 ; vf_32(D)->itext ; 72 *movqi/3 [length
= 3]
st X,r19 ; tmp203
sbiw r26,17 ; vf_32(D)->itext
adiw r26,8 ; vf_32(D)->zoom ; 73 *movqi/4 [length
= 3]
ld r19,X ; zoom
sbiw r26,8 ; vf_32(D)->zoom
cpi r24,lo8(33) ; zeichen, ; 74 *cmpqi/3 [length = 1]
brsh .L8 ; , ; 75 branch [length = 1]
tst r24 ; zeichen ; 77 *cmpqi/1 [length = 1]
brne .L9 ; , ; 78 branch [length = 1]
adiw r26,17 ; vf_32(D)->itext ; 80 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,17 ; vf_32(D)->itext
ldi r24,lo8(1) ; D.2049, ; 26 *movqi/2 [length = 1]
rjmp .L10 ; ; 695 jump [length = 1]
.L9:
cpi r24,lo8(13) ; zeichen, ; 86 *cmpqi/3 [length = 1]
breq .L58 ; , ; 87 branch [length = 1]
cpi r24,lo8(32) ; zeichen, ; 89 *cmpqi/3 [length = 1]
brne .L12 ; , ; 90 branch [length = 1]
adiw r26,18 ; vf_32(D)->p.x ; 92 *movqi/4 [length
= 3]
ld r24,X ; tmp209
sbiw r26,18 ; vf_32(D)->p.x
subi r24,lo8(-(2)) ; tmp209, ; 93 addqi3/2 [length
= 1]
mov r18,r19 ; tmp208, zoom ; 639 *movqi/1 [length
= 1]
lsl r18 ; tmp208 ; 95 *ashlqi3/4 [length = 2]
lsl r18 ; tmp208
add r18,r19 ; tmp208, zoom ; 96 addqi3/1 [length
= 1]
add r24,r18 ; tmp209, tmp208 ; 97 addqi3/1 [length
= 1]
rjmp .L61 ; ; 697 jump [length = 1]
.L12:
cpi r24,lo8(10) ; zeichen, ; 103 *cmpqi/3 [length = 1]
brne .L13 ; , ; 104 branch [length = 1]
adiw r26,19 ; vf_32(D)->p.y ; 106 *movqi/4 [length
= 3]
ld r24,X ; tmp213
sbiw r26,19 ; vf_32(D)->p.y
subi r24,lo8(-(-3)) ; tmp213, ; 107 addqi3/2 [length
= 1]
lsl r19 ; tmp212 ; 108 *ashlqi3/5 [length = 3]
lsl r19 ; tmp212
lsl r19 ; tmp212
sub r24,r19 ; tmp213, tmp212 ; 109 subqi3/1 [length
= 1]
adiw r26,19 ; vf_32(D)->p.y ; 110 *movqi/3 [length
= 3]
st X,r24 ; tmp213
sbiw r26,19 ; vf_32(D)->p.y
adiw r26,6 ; vf_32(D)->start.x ; 111 *movqi/4 [length
= 3]
ld r24,X ; vf_32(D)->start.x
sbiw r26,6 ; vf_32(D)->start.x
rjmp .L61 ; ; 699 jump [length = 1]
.L13:
cpi r24,lo8(8) ; zeichen, ; 117 *cmpqi/3 [length = 1]
brne .L8 ; , ; 118 branch [length = 1]
adiw r26,18 ; vf_32(D)->p.x ; 120 *movqi/4 [length
= 3]
ld r24,X ; tmp220
sbiw r26,18 ; vf_32(D)->p.x
subi r24,lo8(-(-2)) ; tmp220, ; 121 addqi3/2 [length
= 1]
mov r18,r19 ; tmp219, zoom ; 640 *movqi/1 [length
= 1]
lsl r18 ; tmp219 ; 123 *ashlqi3/4 [length = 2]
lsl r18 ; tmp219
add r18,r19 ; tmp219, zoom ; 124 addqi3/1 [length
= 1]
sub r24,r18 ; tmp220, tmp219 ; 125 subqi3/1 [length
= 1]
.L61:
adiw r26,18 ; vf_32(D)->p.x ; 126 *movqi/3 [length
= 3]
st X,r24 ; tmp220
sbiw r26,18 ; vf_32(D)->p.x
rjmp .L58 ; ; 701 jump [length = 1]
.L8:
adiw r26,19 ; vf_32(D)->p.y ; 131 *movqi/4 [length
= 3]
ld r20,X ; vf_32(D)->p.y
sbiw r26,19 ; vf_32(D)->p.y
adiw r26,21 ; vf_32(D)->pix.y ; 132 *movqi/3 [length
= 3]
st X,r20 ; vf_32(D)->p.y
sbiw r26,21 ; vf_32(D)->pix.y
adiw r26,18 ; vf_32(D)->p.x ; 133 *movqi/4 [length
= 3]
ld r20,X ; vf_32(D)->p.x
sbiw r26,18 ; vf_32(D)->p.x
adiw r26,20 ; vf_32(D)->pix.x ; 134 *movqi/3 [length
= 3]
st X,r20 ; vf_32(D)->p.x
sbiw r26,20 ; vf_32(D)->pix.x
mov r20,r24 ; tmp223, zeichen ; 641 *movqi/1 [length
= 1]
subi r20,lo8(-(-33)) ; tmp223, ; 135 addqi3/2 [length
= 1]
sbrc r20,7 ; tmp223, ; 694 *sbrx_branchhi [length = 2]
rjmp .L47 ;
mov r28,r24 ; lookup_addr, zeichen ; 656 *movqi/1
[length = 1]
ldi r29,lo8(0) ; lookup_addr, ; 657 *movqi/1 [length
= 1]
lsl r28 ; lookup_addr ; 693 *ashlhi3_const/2 [length = 2]
rol r29 ; lookup_addr
subi r28,lo8(-(lookup.1264-66)) ; lookup_addr, ; 142
*addhi3/4 [length = 2]
sbci r29,hi8(-(lookup.1264-66)) ; lookup_addr,
ld r30,Y ; addr, lookup ; 146 *movhi/2 [length
= 2]
ldd r31,Y+1 ; addr, lookup
sbiw r30,0 ; addr ; 147 *cmphi/1 [length = 1]
brne .L59 ; , ; 148 branch [length = 1]
rjmp .L48 ; ; 704 jump [length = 1]
.L47:
ldi r28,lo8(0) ; lookup_addr, ; 574 *movhi/1 [length
= 2]
ldi r29,hi8(0) ; lookup_addr,
.L48:
ldi r30,lo8(vecfont_data) ; addr, ; 576 *movhi/4
[length = 2]
ldi r31,hi8(vecfont_data) ; addr,
rjmp .L59 ; ; 706 jump [length = 1]
.L49:
ldi r30,lo8(snake_glyph) ; addr, ; 573 *movhi/4
[length = 2]
ldi r31,hi8(snake_glyph) ; addr,
.L59:
/* #APP */
; 239 "vektor-zeichen.c" 1
lpm r20, Z+ ; __result
; 0 "" 2
; 240 "vektor-zeichen.c" 1
lpm r21, Z+ ; __result
; 0 "" 2
/* #NOAPP */
mov r22,r21 ; nLines, __result ; 642 *movqi/1 [length
= 1]
andi r22,lo8(31) ; nLines, ; 160 andqi3/2 [length
= 1]
cp r20,r24 ; __result, zeichen ; 161 *cmpqi/2 [length
= 1]
breq .L15 ; , ; 162 branch [length = 1]
cpi r20,lo8(1) ; __result, ; 165 *cmpqi/3 [length = 1]
breq .L49 ; , ; 166 branch [length = 1]
cpi r20,lo8(2) ; __result, ; 168 *cmpqi/3 [length = 1]
breq .L15 ; , ; 169 branch [length = 1]
add r30,r22 ; addr, nLines ; 172 *addhi3_zero_extend
[length = 2]
adc r31,__zero_reg__ ; addr
rjmp .L59 ; ; 708 jump [length = 1]
.L15:
adiw r26,28 ; vf_32(D)->zeichen ; 178 *movqi/3 [length
= 3]
st X,r20 ; __result
sbiw r26,28 ; vf_32(D)->zeichen
adiw r26,11+1 ; vf_32(D)->addr ; 179 *movhi/3 [length
= 4]
st X,r31 ; addr
st -X,r30 ; addr
sbiw r26,11 ; vf_32(D)->addr
adiw r26,22 ; vf_32(D)->nLines ; 180 *movqi/3 [length
= 3]
st X,r22 ; nLines
sbiw r26,22 ; vf_32(D)->nLines
sbiw r28,0 ; lookup_addr ; 181 *cmphi/1 [length = 1]
breq .L18 ; , ; 182 branch [length = 1]
sbiw r30,2 ; tmp234, ; 184 *addhi3/3 [length = 1]
std Y+1,r31 ; * lookup_addr, tmp234 ; 185 *movhi/3
[length = 2]
st Y,r30 ; * lookup_addr, tmp234
.L18:
adiw r26,9 ; vf_32(D)->proportional ; 188 *movqi/4
[length = 3]
ld r24,X ; proportional
sbiw r26,9 ; vf_32(D)->proportional
tst r24 ; proportional ; 189 *cmpqi/1 [length = 1]
breq .L19 ; , ; 190 branch [length = 1]
cpi r20,lo8(84) ; __result, ; 192 *cmpqi/3 [length = 1]
breq .L20 ; , ; 193 branch [length = 1]
cpi r20,lo8(70) ; __result, ; 195 *cmpqi/3 [length = 1]
brne .L19 ; , ; 196 branch [length = 1]
.L20:
subi r21,lo8(-(64)) ; nLinesRightLeft, ; 199 addqi3/2
[length = 1]
.L19:
adiw r26,26 ; vf_32(D)->left ; 202 *movqi/3 [length
= 3]
st X,r21 ; nLinesRightLeft
sbiw r26,26 ; vf_32(D)->left
adiw r26,25 ; vf_32(D)->right ; 203 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,25 ; vf_32(D)->right
sbrs r21,5 ; nLinesRightLeft, ; 207 *sbrx_branchhi [length
= 2]
rjmp .L21 ;
tst r24 ; proportional ; 209 *cmpqi/1 [length = 1]
brne .L21 ; , ; 210 branch [length = 1]
adiw r26,25 ; vf_32(D)->right ; 212 *movqi/3 [length
= 3]
st X,r19 ; zoom
sbiw r26,25 ; vf_32(D)->right
.L21:
adiw r26,29 ; vf_32(D)->shrinky ; 215 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,29 ; vf_32(D)->shrinky
adiw r26,30 ; vf_32(D)->shrink.x ; 216 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,30 ; vf_32(D)->shrink.x
adiw r26,21 ; vf_32(D)->pix.y ; 217 *movqi/4 [length
= 3]
ld r24,X ; vf_32(D)->pix.y
sbiw r26,21 ; vf_32(D)->pix.y
adiw r26,31 ; vf_32(D)->shrink.y ; 218 *movqi/3 [length
= 3]
st X,r24 ; vf_32(D)->pix.y
sbiw r26,31 ; vf_32(D)->shrink.y
.L4:
adiw r26,11 ; vf_32(D)->addr ; 221 *movhi/2 [length
= 4]
ld r30,X+ ; addr
ld r31,X ; addr
sbiw r26,11+1 ; vf_32(D)->addr
/* #APP */
; 318 "vektor-zeichen.c" 1
lpm r24, Z+ ; __result
; 0 "" 2
/* #NOAPP */
mov r20,r24 ; nPixels, __result ; 643 *movqi/1 [length
= 1]
swap r20 ; nPixels ; 653 *rotlqi3_4 [length = 1]
lsr r20 ; nPixels ; 654 *lshrqi3/3 [length = 1]
andi r20,lo8(7) ; nPixels, ; 655 andqi3/2 [length = 1]
adiw r26,8 ; vf_32(D)->zoom ; 226 *movqi/4 [length
= 3]
ld r19,X ; zoom
sbiw r26,8 ; vf_32(D)->zoom
tst r20 ; nPixels ; 227 *cmpqi/1 [length = 1]
brne .L22 ; , ; 228 branch [length = 1]
/* #APP */
; 330 "vektor-zeichen.c" 1
lpm r18, Z+ ; __result
; 0 "" 2
/* #NOAPP */
adiw r26,11+1 ; vf_32(D)->addr ; 234 *movhi/3 [length
= 4]
st X,r31 ; addr
st -X,r30 ; addr
sbiw r26,11 ; vf_32(D)->addr
cpi r19,lo8(2) ; zoom, ; 235 *cmpqi/3 [length = 1]
brlo .L23 ; , ; 236 branch [length = 1]
mov r20,r18 ; tmp242, __result ; 644 *movqi/1 [length
= 1]
andi r20,lo8(-128) ; tmp242, ; 238 andqi3/2 [length
= 1]
adiw r26,29 ; vf_32(D)->shrinky ; 239 *movqi/3 [length
= 3]
st X,r20 ; tmp242
sbiw r26,29 ; vf_32(D)->shrinky
.L23:
andi r18,lo8(127) ; dy, ; 242 andqi3/2 [length = 1]
cpi r18,lo8(20) ; dy, ; 243 *cmpqi/3 [length = 1]
brlt .L24 ; , ; 244 branch [length = 1]
subi r18,lo8(-(-32)) ; dy, ; 246 addqi3/2 [length = 1]
.L24:
adiw r26,18 ; vf_32(D)->p.x ; 250 *movqi/4 [length
= 3]
ld r20,X ; tmp247
sbiw r26,18 ; vf_32(D)->p.x
adiw r26,25 ; vf_32(D)->right ; 251 *movqi/4 [length
= 3]
ld r21,X ; vf_32(D)->right
sbiw r26,25 ; vf_32(D)->right
add r20,r21 ; tmp247, vf_32(D)->right ; 252 addqi3/1
[length = 1]
mul r24,r19 ; __result, zoom ; 253 *mulqi3_enh [length
= 3]
mov r24,r0 ; tmp246
clr r1
add r20,r24 ; tmp247, tmp246 ; 254 addqi3/1 [length
= 1]
adiw r26,20 ; vf_32(D)->pix.x ; 255 *movqi/3 [length
= 3]
st X,r20 ; tmp247
sbiw r26,20 ; vf_32(D)->pix.x
mul r18,r19 ; dy, zoom ; 256 *mulqi3_enh [length = 3]
mov r18,r0 ; tmp250
clr r1
adiw r26,19 ; vf_32(D)->p.y ; 257 *movqi/4 [length
= 3]
ld r24,X ; vf_32(D)->p.y
sbiw r26,19 ; vf_32(D)->p.y
add r18,r24 ; tmp250, vf_32(D)->p.y ; 258 addqi3/1
[length = 1]
adiw r26,21 ; vf_32(D)->pix.y ; 259 *movqi/3 [length
= 3]
st X,r18 ; tmp250
sbiw r26,21 ; vf_32(D)->pix.y
sbi 62-0x20,5 ; , ; 264 *sbi [length = 1]
adiw r26,23 ; vf_32(D)->iLine ; 265 *movqi/4 [length
= 3]
ld r24,X ; tmp254
sbiw r26,23 ; vf_32(D)->iLine
subi r24,lo8(-(2)) ; tmp254, ; 266 addqi3/2 [length
= 1]
adiw r26,23 ; vf_32(D)->iLine ; 267 *movqi/3 [length
= 3]
st X,r24 ; tmp254
sbiw r26,23 ; vf_32(D)->iLine
rjmp .L58 ; ; 710 jump [length = 1]
.L22:
adiw r26,11+1 ; vf_32(D)->addr ; 272 *movhi/3 [length
= 4]
st X,r31 ; addr
st -X,r30 ; addr
sbiw r26,11 ; vf_32(D)->addr
adiw r26,16 ; vf_32(D)->iPixel ; 273 *movqi/4 [length
= 3]
ld r21,X ; vf_32(D)->iPixel
sbiw r26,16 ; vf_32(D)->iPixel
tst r21 ; vf_32(D)->iPixel ; 274 *cmpqi/1 [length = 1]
brne .L25 ; , ; 275 branch [length = 1]
tst r18 ; iLine ; 277 *cmpqi/1 [length = 1]
brne .L25 ; , ; 278 branch [length = 1]
adiw r26,20 ; vf_32(D)->pix.x ; 280 *movqi/4 [length
= 3]
ld r21,X ; tmp258
sbiw r26,20 ; vf_32(D)->pix.x
adiw r26,25 ; vf_32(D)->right ; 281 *movqi/4 [length
= 3]
ld r22,X ; vf_32(D)->right
sbiw r26,25 ; vf_32(D)->right
add r21,r22 ; tmp258, vf_32(D)->right ; 282 addqi3/1
[length = 1]
adiw r26,20 ; vf_32(D)->pix.x ; 283 *movqi/3 [length
= 3]
st X,r21 ; tmp258
sbiw r26,20 ; vf_32(D)->pix.x
sbi 62-0x20,5 ; , ; 288 *sbi [length = 1]
.L25:
mul r20,r19 ; nPixels, zoom ; 291 *mulqi3_enh [length
= 3]
mov r20,r0 ; nPixels
clr r1
sbrs r24,0 ; __result, ; 294 *sbrx_branchqi [length = 2]
subi r20,lo8(-(-1)) ; nPixels, ; 296 addqi3/2 [length
= 1]
.L26:
sbrs r24,1 ; __result, ; 301 *sbrx_branchqi [length = 2]
rjmp .L27 ;
subi r20,lo8(-(1)) ; nPixels, ; 303 addqi3/2 [length
= 1]
adiw r26,24 ; vf_32(D)->noskip ; 305 *movqi/3 [length
= 3]
st X,r25 ; dy
sbiw r26,24 ; vf_32(D)->noskip
.L27:
tst r20 ; nPixels ; 308 *cmpqi/1 [length = 1]
brne .L28 ; , ; 309 branch [length = 1]
adiw r26,24 ; vf_32(D)->noskip ; 311 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,24 ; vf_32(D)->noskip
rjmp .L53 ; ; 712 jump [length = 1]
.L28:
cpi r24,lo8(-28) ; __result, ; 316 *cmpqi/3 [length
= 1]
brne .L30 ; , ; 317 branch [length = 1]
adiw r26,20 ; vf_32(D)->pix.x ; 319 *movqi/4 [length
= 3]
ld r24,X ; tmp265
sbiw r26,20 ; vf_32(D)->pix.x
subi r24,lo8(-(-1)) ; tmp265, ; 320 addqi3/2 [length
= 1]
rjmp .L62 ; ; 714 jump [length = 1]
.L30:
cpi r24,lo8(-26) ; __result, ; 326 *cmpqi/3 [length
= 1]
brne .L32 ; , ; 327 branch [length = 1]
adiw r26,20 ; vf_32(D)->pix.x ; 329 *movqi/4 [length
= 3]
ld r24,X ; tmp267
sbiw r26,20 ; vf_32(D)->pix.x
subi r24,lo8(-(1)) ; tmp267, ; 330 addqi3/2 [length
= 1]
.L62:
adiw r26,20 ; vf_32(D)->pix.x ; 331 *movqi/3 [length
= 3]
st X,r24 ; tmp267
sbiw r26,20 ; vf_32(D)->pix.x
adiw r26,15 ; vf_32(D)->nPixels ; 346 *movqi/3 [length
= 3]
st X,r19 ; zoom
sbiw r26,15 ; vf_32(D)->nPixels
adiw r26,24 ; vf_32(D)->noskip ; 347 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,24 ; vf_32(D)->noskip
ldi r20,lo8(1) ; dy, ; 560 *movqi/2 [length = 1]
rjmp .L63 ; ; 716 jump [length = 1]
.L32:
cpi r24,lo8(-27) ; __result, ; 336 *cmpqi/3 [length
= 1]
breq .L33 ; , ; 337 branch [length = 1]
cpi r24,lo8(-25) ; __result, ; 339 *cmpqi/3 [length
= 1]
breq .L52 ; , ; 340 branch [length = 1]
adiw r26,15 ; vf_32(D)->nPixels ; 352 *movqi/3 [length
= 3]
st X,r20 ; nPixels
sbiw r26,15 ; vf_32(D)->nPixels
mov r19,r24 ; dxy, __result ; 645 *movqi/1 [length
= 1]
lsr r19 ; dxy ; 353 *lshrqi3/4 [length = 2]
lsr r19 ; dxy
andi r19,lo8(3) ; dxy, ; 354 andqi3/2 [length = 1]
brne .L37 ; , ; 356 branch [length = 1]
ldi r20,lo8(0) ; dy, ; 569 *movqi/1 [length = 1]
rjmp .L39 ; ; 718 jump [length = 1]
.L33:
cpi r19,lo8(1) ; zoom, ; 362 *cmpqi/3 [length = 1]
brne .+2 ; ; 363 branch [length = 2]
rjmp .L53 ;
ldi r20,lo8(-1) ; dy, ; 564 *movqi/2 [length = 1]
rjmp .L34 ; ; 720 jump [length = 1]
.L52:
ldi r20,lo8(1) ; dy, ; 565 *movqi/2 [length = 1]
.L34:
subi r19,lo8(-(1)) ; tmp270, ; 366 addqi3/2 [length
= 1]
lsr r19 ; tmp270 ; 367 *lshrqi3/3 [length = 1]
adiw r26,15 ; vf_32(D)->nPixels ; 368 *movqi/3 [length
= 3]
st X,r19 ; tmp270
sbiw r26,15 ; vf_32(D)->nPixels
adiw r26,24 ; vf_32(D)->noskip ; 369 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,24 ; vf_32(D)->noskip
.L63:
ldi r19,lo8(0) ; dx, ; 562 *movqi/1 [length = 1]
rjmp .L36 ; ; 722 jump [length = 1]
.L37:
cpi r19,lo8(3) ; dxy, ; 374 *cmpqi/3 [length = 1]
breq .L54 ; , ; 375 branch [length = 1]
ldi r20,lo8(-1) ; dy, ; 568 *movqi/2 [length = 1]
rjmp .L39 ; ; 724 jump [length = 1]
.L54:
ldi r20,lo8(-1) ; dy, ; 566 *movqi/2 [length = 1]
ldi r19,lo8(4) ; dxy, ; 567 *movqi/2 [length = 1]
.L39:
lsr r19 ; dx ; 380 *lshrqi3/3 [length = 1]
subi r19,lo8(-(-1)) ; dx, ; 381 addqi3/2 [length = 1]
sbrs r24,4 ; __result, ; 385 *sbrx_branchhi [length = 2]
rjmp .L36 ;
neg r19 ; dx ; 387 negqi2 [length = 1]
neg r20 ; dy ; 388 negqi2 [length = 1]
.L36:
adiw r26,13 ; vf_32(D)->d.x ; 391 *movqi/3 [length
= 3]
st X,r19 ; dx
sbiw r26,13 ; vf_32(D)->d.x
adiw r26,14 ; vf_32(D)->d.y ; 392 *movqi/3 [length
= 3]
st X,r20 ; dy
sbiw r26,14 ; vf_32(D)->d.y
.L3:
adiw r26,20 ; vf_32(D)->pix.x ; 395 *movqi/4 [length
= 3]
ld r19,X ; pixx
sbiw r26,20 ; vf_32(D)->pix.x
adiw r26,21 ; vf_32(D)->pix.y ; 396 *movqi/4 [length
= 3]
ld r24,X ; pixy
sbiw r26,21 ; vf_32(D)->pix.y
adiw r26,24 ; vf_32(D)->noskip ; 397 *movqi/4 [length
= 3]
ld r20,X ; vf_32(D)->noskip
sbiw r26,24 ; vf_32(D)->noskip
tst r20 ; vf_32(D)->noskip ; 398 *cmpqi/1 [length = 1]
brne .L40 ; , ; 399 branch [length = 1]
adiw r26,13 ; vf_32(D)->d.x ; 401 *movqi/4 [length
= 3]
ld r20,X ; vf_32(D)->d.x
sbiw r26,13 ; vf_32(D)->d.x
/* #APP */
; 452 "vektor-zeichen.c" 1
subi r19, 0x80 ; pixx
add r19, r20 ; pixx, vf_32(D)->d.x
brvc 0f
sbi 30, 5 ; ,
0: subi r19, 0x80 ; pixx
; 0 "" 2
/* #NOAPP */
adiw r26,14 ; vf_32(D)->d.y ; 404 *movqi/4 [length
= 3]
ld r20,X ; vf_32(D)->d.y
sbiw r26,14 ; vf_32(D)->d.y
/* #APP */
; 453 "vektor-zeichen.c" 1
subi r24, 0x80 ; pixy
add r24, r20 ; pixy, vf_32(D)->d.y
brvc 0f
sbi 30, 5 ; ,
0: subi r24, 0x80 ; pixy
; 0 "" 2
/* #NOAPP */
.L40:
adiw r26,24 ; vf_32(D)->noskip ; 409 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,24 ; vf_32(D)->noskip
adiw r26,20 ; vf_32(D)->pix.x ; 410 *movqi/3 [length
= 3]
st X,r19 ; pixx
sbiw r26,20 ; vf_32(D)->pix.x
adiw r26,21 ; vf_32(D)->pix.y ; 411 *movqi/3 [length
= 3]
st X,r24 ; pixy
sbiw r26,21 ; vf_32(D)->pix.y
adiw r26,29 ; vf_32(D)->shrinky ; 412 *movqi/4 [length
= 3]
ld r20,X ; vf_32(D)->shrinky
sbiw r26,29 ; vf_32(D)->shrinky
tst r20 ; vf_32(D)->shrinky ; 413 *cmpqi/1 [length = 1]
breq .L41 ; , ; 414 branch [length = 1]
adiw r26,19 ; vf_32(D)->p.y ; 416 *movqi/4 [length
= 3]
ld r20,X ; D.2060
sbiw r26,19 ; vf_32(D)->p.y
mov r21,r24 ; y, pixy ; 646 *movqi/1 [length = 1]
sub r21,r20 ; y, D.2060 ; 417 subqi3/1 [length = 1]
mov r24,r21 ; pixy, y ; 647 *movqi/1 [length = 1]
lsl r24 ; pixy ; 419 *ashlqi3/3 [length = 1]
add r24,r21 ; pixy, y ; 420 addqi3/1 [length = 1]
lsr r24 ; pixy ; 422 *lshrqi3/4 [length = 2]
lsr r24 ; pixy
add r24,r20 ; pixy, D.2060 ; 423 addqi3/1 [length
= 1]
adiw r26,31 ; vf_32(D)->shrink.y ; 424 *movqi/4 [length
= 3]
ld r20,X ; D.2179
sbiw r26,31 ; vf_32(D)->shrink.y
cp r20,r24 ; D.2179, pixy ; 425 *cmpqi/2 [length
= 1]
brne .L42 ; , ; 426 branch [length = 1]
adiw r26,30 ; vf_32(D)->shrink.x ; 428 *movqi/4 [length
= 3]
ld r21,X ; vf_32(D)->shrink.x
sbiw r26,30 ; vf_32(D)->shrink.x
cp r21,r19 ; vf_32(D)->shrink.x, pixx ; 429 *cmpqi/2
[length = 1]
breq .L43 ; , ; 430 branch [length = 1]
.L42:
mov r21,r24 ; tmp286, pixy ; 648 *movqi/1 [length
= 1]
sub r21,r20 ; tmp286, D.2179 ; 433 subqi3/1 [length
= 1]
/* #APP */
; 480 "vektor-zeichen.c" 1
subi r20, 0x80 ; y
add r20, r21 ; y, tmp286
brvc 0f
sbi 30, 5 ; ,
0: subi r20, 0x80 ; y
; 0 "" 2
/* #NOAPP */
adiw r26,31 ; vf_32(D)->shrink.y ; 436 *movqi/3 [length
= 3]
st X,r24 ; pixy
sbiw r26,31 ; vf_32(D)->shrink.y
adiw r26,30 ; vf_32(D)->shrink.x ; 437 *movqi/3 [length
= 3]
st X,r19 ; pixx
sbiw r26,30 ; vf_32(D)->shrink.x
.L41:
mov r6,r19 ; reg_pixel, pixx ; 440 *movqi/1 [length
= 1]
mov r7,r24 ; reg_pixel, pixy ; 441 *movqi/1 [length
= 1]
sbi 62-0x20,1 ; , ; 446 *sbi [length = 1]
.L43:
adiw r26,16 ; vf_32(D)->iPixel ; 449 *movqi/4 [length
= 3]
ld r24,X ; D.2187
sbiw r26,16 ; vf_32(D)->iPixel
subi r24,lo8(-(1)) ; D.2187, ; 450 addqi3/2 [length
= 1]
adiw r26,16 ; vf_32(D)->iPixel ; 451 *movqi/3 [length
= 3]
st X,r24 ; D.2187
sbiw r26,16 ; vf_32(D)->iPixel
adiw r26,15 ; vf_32(D)->nPixels ; 452 *movqi/4 [length
= 3]
ld r19,X ; vf_32(D)->nPixels
sbiw r26,15 ; vf_32(D)->nPixels
cp r24,r19 ; D.2187, vf_32(D)->nPixels ; 453 *cmpqi/2
[length = 1]
breq .+2 ; ; 454 branch [length = 2]
rjmp .L55 ;
ldi r19,lo8(0) ; go_redraw, ; 577 *movqi/1 [length = 1]
rjmp .L29 ; ; 726 jump [length = 1]
.L53:
ldi r19,lo8(1) ; go_redraw, ; 563 *movqi/2 [length = 1]
.L29:
adiw r26,16 ; vf_32(D)->iPixel ; 457 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,16 ; vf_32(D)->iPixel
subi r18,lo8(-(1)) ; iLine, ; 458 addqi3/2 [length
= 1]
adiw r26,22 ; vf_32(D)->nLines ; 459 *movqi/4 [length
= 3]
ld r24,X ; vf_32(D)->nLines
sbiw r26,22 ; vf_32(D)->nLines
cp r18,r24 ; iLine, vf_32(D)->nLines ; 460 *cmpqi/2
[length = 1]
brne .L44 ; , ; 461 branch [length = 1]
adiw r26,8 ; vf_32(D)->zoom ; 463 *movqi/4 [length
= 3]
ld r20,X ; zoom
sbiw r26,8 ; vf_32(D)->zoom
adiw r26,18 ; vf_32(D)->p.x ; 464 *movqi/4 [length
= 3]
ld r24,X ; px
sbiw r26,18 ; vf_32(D)->p.x
subi r24,lo8(-(2)) ; px, ; 465 addqi3/2 [length = 1]
mov r18,r20 ; tmp295, zoom ; 649 *movqi/1 [length
= 1]
lsl r18 ; tmp295 ; 467 *ashlqi3/4 [length = 2]
lsl r18 ; tmp295
add r18,r20 ; tmp295, zoom ; 468 addqi3/1 [length
= 1]
add r24,r18 ; px, tmp295 ; 469 addqi3/1 [length = 1]
adiw r26,9 ; vf_32(D)->proportional ; 470 *movqi/4
[length = 3]
ld r18,X ; vf_32(D)->proportional
sbiw r26,9 ; vf_32(D)->proportional
tst r18 ; vf_32(D)->proportional ; 471 *cmpqi/1 [length
= 1]
breq .L45 ; , ; 472 branch [length = 1]
adiw r26,26 ; vf_32(D)->left ; 474 *movqi/4 [length
= 3]
ld r18,X ; left
sbiw r26,26 ; vf_32(D)->left
andi r18,lo8(-64) ; left, ; 475 andqi3/2 [length
= 1]
breq .L45 ; , ; 477 branch [length = 1]
swap r18 ; left ; 650 *rotlqi3_4 [length = 1]
lsr r18 ; left ; 651 *lshrqi3/4 [length = 2]
lsr r18 ; left
andi r18,lo8(3) ; left, ; 652 andqi3/2 [length = 1]
mul r18,r20 ; left, zoom ; 480 *mulqi3_enh [length = 3]
mov r18,r0 ; left
clr r1
adiw r26,28 ; vf_32(D)->zeichen ; 481 *movqi/4 [length
= 3]
ld r20,X ; vf_32(D)->zeichen
sbiw r26,28 ; vf_32(D)->zeichen
cpi r20,lo8(99) ; vf_32(D)->zeichen, ; 482 *cmpqi/3 [length
= 1]
brne .L46 ; , ; 483 branch [length = 1]
subi r18,lo8(-(1)) ; left, ; 485 addqi3/2 [length
= 1]
.L46:
sub r24,r18 ; px, left ; 488 subqi3/1 [length = 1]
adiw r26,26 ; vf_32(D)->left ; 489 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,26 ; vf_32(D)->left
.L45:
adiw r26,25 ; vf_32(D)->right ; 492 *movqi/3 [length
= 3]
st X,__zero_reg__ ;
sbiw r26,25 ; vf_32(D)->right
adiw r26,18 ; vf_32(D)->p.x ; 493 *movqi/3 [length
= 3]
st X,r24 ; px
sbiw r26,18 ; vf_32(D)->p.x
ldi r18,lo8(0) ; iLine, ; 578 *movqi/1 [length = 1]
.L44:
adiw r26,23 ; vf_32(D)->iLine ; 496 *movqi/3 [length
= 3]
st X,r18 ; iLine
sbiw r26,23 ; vf_32(D)->iLine
tst r19 ; go_redraw ; 497 *cmpqi/1 [length = 1]
breq .+2 ; ; 498 branch [length = 2]
rjmp .L58 ;
.L55:
ldi r24,lo8(0) ; D.2049, ; 27 *movqi/1 [length = 1]
.L10:
/* epilogue start */
pop r29 ; ; 662 popqi [length = 1]
pop r28 ; ; 663 popqi [length = 1]
ret ; 664 return_from_epilogue [length = 1]
.size vecfont_draw_letters, .-vecfont_draw_letters
.lcomm lookup.1264,190
typedef int int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
typedef struct { uint8_t x, y; } upixel8_t;
typedef struct { int8_t x, y; } pixel8_t;
typedef struct { uint16_t x, y; } upixel16_t;
typedef struct { int16_t x, y; } pixel16_t;
register upixel8_t reg_pixel asm ("6");
typedef uint8_t vf_uint_t;
typedef int8_t vf_int_t;
typedef upixel8_t vf_upixel_t;
typedef pixel8_t vf_spixel_t;
extern const uint8_t vecfont_data[];
typedef struct
{
const char * text;
void (*beam_xy)(vf_uint_t x, vf_uint_t y);
void (*beam_skip)(void);
vf_upixel_t start;
uint8_t zoom;
uint8_t proportional;
uint8_t text_in_flash;
const uint8_t * addr;
vf_spixel_t d;
vf_uint_t nPixels;
vf_uint_t iPixel;
vf_uint_t itext;
vf_upixel_t p;
vf_upixel_t pix;
uint8_t nLines;
uint8_t iLine;
uint8_t noskip;
uint8_t right;
uint8_t left;
uint8_t inject_char;
uint8_t zeichen;
uint8_t shrinky;
vf_upixel_t shrink;
} vecfont_t;
extern uint8_t vecfont_draw_letters (vecfont_t * vf);
extern void vecfont_reset (vecfont_t * vf);
uint8_t vecfont_draw_letters (vecfont_t * vf)
{
while (0==0)
{
uint8_t iLine = vf->iLine;
if (vf->iPixel == 0)
{
if (iLine == 0)
{
uint8_t zeichen;
{
vf_uint_t itext = vf->itext;
if (itext == 0)
{
vf->p.x = vf->start.x;
vf->p.y = vf->start.y;
}
const char * pzeichen = &vf->text[itext];
zeichen = (uint8_t) *pzeichen;
if (vf->text_in_flash)
zeichen = (__extension__({ uint16_t __addr16 =
(uint16_t)((uint16_t)(pzeichen)); uint8_t __result; __asm__ ( "lpm %0, Z"
"\n\t" : "=r" (__result) : "z" (__addr16) ); __result; }));
vf->itext = itext+1;
}
# 146 "vektor-zeichen.c"
uint8_t zoom = vf->zoom;
if (zeichen <= ' ')
{
if (zeichen == '\0')
{
vf->itext = 0;
return 1;
}
if (zeichen == '\r')
continue;
if (zeichen == ' ')
{
vf->p.x += (2+5*(zoom));
continue;
}
if (zeichen == '\n')
{
vf->p.y -= (vf_uint_t) (3+8*(zoom));
vf->p.x = vf->start.x;
continue;
}
if (zeichen == '\b')
{
vf->p.x -= (vf_uint_t) (2+5*(zoom));
continue;
}
}
# 205 "vektor-zeichen.c"
vf->pix.y = vf->p.y;
vf->pix.x = vf->p.x;
const uint8_t * addr = vecfont_data;
static const uint8_t * lookup[(uint8_t) (127 - 0x21 +1)];
const uint8_t ** lookup_addr = 0;
if (zeichen >= 0x21
&& zeichen <= (uint16_t) 0x21 + 127)
{
lookup_addr = & lookup[zeichen - 0x21];
if (*lookup_addr)
addr = *lookup_addr;
}
uint8_t nLines;
uint8_t nLinesRightLeft;
uint8_t id;
while (1)
{
id = (__extension__({ uint8_t __result; __asm__ ( "lpm %0,
Z+" : "=r" (__result), "=z" (addr) : "1" (addr) ); __result; }));
nLinesRightLeft = (__extension__({ uint8_t __result;
__asm__ ( "lpm %0, Z+" : "=r" (__result), "=z" (addr) : "1" (addr) ); __result;
}));
nLines = nLinesRightLeft & 0x1f;
if (id == zeichen)
break;
if (id == ((uint8_t) '\001'))
{
extern const uint8_t snake_glyph[];
addr = (const uint8_t*) snake_glyph;
continue;
}
if (id == ((uint8_t) '\002'))
break;
addr += nLines;
}
vf->zeichen = id;
vf->addr = addr;
vf->nLines = nLines;
if (lookup_addr)
*lookup_addr = addr - 2;
uint8_t proportional = 0;
proportional = vf->proportional;
if (proportional)
{
if (id == 'T' || id == 'F')
nLinesRightLeft += (1 << 6);
}
vf->left = nLinesRightLeft;
vf->right = 0;
if ((nLinesRightLeft & (1 << 5)) && !proportional)
vf->right = zoom;
vf->shrinky = 0;
vf->shrink.x = 0;
vf->shrink.y = vf->pix.y;
}
const uint8_t * addr = vf->addr;
uint8_t data = (__extension__({ uint8_t __result; __asm__ ( "lpm
%0, Z+" : "=r" (__result), "=z" (addr) : "1" (addr) ); __result; }));
vf_uint_t nPixels = data >> 5;
vf_int_t dx, dy;
uint8_t zoom = vf->zoom;
if (nPixels == 0)
{
dx = data;
dy = (__extension__({ uint8_t __result; __asm__ ( "lpm %0, Z+"
: "=r" (__result), "=z" (addr) : "1" (addr) ); __result; }));
vf->addr = addr;
if (zoom > 1)
vf->shrinky = dy & (1 << 7);
dy &= ~(1 << 7);
if (dy >= 20)
dy -= 32;
dx = (vf_uint_t) dx * zoom;
dy = (vf_uint_t) dy * zoom;
dx += vf->right;
vf->pix.x = vf->p.x + dx;
vf->pix.y = vf->p.y + dy;
do { (void) 0; (*(volatile uint8_t *)((0x1E) + 0x20)) |=
(1<<5); } while (0);
vf->iLine += 2;
continue;
}
vf->addr = addr;
if (vf->iPixel == 0)
{
if (iLine == 0)
{
vf->pix.x += vf->right;
do { (void) 0; (*(volatile uint8_t *)((0x1E) + 0x20)) |=
(1<<5); } while (0);
}
}
nPixels *= zoom;
# 379 "vektor-zeichen.c"
{
nPixels--;
uint8_t d;
if ((d = data & 1, d)) nPixels++;
if ((d = data & 2, d)) nPixels++, vf->noskip = 1;
if (!nPixels)
{
vf->noskip = 0;
goto next_pixel;
}
}
uint8_t dots = 0;
if (data == ((7 << 5) | (0 ? 2 : 0) | (0 ? 1 : 0) | (( (-1 == 1 &&
-1 == 0) ? 4 : (-1 == 1 && -1 == -1) ? 3 : (-1 == 0 && -1 == -1) ? 2 : (-1 ==
-1 && -1 == -1) ? 1 : (-1 == -1 && -1 == 0) ? 0 : (-1 == -1 && -1 == 1) ? 7 :
(-1 == 0 && -1 == 1) ? 6 : 5 ) << 2))) vf->pix.x --, dots = 1;
if (data == ((7 << 5) | (1 ? 2 : 0) | (0 ? 1 : 0) | (( (-1 == 1 &&
-1 == 0) ? 4 : (-1 == 1 && -1 == -1) ? 3 : (-1 == 0 && -1 == -1) ? 2 : (-1 ==
-1 && -1 == -1) ? 1 : (-1 == -1 && -1 == 0) ? 0 : (-1 == -1 && -1 == 1) ? 7 :
(-1 == 0 && -1 == 1) ? 6 : 5 ) << 2))) vf->pix.x ++, dots = 1;
if (data == ((7 << 5) | (0 ? 2 : 0) | (1 ? 1 : 0) | (( (-1 == 1 &&
-1 == 0) ? 4 : (-1 == 1 && -1 == -1) ? 3 : (-1 == 0 && -1 == -1) ? 2 : (-1 ==
-1 && -1 == -1) ? 1 : (-1 == -1 && -1 == 0) ? 0 : (-1 == -1 && -1 == 1) ? 7 :
(-1 == 0 && -1 == 1) ? 6 : 5 ) << 2))) dy = -1, dots = 2;
if (data == ((7 << 5) | (1 ? 2 : 0) | (1 ? 1 : 0) | (( (-1 == 1 &&
-1 == 0) ? 4 : (-1 == 1 && -1 == -1) ? 3 : (-1 == 0 && -1 == -1) ? 2 : (-1 ==
-1 && -1 == -1) ? 1 : (-1 == -1 && -1 == 0) ? 0 : (-1 == -1 && -1 == 1) ? 7 :
(-1 == 0 && -1 == 1) ? 6 : 5 ) << 2))) dy = 1, dots = 3;
if (dots == 1)
{
vf->nPixels = zoom;
dx = 0;
dy = 1;
vf->noskip = 0;
}
else if (dots >= 2)
{
if (dots == 2 && zoom == 1)
goto next_pixel;
dx = 0;
vf->nPixels = (uint8_t) (zoom+1)/2;
vf->noskip = 0;
}
else
{
vf->nPixels = nPixels;
uint8_t dxy = (data >> 2) & 3;
dy = dxy;
if (dy) dy = -1;
if (dxy == 3) dxy = 4;
dx = dxy >> 1;
dx -= 1;
if (data & (1 << 4))
dx = -dx, dy = -dy;
}
vf->d.x = dx;
vf->d.y = dy;
}
vf_uint_t pixx = vf->pix.x;
vf_uint_t pixy = vf->pix.y;
if (!vf->noskip)
{
asm volatile ( "subi %[x], 0x80" "\n\t" "add %[x], %[y]" "\n\t"
"brvc 0f" "\n\t" "sbi %[flags], %[skipbit]" "\n" "0:\tsubi %[x], 0x80" : [x]
"+d" (pixx) : [y] "r" (vf->d.x), [flags] "n" ((((uint16_t) &((*(volatile
uint8_t *)((0x1E) + 0x20)))) - 0x20)), [skipbit] "n" (5));
asm volatile ( "subi %[x], 0x80" "\n\t" "add %[x], %[y]" "\n\t"
"brvc 0f" "\n\t" "sbi %[flags], %[skipbit]" "\n" "0:\tsubi %[x], 0x80" : [x]
"+d" (pixy) : [y] "r" (vf->d.y), [flags] "n" ((((uint16_t) &((*(volatile
uint8_t *)((0x1E) + 0x20)))) - 0x20)), [skipbit] "n" (5));
}
vf->noskip = 0;
vf->pix.x = pixx;
vf->pix.y = pixy;
uint8_t doplot = 1;
if (vf->shrinky)
{
uint8_t y = pixy - vf->p.y;
y *= 3; y /= 4;
pixy = vf->p.y+y;
if (vf->shrink.y != pixy || vf->shrink.x != pixx)
{
y = vf->shrink.y;
int8_t delta = pixy-y;
asm volatile ( "subi %[x], 0x80" "\n\t" "add %[x], %[y]"
"\n\t" "brvc 0f" "\n\t" "sbi %[flags], %[skipbit]" "\n" "0:\tsubi %[x], 0x80"
: [x] "+d" (y) : [y] "r" (delta), [flags] "n" ((((uint16_t) &((*(volatile
uint8_t *)((0x1E) + 0x20)))) - 0x20)), [skipbit] "n" (5));
vf->shrink.y = pixy;
vf->shrink.x = pixx;
}
else
doplot = 0;
}
if (doplot)
do { (void) 0; reg_pixel.x = pixx; reg_pixel.y = pixy;
(*(volatile uint8_t *)((0x1E) + 0x20)) |= (1<<1); } while(0);
if (++vf->iPixel == vf->nPixels)
{
uint8_t go_redraw = 0;
if (0)
{
next_pixel:
go_redraw = 1;
}
vf->iPixel = 0;
if (++iLine == vf->nLines)
{
iLine = 0;
vf_uint_t px = vf->p.x;
uint8_t zoom = vf->zoom;
px += (2+5*(zoom));
if (vf->proportional)
{
uint8_t left = vf->left & 0xc0;
if (left)
{
left >>= 6;
left = (vf_uint_t) (left * zoom);
if (vf->zeichen == 'c')
left++;
px -= left;
vf->left = 0;
}
}
vf->right = 0;
vf->p.x = px;
}
vf->iLine = iLine;
if (go_redraw)
continue;
}
break;
}
return 0;
}
.file "snake-i.c"
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
; GNU C (GCC) version 4.5.1 (avr)
; compiled by GNU C version 4.1.0 (SUSE Linux), GMP version 4.3.1, MPFR
version 2.4.2, MPC version 0.8.1
; GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
; options passed: -fpreprocessed snake-i.i -mmcu=atmega168 -Os
; -std=gnu99 -fverbose-asm
; options enabled: -falign-loops -fargument-alias -fauto-inc-dec
; -fbranch-count-reg -fcaller-saves -fcommon -fcprop-registers
; -fcrossjumping -fcse-follow-jumps -fdefer-pop -fearly-inlining
; -feliminate-unused-debug-types -fexpensive-optimizations
; -fforward-propagate -ffunction-cse -fgcse -fgcse-lm
; -fguess-branch-probability -fident -fif-conversion -fif-conversion2
; -findirect-inlining -finline -finline-functions
; -finline-functions-called-once -finline-small-functions -fipa-cp
; -fipa-pure-const -fipa-reference -fipa-sra -fira-share-save-slots
; -fira-share-spill-slots -fivopts -fkeep-static-consts
; -fleading-underscore -fmath-errno -fmerge-constants
; -fmerge-debug-strings -fmove-loop-invariants -fomit-frame-pointer
; -foptimize-register-move -foptimize-sibling-calls -fpeephole
; -fpeephole2 -freg-struct-return -fregmove -freorder-blocks
; -freorder-functions -frerun-cse-after-loop
; -fsched-critical-path-heuristic -fsched-dep-count-heuristic
; -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic
; -fsched-rank-heuristic -fsched-spec -fsched-spec-insn-heuristic
; -fsched-stalled-insns-dep -fshow-column -fsigned-zeros
; -fsplit-ivs-in-unroller -fsplit-wide-types -fstrict-aliasing
; -fstrict-overflow -fthread-jumps -ftoplevel-reorder -ftrapping-math
; -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop
; -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse
; -ftree-forwprop -ftree-fre -ftree-loop-im -ftree-loop-ivcanon
; -ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop
; -ftree-pre -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
; -ftree-slp-vectorize -ftree-sra -ftree-switch-conversion -ftree-ter
; -ftree-vect-loop-version -ftree-vrp -funit-at-a-time -fverbose-asm
; -fzero-initialized-in-bss
; Compiler executable checksum: 1009e10776a492a4930a8528eab0e20f
.text
.global snake_read_wall_seg
.type snake_read_wall_seg, @function
snake_read_wall_seg:
push r17 ; ; 144 *pushqi/1 [length = 1]
/* prologue: function */
/* frame size = 0 */
/* stack size = 1 */
.L__stack_usage = 1
movw r26,r24 ; sb, sb ; 2 *movhi/1 [length = 1]
adiw r26,12 ; sb_11(D)->draw.wall ; 13 *movhi/2 [length
= 4]
ld r30,X+ ; wall
ld r31,X ; wall
sbiw r26,12+1 ; sb_11(D)->draw.wall
ldi r24,lo8(-4) ; tmp73, ; 14 *movqi/2 [length = 1]
adiw r26,7 ; sb_11(D)->draw.elem ; 15 *movqi/3 [length
= 3]
st X,r24 ; tmp73
sbiw r26,7 ; sb_11(D)->draw.elem
adiw r26,5 ; sb_11(D)->level ; 16 *movqi/4 [length
= 3]
ld r20,X ; sb_level
sbiw r26,5 ; sb_11(D)->level
mov r21,r20 ; sb_level_40, sb_level ; 140 *movqi/1
[length = 1]
subi r21,lo8(-(64)) ; sb_level_40, ; 17 addqi3/2
[length = 1]
ldi r24,lo8(snake_wall) ; tmp75, ; 138 *movhi/4 [length
= 2]
ldi r25,hi8(snake_wall) ; tmp75,
mov r25,r24 ; dir_0, ; 141 *movqi/1 [length = 1]
eor r25,r30 ; dir_0, wall ; 20 xorqi3 [length = 1]
.L3:
.L15:
/* #APP */
; 75 "snake-i.c" 1
lpm r24, Z+ ; __result
; 0 "" 2
/* #NOAPP */
cpi r24,lo8(-127) ; __result, ; 30 *cmpqi/3 [length
= 1]
brne .L11 ; , ; 31 branch [length = 1]
/* #APP */
; 80 "snake-i.c" 1
lpm r24, Z+ ; __result
; 0 "" 2
/* #NOAPP */
adiw r26,10 ; sb_11(D)->draw.x ; 36 *movqi/3 [length
= 3]
st X,r24 ; __result
sbiw r26,10 ; sb_11(D)->draw.x
/* #APP */
; 81 "snake-i.c" 1
lpm r24, Z+ ; __result
; 0 "" 2
/* #NOAPP */
adiw r26,11 ; sb_11(D)->draw.y ; 40 *movqi/3 [length
= 3]
st X,r24 ; __result
sbiw r26,11 ; sb_11(D)->draw.y
/* #APP */
; 82 "snake-i.c" 1
lpm r24, Z+ ; __result
; 0 "" 2
/* #NOAPP */
subi r25,lo8(-(1)) ; dir_0, ; 44 addqi3/2 [length
= 1]
ldi r23,lo8(1) ; first, ; 122 *movqi/2 [length = 1]
rjmp .L4 ; ; 150 jump [length = 1]
.L11:
ldi r23,lo8(0) ; first, ; 123 *movqi/1 [length = 1]
.L4:
subi r25,lo8(-(1)) ; dir_0, ; 47 addqi3/2 [length
= 1]
mov r17,r25 ; dir, dir_0 ; 142 *movqi/1 [length = 1]
andi r17,lo8(1) ; dir, ; 48 andqi3/2 [length = 1]
sbrc r24,0 ; dir_len, ; 52 *sbrx_branchhi [length = 2]
ori r17,lo8(2) ; dir, ; 54 iorqi3/2 [length = 1]
.L5:
mov r22,r24 ; level, dir_len ; 143 *movqi/1 [length
= 1]
lsr r22 ; level ; 57 *lshrqi3/3 [length = 1]
andi r22,lo8(67) ; level, ; 58 andqi3/2 [length
= 1]
cp r22,r21 ; level, sb_level_40 ; 59 *cmpqi/2 [length
= 1]
brsh .L12 ; , ; 60 branch [length = 1]
ldi r18,lo8(1) ; iftmp.4, ; 125 *movhi/4 [length = 2]
ldi r19,hi8(1) ; iftmp.4,
cp r22,r20 ; level, sb_level ; 63 *cmpqi/2 [length
= 1]
brlo .L6 ; , ; 64 branch [length = 1]
ldi r18,lo8(0) ; iftmp.4, ; 126 *movhi/1 [length = 2]
ldi r19,hi8(0) ; iftmp.4,
rjmp .L6 ; ; 152 jump [length = 1]
.L12:
ldi r18,lo8(1) ; iftmp.4, ; 124 *movhi/4 [length = 2]
ldi r19,hi8(1) ; iftmp.4,
.L6:
andi r24,lo8(121) ; dir_len, ; 70 andqi3/2 [length
= 1]
cpi r24,lo8(1) ; dir_len, ; 71 *cmpqi/3 [length = 1]
brne .L8 ; , ; 72 branch [length = 1]
tst r18 ; level_ok ; 74 *cmpqi/1 [length = 1]
brne .L15 ; , ; 75 branch [length = 1]
ldi r24,lo8(0) ; dir_len, ; 127 *movqi/1 [length = 1]
.L8:
andi r24,lo8(120) ; len, ; 78 andqi3/2 [length
= 1]
breq .L9 ; , ; 80 branch [length = 1]
tst r18 ; level_ok ; 82 *cmpqi/1 [length = 1]
breq .L15 ; , ; 83 branch [length = 1]
.L9:
adiw r26,12+1 ; sb_11(D)->draw.wall ; 86 *movhi/3 [length
= 4]
st X,r31 ; wall
st -X,r30 ; wall
sbiw r26,12 ; sb_11(D)->draw.wall
adiw r26,9 ; sb_11(D)->draw.dir ; 87 *movqi/3 [length
= 3]
st X,r17 ; dir
sbiw r26,9 ; sb_11(D)->draw.dir
adiw r26,8 ; sb_11(D)->draw.len ; 88 *movqi/3 [length
= 3]
st X,r24 ; len
sbiw r26,8 ; sb_11(D)->draw.len
tst r24 ; len ; 89 *cmpqi/1 [length = 1]
brne .L10 ; , ; 90 branch [length = 1]
ldi r24,lo8(-3) ; tmp86, ; 92 *movqi/2 [length = 1]
adiw r26,7 ; sb_11(D)->draw.elem ; 93 *movqi/3 [length
= 3]
st X,r24 ; tmp86
sbiw r26,7 ; sb_11(D)->draw.elem
ldi r23,lo8(1) ; first, ; 10 *movqi/2 [length = 1]
.L10:
mov r24,r23 ; , first ; 100 *movqi/1 [length = 1]
/* epilogue start */
pop r17 ; ; 147 popqi [length = 1]
ret ; 148 return_from_epilogue [length = 1]
.size snake_read_wall_seg, .-snake_read_wall_seg
typedef unsigned int size_t;
typedef int int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
typedef struct { uint8_t x, y; } upixel8_t;
typedef struct { int8_t x, y; } pixel8_t;
typedef struct
{
uint8_t dir;
union
{
struct
{
upixel8_t head;
upixel8_t food;
};
upixel8_t p[2];
};
uint8_t level;
uint8_t ntexte;
struct
{
uint8_t elem;
uint8_t len;
uint8_t dir;
uint8_t x, y;
const uint8_t * wall;
uint8_t ntext;
} draw;
struct
{
uint8_t start;
uint8_t nseg;
struct
{
uint8_t dir, len;
} seg[25];
} body;
char str[15];
} snake_frame_t;
extern const uint8_t snake_wall[];
extern uint8_t snake_read_wall_seg (snake_frame_t *s);
uint8_t
snake_read_wall_seg (snake_frame_t *sb)
{
uint8_t dir_len, dir, len, dir_0;
uint8_t sb_level, sb_level_40;
const uint8_t * wall = sb->draw.wall;
(void) 0;
sb->draw.elem = 0xfd-1;
sb_level = sb->level;
sb_level_40 = sb_level + 0x40;
dir_0 = ((unsigned int) wall) ^ ((unsigned int) snake_wall);
_next_seg:;
uint8_t first = 0;
dir_len = (__extension__({ uint8_t __result; __asm__ ( "lpm %0, Z+" : "=r"
(__result), "=z" (wall) : "1" (wall) ); __result; }));
if (dir_len == (0 | ( 0x01 & (2 >> 1)) | ( 0x78 & (0 << 3)) | ( 0x86 &
((0x40) << 1)) ))
{
first = 1;
sb->draw.x = (__extension__({ uint8_t __result; __asm__ ( "lpm %0, Z+"
: "=r" (__result), "=z" (wall) : "1" (wall) ); __result; }));
sb->draw.y = (__extension__({ uint8_t __result; __asm__ ( "lpm %0, Z+"
: "=r" (__result), "=z" (wall) : "1" (wall) ); __result; }));
dir_len = (__extension__({ uint8_t __result; __asm__ ( "lpm %0, Z+" :
"=r" (__result), "=z" (wall) : "1" (wall) ); __result; }));
dir_0++;
}
dir_0++;
dir = dir_0 & 1;
if (dir_len & 1)
dir |= 2;
uint8_t level = dir_len >> 1;
level &= 0x43;
uint8_t level_ok = sb_level_40 <= level
|| sb_level > level;
dir_len &= ~0x86;
if (dir_len == 1)
{
if (level_ok)
goto _next_seg;
dir_len = 0;
}
len = dir_len & 0x78;
if (len && !level_ok)
goto _next_seg;
sb->draw.wall = wall;
sb->draw.dir = dir;
sb->draw.len = len;
if (!len)
{
sb->draw.elem = 0xfd;
return 1;
}
return first;
}
- [avr-gcc-list] avr-gcc 4.5.1 doing bad reloads using X,
Georg Lay <=