From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6005 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH 7/8] add the thrd_xxxxxx functions Date: Sun, 31 Aug 2014 13:51:58 +0400 (MSK) Message-ID: References: <22215ff2f880382340930f78cc746565a625a806.1409423162.git.Jens.Gustedt@inria.fr> <20140831004643.GP12888@brightrain.aerifal.cx> <1409471854.4476.272.camel@eris.loria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: ger.gmane.org 1409478836 26985 80.91.229.3 (31 Aug 2014 09:53:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 Aug 2014 09:53:56 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6012-gllmg-musl=m.gmane.org@lists.openwall.com Sun Aug 31 11:53:50 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XO1pV-00069B-51 for gllmg-musl@plane.gmane.org; Sun, 31 Aug 2014 11:53:49 +0200 Original-Received: (qmail 11842 invoked by uid 550); 31 Aug 2014 09:53:47 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11834 invoked from network); 31 Aug 2014 09:53:47 -0000 In-Reply-To: <1409471854.4476.272.camel@eris.loria.fr> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) Xref: news.gmane.org gmane.linux.lib.musl.general:6005 Archived-At: On Sun, 31 Aug 2014, Jens Gustedt wrote: > > > @@ -234,7 +253,10 @@ static int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restr > > > new->canary = self->canary; > > > > > > a_inc(&libc.threads_minus_1); > > > - ret = __clone(start, stack, flags, new, &new->tid, TP_ADJ(new), &new->tid); > > > + if (c11) > > > + ret = __clone(start_c11, stack, flags, new, &new->tid, TP_ADJ(new), &new->tid); > > > + else > > > + ret = __clone(start, stack, flags, new, &new->tid, TP_ADJ(new), &new->tid); > > > > Couldn't this be "c11 ? start_c11 : start" to avoid duplicating the > > rest of the call? > > I think that the ternary expression together with the other > parenthesized paramenter and the length of the line would make the > line barely readable. > > This are some of the pivots lines of the implementation, I'd rather > have them stick out. > > Also the assembler that is produced should be identical. It probably won't be with GCC. Try: echo 'int g(int); int f(int y){if (y) return g(0); else return g(1);}' | gcc -xc - -S -o- -O And try varying optimization levels. With gcc-4.8 on x86-64 I get two calls except with -Os, and even with -Os it's worse than with a ternary operator. Alexander