From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11434 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] s390x: Add single instruction math functions Date: Sat, 10 Jun 2017 17:37:37 -0400 Message-ID: <20170610213737.GU1627@brightrain.aerifal.cx> References: <20170610153648.GT9350@port70.net> <20170610182950.GV9350@port70.net> <20170610194855.GS1627@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1497130671 31299 195.159.176.226 (10 Jun 2017 21:37:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Jun 2017 21:37:51 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11447-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jun 10 23:37:47 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dJo4p-0007xN-OM for gllmg-musl@m.gmane.org; Sat, 10 Jun 2017 23:37:47 +0200 Original-Received: (qmail 19887 invoked by uid 550); 10 Jun 2017 21:37:51 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 19868 invoked from network); 10 Jun 2017 21:37:50 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11434 Archived-At: On Sat, Jun 10, 2017 at 04:22:24PM -0400, David Edelsohn wrote: > On Sat, Jun 10, 2017 at 3:48 PM, Rich Felker wrote: > > On Sat, Jun 10, 2017 at 02:53:14PM -0400, David Edelsohn wrote: > >> On Sat, Jun 10, 2017 at 2:29 PM, Szabolcs Nagy wrote: > >> > * David Edelsohn [2017-06-10 13:25:00 -0400]: > >> >> On Sat, Jun 10, 2017 at 11:36 AM, Szabolcs Nagy wrote: > >> >> > * David Edelsohn [2017-06-09 10:51:25 -0400]: > >> >> >> The following patch is a start at single instruction math functions > >> >> >> for s390x architecture to increase performance. > >> >> > > >> >> > looks good, i wonder why gcc does not have builtins support for > >> >> > ceil, floor, nearbyint, round and trunc > >> >> > > >> >> > (on aarch64 the builtins expand to single instruction with > >> >> > -fno-math-errno, but on s390x they remain libc calls > >> >> > >> >> Both the functions and builtins are converted to single instructions > >> >> for me. What architecture level is your GCC assuming? > >> >> > >> > > >> > i think it's the default s390x config > >> > > >> > $ s390x-linux-musl-gcc -v > >> > Using built-in specs. > >> > COLLECT_GCC=s390x-linux-musl-gcc > >> > COLLECT_LTO_WRAPPER=/home/nsz/w/mcm/output/bin/../libexec/gcc/s390x-linux-musl/6.3.0/lto-wrapper > >> > Target: s390x-linux-musl > >> > Configured with: ../src_toolchain/configure --enable-languages=c,c++ CFLAGS='-g0 -Os' CXXFLAGS='-g0 -Os' LDFLAGS=-s --disable-nls --with-debug-prefix-map=/home/nsz/w/mcm/build-s390x-linux-musl= --enable-languages=c,c++ --disable-libquadmath --disable-libquadmath-support --disable-decimal-float --disable-multilib --disable-libcilkrts --disable-libvtv --disable-libgomp --disable-libitm --disable-werror --target=s390x-linux-musl --prefix= --libdir=/lib --disable-multilib --with-sysroot=/s390x-linux-musl --enable-tls --disable-libmudflap --disable-libsanitizer --disable-gnu-indirect-function --disable-libmpx --enable-libstdcxx-time --with-build-sysroot=/home/nsz/w/mcm/build-s390x-linux-musl/obj_sysroot > >> > Thread model: posix > >> > gcc version 6.3.0 (GCC) > >> > $ cat a.c > >> > double f(double x) > >> > { > >> > return __builtin_ceil(x); > >> > } > >> > $ s390x-linux-musl-gcc -O3 -fno-math-errno -S a.c -o - > >> > .machinemode zarch > >> > .machine "z900" > >> > >> Note the default architecture is z900 from 2005-2006. The FP > >> instructions were added with the z196 processors in 2010. > > > > In that case the patch should probably have the code inside something > > like: > > > > #ifdef __Z196__ // or whatever the predef macro for the ISA level is > > // your code here > > #else > > #include "../foo.c" > > #else > > > > See src/math/arm/sqrt.c for a similar example. > > > >> s390x-linux-musl probably should default to a much newer processor > >> level, such as at least z196 or zEC12 > > > > musl's policy is to just follow whatever ISA level the compiler is > > configured for; you can set this at musl build time with CFLAGS or use > > a default built into the toolchain at toolchain build time > > (--with-arch, I think). > > Musl already defaults to the later ISA in the rest of the s390x port. If that's the case it's not a regression and probably okay; someone can add support for earlier ISA levels as a separate patch if anyone cares about support for them. Can you point out in a reply where we already assume later ISA level, so that someone reading this thread later has it documented? Rich