From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11463 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] s390x: Add single instruction math functions Date: Mon, 12 Jun 2017 22:28:52 +0200 Message-ID: <20170612202851.GA27071@port70.net> References: <20170610212801.GW9350@port70.net> <20170611022044.GV1627@brightrain.aerifal.cx> <20170611101955.GX9350@port70.net> <20170612090331.GZ9350@port70.net> 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 1497299346 1407 195.159.176.226 (12 Jun 2017 20:29:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Jun 2017 20:29:06 +0000 (UTC) User-Agent: Mutt/1.6.0 (2016-04-01) To: musl@lists.openwall.com Original-X-From: musl-return-11476-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jun 12 22:29:02 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 1dKVxN-00005c-BE for gllmg-musl@m.gmane.org; Mon, 12 Jun 2017 22:29:01 +0200 Original-Received: (qmail 1619 invoked by uid 550); 12 Jun 2017 20:29:04 -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 1595 invoked from network); 12 Jun 2017 20:29:04 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:11463 Archived-At: * David Edelsohn [2017-06-12 09:54:54 -0400]: > On Mon, Jun 12, 2017 at 9:28 AM, David Edelsohn wrote: > > On Mon, Jun 12, 2017 at 5:03 AM, Szabolcs Nagy wrote: > >> * David Edelsohn [2017-06-11 22:46:09 -0400]: > >>> The following IBM table of supported and tested systems > >>> > >>> https://www-03.ibm.com/systems/z/os/linux/resources/testedplatforms.html > >>> > >>> shows that RHEL 7 and SLES 12 require at least z196, and Ubuntu 16.04 > >>> requires at least zEC12. > >>> > >>> I can't find any official hardware requirements description for Alpine > >>> Linux. I tend to doubt that user would run it on older hardware, > >>> especially hardware no longer supported by other, modern Linux > >>> distributions. > >>> > >>> Building musl libc on older hardware is a nice accomplishment, but > >>> investing effort and complexity to maintain support probably isn't > >>> useful to any musl libc user and probably isn't a productive use of > >>> developer resources. > >>> > >>> I will continue to inquire if there is a simple technique to accomplish this. > > > > Apparently GCC 7.1 added architecture macros. > > > > As Tuan referenced, Alpine Linux also requires z196 as the minimum > > architecture level. I believe that it would be better for s390-musl > > to default to z196 ISA than musl to require GCC 7.1. > > Would a patch such as the following be acceptable? > > Thanks, David > > diff --git a/configure b/configure > index c2db298..a9e0256 100755 > --- a/configure > +++ b/configure > @@ -494,6 +494,15 @@ fnmatch '-mtune=*|*\ -mtune=*' "$CC $CFLAGS" || tryldflag C > fi > > # > +# On s390x, default to z196 architecture and zEC12 tuning to support newer math > +# instructions. > +# > +if test "$ARCH" = "s390x" ; then > +fnmatch '-march=*|*\ -march=*' "$CC $CFLAGS" || tryldflag CFLAGS_AUTO > -march=z196 > +fnmatch '-mtune=*|*\ -mtune=*' "$CC $CFLAGS" || tryldflag CFLAGS_AUTO > -mtune=zEC12 > +fi > + > +# > # Even with -std=c99, gcc accepts some constructs which are constraint > # violations. We want to treat these as errors regardless of whether > # other purely stylistic warnings are enabled -- especially implicit well the toolchain may be configured for a different/newer cpu and then we may not want to override that.. what about diff --git a/configure b/configure index c2db298c..bcaf3a7d 100755 --- a/configure +++ b/configure @@ -656,6 +656,12 @@ trycppif __LITTLE_ENDIAN__ "$t" && SUBARCH=${SUBARCH}le trycppif _SOFT_FLOAT "$t" && fail "$0: error: soft-float not supported on powerpc64" fi +if test "$ARCH" = "s390x" ; then +echo 'float x; void f(){__asm__("fiebra %0,6,%1,4":"=f"(x):"f"(x));}' > "$tmpc" +$CC $CFLAGS_C99FSE $CPPFLAGS $CFLAGS -c -o /dev/null "$tmpc" >/dev/null 2>&1 || + fail "$0: error: s390x isa level is too low, use at least -march=z196" +fi + if test "$ARCH" = "sh" ; then tryflag CFLAGS_AUTO -Wa,--isa=any trycppif __BIG_ENDIAN__ "$t" && SUBARCH=${SUBARCH}eb