[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] [WinAVR 20090313] Bug in split-Pattern for swap
From: |
Georg-Johann Lay |
Subject: |
Re: [avr-gcc-list] [WinAVR 20090313] Bug in split-Pattern for swap |
Date: |
Mon, 30 Mar 2009 20:30:30 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.7 (Windows/20050923) |
Georg-Johann Lay schrieb:
Hi guys, in pass .166r.split1, avr-gcc makes a wrong transformation for
the following testcase, compiled with -O:
void g(unsigned char);
void f1(unsigned x)
{
unsigned char y;
y = (x >> 12) & 0x0F;
g(y);
}
To be more specific, I attached the asm output for the even simpler test
case
char f1 (unsigned x)
{
return x >> 12;
}
compiled with -mmcu=atmega168 -O -fverbose-asm -dp -S.
The bug is also triggered for right shifts by 14 and 13, and also for
WinAVR-20080512.
The bug is also present in a patched avr-gcc 4.3.3 distro at
http://packages.debian.org/en/sid/gcc-avr. However, I cannot reproduce
the bug with avr-gcc built from svn gcc_4_3_3_release and therefore I
cannot say if the mentioned split patterns are the very problem or just
reveal an other bug somewhere else.
Projects using the respective versions of avr-gcc can try
-fno-split-wide-types as a fix.
Georg-Johann
.file "foo.c"
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__CCP__ = 0x34
__tmp_reg__ = 0
__zero_reg__ = 1
; GNU C (WinAVR 20090313) version 4.3.2 (avr)
; compiled by GNU C version 3.4.5 (mingw-vista special r3), GMP version
4.2.3, MPFR version 2.4.0.
; GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32702
; options passed: -imultilib avr5 -iprefix
; e:\winavr-20090313\bin\../lib/gcc/avr/4.3.2/ foo.c -mmcu=atmega168 -O
; -fverbose-asm
; options enabled: -falign-loops -fargument-alias -fauto-inc-dec
; -fbranch-count-reg -fcommon -fcprop-registers -fdefer-pop
; -fearly-inlining -feliminate-unused-debug-types -ffunction-cse
; -fgcse-lm -fguess-branch-probability -fident -fif-conversion
; -fif-conversion2 -finline-functions-called-once -fipa-pure-const
; -fipa-reference -fivopts -fkeep-static-consts -fleading-underscore
; -fmath-errno -fmerge-constants -fmerge-debug-strings
; -fmove-loop-invariants -fomit-frame-pointer -fpeephole
; -freg-struct-return -fsched-interblock -fsched-spec
; -fsched-stalled-insns-dep -fsigned-zeros -fsplit-ivs-in-unroller
; -fsplit-wide-types -ftoplevel-reorder -ftrapping-math -ftree-ccp
; -ftree-ch -ftree-copy-prop -ftree-copyrename -ftree-dce
; -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-loop-im
; -ftree-loop-ivcanon -ftree-loop-optimize -ftree-parallelize-loops=
; -ftree-reassoc -ftree-salias -ftree-scev-cprop -ftree-sink -ftree-sra
; -ftree-ter -ftree-vect-loop-version -funit-at-a-time -fverbose-asm
; -fzero-initialized-in-bss
; Compiler executable checksum: abe89850c430a90419070abaa31bf632
.text
.global f1
.type f1, @function
f1:
/* prologue: function */
/* frame size = 0 */
swap r24 ; ; 26 *swap [length = 1]
andi r24,lo8(15) ; , ; 27 andqi3/2 [length = 1]
/* epilogue start */
ret ; 31 return [length = 1]
.size f1, .-f1