bugGNU Development Chain for 68HC11/68HC12 - Bugs: bug #12820, 3.0 lost unsigned-char optimization

 
 

You are not allowed to post comments on this tracker with your current authentification level.

bug #12820: 3.0 lost unsigned-char optimization

Submitted by:  Jefferson Smith <imajeff>
Submitted on:  Tue 26 Apr 2005 03:37:10 PM UTC  
 
Category: gccSeverity: 3 - Normal
Item Group: sw-bugStatus: Confirmed
Privacy: PublicAssigned to: Stephane Carrez <ciceron>
Open/Closed: Open

Sun 08 May 2005 10:26:08 AM UTC, comment #1:

Thanks for the bug report.

It is interesting to note that with -m68hc11, we still
generate a better instruction set with bitb (8-bit test only).

I'll investigate as soon as I've some free time...

Stephane Carrez <ciceron>
Project AdministratorIn charge of this item.
Tue 26 Apr 2005 03:37:10 PM UTC, original submission:

I don't know if you would call this broken optimization or other bug.

Gcc is treating the unsigned char as 16 bits. The problem did not exist in release 2.2.

            • source ******

int main(void);
unsigned char c;

int main()
{
if ( (c & 0x01) == 0) {
return 1;
}

return 0;
}

          • compilation *****

/usr/local/bin/gcc-m6811-x/m6811-elf-gcc -c -I. -I../../../gel/include/asm-m68hc12/arch-dragon12 -I../../../gel/include -m68hc12 -mshort -Wall -Wmissing-prototypes -g -Os -o err2.o err2.c

          • release 2.2 *****

if ( (vPortCCRSave & 0x10) == 0)

44fa: f6 18 51 ldab 1851 <vPortCCRSave>
44fd: c4 10 andb #16
44ff: 26 02 bne 4503 <.LM73>

      • The same block compiled by release 3.0 ***

if ( (vPortCCRSave & 0x10) == 0)

4558: f6 18 be ldab 18be <vPortCCRSave>
455b: 84 00 anda #0
455d: c4 10 andb #16
455f: 04 64 02 tbne D,4564 <.LM71>

The 'A' register is dead weight, but is not removed by 3.0. Then because it's accessing the unsigned char as 16-bit, it uses "tbne D," to further weigh down the function.

Jefferson Smith <imajeff>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 4 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 05 Nov 2005 09:05:44 PM UTCciceronStatusNone=>Confirmed
Sun 08 May 2005 10:26:07 AM UTCciceronAssigned toNone=>ciceron
Sun 08 May 2005 10:26:04 AM UTCciceronItem GroupNone=>sw-bug
Tue 26 Apr 2005 03:37:10 PM UTCimajeffCarbon-Copy-=>Added imajeff

Back to the top


Powered by Savane 3.1-cleanup