This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Some middle-end improvements for bitfield handling (followup)
> The 2 reads are easily explained.
> One of them comes from extract_bit_field, which is the read of the bitfield
> value from memory. The other comes from store_bit_field, where it needs to
> read the remaining bits.
>
> Let's consider
> volatile struct { unsigned int i : 3, j : 29; } b;
> void test1 (unsigned int x)
> {
> b.j += x;
> }
> void test2 (unsigned int x)
> {
> b.j = b.j + x;
> }
FWIW the ARM EABI specifies that these two are equivalent. Ie. they should
both produce two reads and a write.
Paul