This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] tilegx: work around vector insn bug in gcc
- From: Chris Metcalf <cmetcalf at mellanox dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org
- Date: Tue, 5 Dec 2017 11:25:01 -0500
- Subject: Re: [PATCH] tilegx: work around vector insn bug in gcc
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf at mellanox dot com;
- References: <1512403009-12871-1-git-send-email-cmetcalf@mellanox.com> <87bdd200-6783-d8a3-30a8-bf0df69eb3b1@linaro.org>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 12/5/2017 11:12 AM, Adhemerval Zanella wrote:
On 04/12/2017 13:56, Chris Metcalf wrote:
Avoid an issue in gcc where some of the vector (aka SIMD) ops will
sometimes end up getting wrongly optimized out. We use these
instructions in many of the string implementations. If/when we
have an upstreamed fix for this problem in gcc we can conditionalize
the use of the extended assembly workaround in glibc.
Do you the conditions to trigger this issue (compiler option, gcc
version, etc.)?
Embarrassingly, as far as I know this bug has always been present at
optimization levels above -O0. Basically, if the output of a vector op
is passed through another math operation, there is some architecture
independent phase that ends up optimizing out the vector op.
I always did my native build testing on one of our TILE-Gx machines
that was already provisioned with compiler, build tools, etc, with
gcc 4.8 pre-installed. This compiler had the bug fix so my tests always
worked correctly.
I also did full upstream-only build testing, bootstrapping gcc/glibc,
etc., to make sure that that flow was correct as well - but I always did
it as a cross-build flow and didn't do runtime testing of the generated
binaries, or I would have seen this issue earlier.
It was only when glibc switched to requiring a compiler newer than
4.8 that I tried to do my native build testing using an upstream compiler
version. The folks who were responsible here at Mellanox for ongoing
maintenance of the tilegx compiler have been too busy to tackle the
issue since then, which is why I finally worked around it the way I did.
--
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com