[PATCH] tilegx: work around vector insn bug in gcc
Chris Metcalf
cmetcalf@mellanox.com
Tue Dec 5 16:25:00 GMT 2017
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
More information about the Libc-alpha
mailing list