avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #40003] Integer type promotion leads to inefficent c


From: Joey Morin
Subject: [avr-libc-dev] [bug #40003] Integer type promotion leads to inefficent code in wdt.h
Date: Wed, 11 Sep 2013 15:15:34 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0

URL:
  <http://savannah.nongnu.org/bugs/?40003>

                 Summary: Integer type promotion leads to inefficent code in
wdt.h
                 Project: AVR C Runtime Library
            Submitted by: joeymorin
            Submitted on: Wed 11 Sep 2013 03:15:33 PM GMT
                Category: Library
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Header files
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.8.0
           Fixed Release: None

    _______________________________________________________

Details:

Operands constructed in this fashion:
        "r" (_BV(_WD_CHANGE_BIT) | _BV(WDE)),

...result in the use of two registers, one of which is loaded with 0x00 and
never used.

Seems as though integer type promotion is responsible.  A fix is as simple as
casting to an 8-bit type:
        "r" ((uint8_t)(_BV(_WD_CHANGE_BIT) | _BV(WDE))),

Indeed, most __asm__ statements in wdt.h are already taking this approach, but
a couple are not.

Attached is a patch to resolve the issue.

I'm aware this is a minor issue, but as it is easy to resolve, I hope it will
be accepted :)

Cheers,
JJ





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 11 Sep 2013 03:15:33 PM GMT  Name: wdt.h.patch  Size: 802B   By:
joeymorin

<http://savannah.nongnu.org/bugs/download.php?file_id=29105>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40003>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]