From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11432 Path: news.gmane.org!.POSTED!not-for-mail From: David Edelsohn Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] s390x: Add single instruction math functions Date: Sat, 10 Jun 2017 16:22:24 -0400 Message-ID: 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="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1497126158 3989 195.159.176.226 (10 Jun 2017 20:22:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Jun 2017 20:22:38 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-11445-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jun 10 22:22:35 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 1dJmu2-0000qP-Kk for gllmg-musl@m.gmane.org; Sat, 10 Jun 2017 22:22:34 +0200 Original-Received: (qmail 18428 invoked by uid 550); 10 Jun 2017 20:22:37 -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 18407 invoked from network); 10 Jun 2017 20:22:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=P4SZYlWNn/5jUUt6ypynw4ZQwSUIqYgpApZE4DEkSjY=; b=oGBFyksSSzEiALMYepJhRR3uy26ZAnO+vI5X2cxXvUuIyN0wUn0SXp5k0R5FI+BoDI 40cSC+oEJiR0HvKclXnpowMpwR943XH0r0DzvhwEmpA3lojlO/r3vpIo9apkF5MqD+ly VjK+XvG1MSPo1c8GLMo7srGDG1Okr8VBCVCZUV0IVPs2PyO1x8OY81vrN2fo82mIl6iW hdmzNq/IFoEkdF4Gdg/a2FUawEl6B8ZAiZKkZ5W80Wtj2ErSi0uqN7j0rFyCq/zz2Hmv y003Oac3/prj7w176rIMObIHpoWRxTTbCLuqMlvxSminS0TaU0dNYfkyBP4MpKZtu1m7 nxtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=P4SZYlWNn/5jUUt6ypynw4ZQwSUIqYgpApZE4DEkSjY=; b=Jk/KtoQ8tL9+vo/dzO0FZns6qBHNliuKHPdR7P3T04KZTwkTvWe2hzMtcckgu8oP7v lIWVlIfHr+bACfhJAwqdERuKTsacYi/SEffeD4H2ZjzYdymk5+OXH18nc+jUbDBA8O2f ThUDYS/76mzxTJGlptP1ezdr5DtAG1tsTdAqx2r91Mxbs65MfQbebNErdXlAgJEVzYnn u09rs5TwI9AiJ6dfh0YbkFAfFbZLybLjaVW5ko/3KMVvCpIDizRn0fLBG/l91wdc3Z25 o2/MtGpTg6mpaQvCbmgIQB05qhfC/jn9zLP+aeC/fib6LQdwztpR/nqJqhZj+ufuzEQu VLGg== X-Gm-Message-State: AODbwcC/g2PIO9qBi0rwjc96PNK1p6b6YHkjC0XetYt/NmPA2RYVl6HR dhJSvLn8ayWwVu0lhPaeA+sxXf8RAg== X-Received: by 10.55.200.209 with SMTP id t78mr58040257qkl.178.1497126145107; Sat, 10 Jun 2017 13:22:25 -0700 (PDT) In-Reply-To: <20170610194855.GS1627@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:11432 Archived-At: 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 wrot= e: >> >> > * David Edelsohn [2017-06-09 10:51:25 -0400]: >> >> >> The following patch is a start at single instruction math function= s >> >> >> 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=3Ds390x-linux-musl-gcc >> > COLLECT_LTO_WRAPPER=3D/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=3Dc,c++= CFLAGS=3D'-g0 -Os' CXXFLAGS=3D'-g0 -Os' LDFLAGS=3D-s --disable-nls --with-= debug-prefix-map=3D/home/nsz/w/mcm/build-s390x-linux-musl=3D --enable-langu= ages=3Dc,c++ --disable-libquadmath --disable-libquadmath-support --disable-= decimal-float --disable-multilib --disable-libcilkrts --disable-libvtv --di= sable-libgomp --disable-libitm --disable-werror --target=3Ds390x-linux-musl= --prefix=3D --libdir=3D/lib --disable-multilib --with-sysroot=3D/s390x-lin= ux-musl --enable-tls --disable-libmudflap --disable-libsanitizer --disable-= gnu-indirect-function --disable-libmpx --enable-libstdcxx-time --with-build= -sysroot=3D/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. - David