]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/powerpc: Fix generation of vector instructions/types in context_switch
authorCyril Bur <cyrilbur@gmail.com>
Thu, 3 Mar 2016 23:06:40 +0000 (10:06 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 5 Jul 2016 13:49:50 +0000 (23:49 +1000)
commita54e6f7eea572131a1f4089b09c45d34465f9335
tree721787068ed0ac900bb739fdd4fbe1f4372f6a4f
parent49c1c1d812e62234c70ea19da77df736cc16fc25
selftests/powerpc: Fix generation of vector instructions/types in context_switch

Currently it doesn't appear the resulting binary actually uses any
Altivec or VSX instructions the solution is to explicitly tell GCC to
use vector instructions and use vector types in the code.

Part of this this issue can be GCC version specific:

GCC 4.9.x is happy to use Altivec and VSX instructions if altivec.h is
includedi (and possibly if vector types are used), this also means that
4.9.x will use VSX instructions even if only -maltivec is passed. It is
also possible that Altivec instructions will be used even without
-maltivec or -mabi=altivec.

GCC 5.2.x complains about the lack of -maltivec parameter if altivec.h
is included and will not use VSX unless -mvsx is present on commandline.

GCC 5.3.0 has a regression that means __attribute__((__target__("no-vsx"))
fails to build. A fix is targeted for 5.4.

Furthermore LTO (Link Time Optimisation) doesn't play well with
__attribute__((__target__("no-vsx")), LTO can cause GCC to forget about
the attribute and compile with VSX instructions regardless. Be wary when
enabling -flfo for this test.

Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
tools/testing/selftests/powerpc/benchmarks/Makefile
tools/testing/selftests/powerpc/benchmarks/context_switch.c