- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you look at the generated code for reads of volatile char and short data, it seems that gcc assumes that the high bits of the register are undefined.
For instance: int fubar(volatile char *bar) { return *bar; } Generates: ldbu r5, 0(r4) andi r3, r5, 255 xori r2, r3, 128 addi r2, r2, -128 ret Without the volatile the expected 'ldb r2, 0(r4)' is generated. I've tried buiding gcc with PROMOTE_MODE defined (to its typical value) - but that has no effect. Any other thoughts?? DavidLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some further info:
With 'volatile unsigned char *bar' both the 'ldbu' and 'andi rx,rx,0xff' instructions come from the 'zero_extendqisi2' pattern. David
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page