This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to force 32bit access to bit fields ?
- From: dewar at gnat dot com (Robert Dewar)
- To: RGrosseBoerger at dspace dot de, gcc at gcc dot gnu dot org
- Date: Wed, 5 Feb 2003 08:21:53 -0500 (EST)
- Subject: Re: How to force 32bit access to bit fields ?
> Hi,
>
> I am having a problem with the code GCC generates for bit field accesses. On
> IA32 GCC 3.2.1 generates 8-bit instructions for a bit field access, but my
> device memory only supports 32-bit accesses.
> Is there any way to make GCC use 32-bit load and store instructions for a
> bit field access?
> Can anyone point me to the corresponding subroutines in GCC that generate
> code for bit fields?
> Best Regards
> Ralf
It seems best to me to use ASM inserts if you really need to control the
exact instructions that are issued. It is certainly valid for gcc to use
32-bit accesses in this situation, and it is hard to see how this could
be "fixed".
There is a long discussion in the Ada context about the identical issue.
One sort of approach is the following implementation advice.
If there is an access to a volatile variable, then if this access can be
done in a single instruction which accesses the entire variable it should
be done that way.