[PATCH, ARM] Unaligned accesses for packed structures [1/2]
Richard Earnshaw
rearnsha@arm.com
Thu Sep 8 17:35:00 GMT 2011
On 26/08/11 17:39, Julian Brown wrote:
> On Thu, 25 Aug 2011 18:31:21 +0100
> Julian Brown <julian@codesourcery.com> wrote:
>
>> On Thu, 25 Aug 2011 16:46:50 +0100
>> Julian Brown <julian@codesourcery.com> wrote:
>>
>>> So, OK to apply this version, assuming testing comes out OK? (And
>>> the followup patch [2/2], which remains unchanged?)
>>
>> FWIW, all tests pass, apart from
>> gcc.target/arm/volatile-bitfields-3.c, which regresses. The output
>> contains:
>>
>> ldrh r0, [r3, #2] @ unaligned
>>
>> I believe that, to conform to the ARM EABI, that GCC must use an
>> (aligned) ldr in this case. Is that correct? If so, it looks like the
>> middle-end bitfield code does not take the setting of
>> -fstrict-volatile-bitfields into account.
>
> This version fixes the last issue, by adding additional checks for
> volatile accesses/-fstrict-volatile-bitfields. Tests now show no
> regressions.
>
> OK to apply?
>
+ /* On big-endian machines, we count bits from the most significant.
+ If the bit field insn does not, we must invert. */
It sounds to me like this comment is somewhat out of date now that we
have BITS_BIG_ENDIAN; it would be better re-worded to reflect the code
as it stands now.
Other than that, OK.
R.
> Thanks,
>
> Julian
>
> ChangeLog
>
> gcc/
> * config/arm/arm.c (arm_override_options): Add unaligned_access
> support.
> (arm_file_start): Emit attribute for unaligned access as
> appropriate.
> * config/arm/arm.md (UNSPEC_UNALIGNED_LOAD)
> (UNSPEC_UNALIGNED_STORE): Add constants for unspecs.
> (insv, extzv): Add unaligned-access support.
> (extv): Change to expander. Likewise.
> (extzv_t1, extv_regsi): Add helpers.
> (unaligned_loadsi, unaligned_loadhis, unaligned_loadhiu)
> (unaligned_storesi, unaligned_storehi): New.
> (*extv_reg): New (previous extv implementation).
> * config/arm/arm.opt (munaligned_access): Add option.
> * config/arm/constraints.md (Uw): New constraint.
> * expmed.c (store_bit_field_1): Adjust bitfield numbering according
> to size of access, not size of unit, when BITS_BIG_ENDIAN !=
> BYTES_BIG_ENDIAN. Don't use bitfield accesses for
> volatile accesses when -fstrict-volatile-bitfields is in effect.
> (extract_bit_field_1): Likewise.
>
More information about the Gcc-patches
mailing list