public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/50223] AVRGCC - dont clear r26 and r27.....its a (small) waste of CPU cycles. Date: Sat, 17 Sep 2011 19:48:00 -0000 [thread overview] Message-ID: <bug-50223-4-cScyzM754z@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-50223-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50223 Georg-Johann Lay <gjl at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Known to work| |4.6.1 Resolution| |WORKSFORME --- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-17 18:35:52 UTC --- Following test program extern uint8_t leadingZeros[]; #define pgm_read(a,b) asm ("lpm %0,%a1" : "=r" (a) : "z" ((uint16_t)(b))) uint8_t ldgZeroCntNormU32 (uint32_t* x) { uint8_t zCount = 0; uint8_t shft; uint32_t quad = *x; while (!(uint8_t)(quad >> 24)) { zCount += 8; quad <<=8; } pgm_read (shft, &leadingZeros[(uint8_t)(quad >> 24)]); *x = quad << shft; return zCount + shft; } yields with avr-gcc-4.6.1 -Os -mmcu=atmega8 -S following result: ldgZeroCntNormU32: movw r26,r24 ld r20,X+ ld r21,X+ ld r22,X+ ld r23,X sbiw r26,3 ldi r24,lo8(0) rjmp .L2 .L3: subi r24,lo8(-(8)) mov r23,r22 mov r22,r21 mov r21,r20 clr r20 .L2: mov r30,r23 tst r23 breq .L3 ldi r31,lo8(0) subi r30,lo8(-(leadingZeros)) sbci r31,hi8(-(leadingZeros)) /* #APP */ ; 20 "foo.c" 1 lpm r30,Z ; 0 "" 2 /* #NOAPP */ mov r0,r30 rjmp 2f 1: lsl r20 rol r21 rol r22 rol r23 2: dec r0 brpl 1b st X+,r20 st X+,r21 st X+,r22 st X,r23 sbiw r26,3 add r24,r30 ret So there is no CLR for the while (!(uint8_t)(quad >> 24)) Closed as works for me.
prev parent reply other threads:[~2011-09-17 18:36 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-08-29 3:01 [Bug c/50223] New: " NickParker at Eaton dot com 2011-08-31 20:48 ` [Bug target/50223] " gjl at gcc dot gnu.org 2011-09-17 19:48 ` gjl at gcc dot gnu.org [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-50223-4-cScyzM754z@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).