This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]