Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 12 Jun 2017 09:54:54 -0400
From: David Edelsohn <dje.gcc@...il.com>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] s390x: Add single instruction math functions

On Mon, Jun 12, 2017 at 9:28 AM, David Edelsohn <dje.gcc@...il.com> wrote:
> On Mon, Jun 12, 2017 at 5:03 AM, Szabolcs Nagy <nsz@...t70.net> wrote:
>> * David Edelsohn <dje.gcc@...il.com> [2017-06-11 22:46:09 -0400]:
>>
>>> On Sun, Jun 11, 2017 at 6:19 AM, Szabolcs Nagy <nsz@...t70.net> wrote:
>>> > * Rich Felker <dalias@...c.org> [2017-06-10 22:20:44 -0400]:
>>> >> On Sat, Jun 10, 2017 at 05:48:05PM -0400, David Edelsohn wrote:
>>> >> > When I worked with Bobby Bingham to create the s390x port of Musl, I
>>> >> > said that he could assume newer processors.  Also, I don't believe
>>> >> > that LLVM supports the earlier processors.  I believe that he assumed
>>> >> > some more recent instructions in other parts of the code.
>>> >>
>>> >> That seems doubtful; the amount of asm in musl is minimal and unlikely
>>> >> to benefit from later ISA levels; all the instructions I see look like
>>> >> very basic stuff that would always have been available.
>>> >>
>>> >> Now, what likely is accurate is your claim that nobody is using musl
>>> >> on lower ISA levels, so maybe it doesn't matter.
>>> >
>>> > well i am using s390x musl with lower isa level for compile tests
>>> >
>>> > and it seems gas rejects unrecognized opcodes so the new inline
>>> > asm does not compile for me.
>>> >
>>> > i think either musl configure should make sure the cc targets
>>> > the right isa level or the code should handle it with ifdefs
>>>
>>> I have asked the IBM toolchain team how to distinguish the
>>> architecture level at compile time, or at least distinguish support
>>> for the FP rounding instruction.
>>>
>>> Are you actually running s390x musl on a system earlier than z196
>>> architecture level?  The public IBM LinuxONE Cloud is running on a z13
>>> system, many generations newer than even z196.
>>>
>>
>> no, i only have a cross compiler, but since the toolchain build script
>> uses default settings i get z900 arch, if that's not good then gcc
>> config default should be fixed for musl.
>>
>>> 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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.