This is the mail archive of the gcc-patches@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]

Re: [patch] Atomic alignment override.


On Thu, Nov 21, 2013 at 11:46 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
> I'd like to check in this code from the C11 branch so that it is present in
> 4.9.
>
> Its adds a target hook which can be used to override the default alignment
> of an atomic type when used with C11's _Atomic qualifier. There are a couple
> of ports which have stricter alignment requirements for an atomic operation
> than the natural alignment of the integral type.    Today they are just
> broken with no real facility to repair it.
>
> If this hook is not utilized by a port, the code is transparent and should
> therefore be harmless in the code base.  It will enable the ports that care
> to experiment with changing alignment and see if their current problems can
> be resolved for C11....  and then we can look to push that into C++11 atomic
> templates somehow.  It will also allow them to flush out any remaining
> problems that show up with the fundamental base code which enables it that
> went in as part of C11.
>
> Bootstraps on x86-64 and currently running regression tests. Assuming
> everything passes, OK for mainline?
>
> I wont actually check it in until HP reports back that it actually is useful
> to him, I just want to submit it before stage 1 ends :-).

Looks good to me, but

! #define SET_ATOMIC_TYPE_NODE(TYPE, MODE, DEFAULT)             \
!  (TYPE) = build_atomic_base (DEFAULT, targetm.atomic_align_for_mode (MODE));
!
!   SET_ATOMIC_TYPE_NODE (atomicQI_type_node, QImode, unsigned_intQI_type_node);
!   SET_ATOMIC_TYPE_NODE (atomicHI_type_node, HImode, unsigned_intHI_type_node);
!   SET_ATOMIC_TYPE_NODE (atomicSI_type_node, SImode, unsigned_intSI_type_node);
!   SET_ATOMIC_TYPE_NODE (atomicDI_type_node, DImode, unsigned_intDI_type_node);
!   SET_ATOMIC_TYPE_NODE (atomicTI_type_node, TImode, unsigned_intTI_type_node);

if you have to use a macro please #undef it after the last use.
Also if you need to use a macro then make it

   atomicQI_type_node = BUILD_ATOMIC_TYPE (QI);

or even

   SET_ATOMIC_TYPE_NODE (QI)

Thanks,
Richard.

> Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]