This is the mail archive of the mailing list for the glibc 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: glibc 2.21 - Machine maintainers, please test your machines.

On Mon, 2015-01-26 at 05:35 -0800, H.J. Lu wrote:
> On Mon, Jan 26, 2015 at 5:32 AM, Torvald Riegel <> wrote:
> > On Mon, 2015-01-26 at 05:25 -0800, H.J. Lu wrote:
> >> On Mon, Jan 26, 2015 at 4:50 AM, Torvald Riegel <> wrote:
> >> > way?  If so, then using __alignof__(sem_t) in Chris' patch would be good
> >> > because then to_new_sem would resolve to a noop in x32 with your
> >> > alignment change applied.
> >>
> >> I don't want a noop.  I want compiler not to generate a noop at all.
> >
> > Yes, that's what I mean.  Compiler should figure out that no conversion
> > is necessary and not emit any code for this conversion.
> >
> If it is true, we should drop "&& !defined (_LP64)" in:
> +#if __HAVE_64B_ATOMICS && !defined (_LP64)
> +# define to_new_sem(s) ((struct new_sem *)(((uintptr_t)(s) + 4) & -8))
> +#else
> +# define to_new_sem(s) ((struct new_sem *)(s))
> +#endif

Maybe I wasn't clear.  I suggest to keep this, but use
__alignof__(sem_t) there in such a way that if sem_t is 8-byte aligned,
the compiler will figure our at compile time that to_new_sem(s) is
essentially just a cast.

This way, we can keep this code for all archs including tilegx, yet do
not have any overhead for the conversion on archs that have sufficient
alignment of sem_t (eg, x32 with your patch).

Sounds good?

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