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 authentication level.

bug #12820: 3.0 lost unsigned-char optimization

Submitter:  Jefferson Smith <imajeff>
Submitted:  Tue 26 Apr 2005 03:37:10 PM UTC
   
 
Category:  gcc Severity:  3 - Normal
Item Group:  sw-bug Status:  Confirmed
Privacy:  Public Assigned to:  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>
Group administrator
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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-11-05 ciceron StatusNone Confirmed
2005-05-08 ciceron Assigned toNone ciceron
2005-05-08 ciceron Item GroupNone sw-bug
2005-04-26 imajeff Carbon-Copy- Added imajeff

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code