Can I force a word read-modify-write instread of a byte write?

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

 



Dear Experts,

I know that in some circumstances gcc will generate read-modify-write sequences to access memory locations, for example if I have a bitfield struct. Is there a way in which I can tell it to only do (32-bit) word writes to a region of memory, and to do read-modify-write sequences instead of byte writes, even though the processor does have byte write instructions?

The situation is that I have some FPGA logic which only implements word writes. My options are:

(a) Make the FPGA hardware support byte writes.
(b) Do explicit read/modify/write sequences in my C code.
(c) Persuade gcc to do the work for me.

Since both (a) and (b) involve quite a lot of work, I have crossed my fingers in the hope that I can just add some magic __attribute__ somewhere and gcc will do the work for me. Am I in luck?


Many thanks for any suggestions,

Phil.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux