diff options
Diffstat (limited to 'tools/testing/selftests/powerpc/benchmarks/context_switch.c')
-rw-r--r-- | tools/testing/selftests/powerpc/benchmarks/context_switch.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c index 7b785941adec..a36883ad48a4 100644 --- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c +++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c | |||
@@ -25,7 +25,9 @@ | |||
25 | #include <sys/types.h> | 25 | #include <sys/types.h> |
26 | #include <sys/shm.h> | 26 | #include <sys/shm.h> |
27 | #include <linux/futex.h> | 27 | #include <linux/futex.h> |
28 | 28 | #ifdef __powerpc__ | |
29 | #include <altivec.h> | ||
30 | #endif | ||
29 | #include "../utils.h" | 31 | #include "../utils.h" |
30 | 32 | ||
31 | static unsigned int timeout = 30; | 33 | static unsigned int timeout = 30; |
@@ -37,12 +39,15 @@ static int touch_fp = 1; | |||
37 | double fp; | 39 | double fp; |
38 | 40 | ||
39 | static int touch_vector = 1; | 41 | static int touch_vector = 1; |
40 | typedef int v4si __attribute__ ((vector_size (16))); | 42 | vector int a, b, c; |
41 | v4si a, b, c; | ||
42 | 43 | ||
43 | #ifdef __powerpc__ | 44 | #ifdef __powerpc__ |
44 | static int touch_altivec = 1; | 45 | static int touch_altivec = 1; |
45 | 46 | ||
47 | /* | ||
48 | * Note: LTO (Link Time Optimisation) doesn't play well with this function | ||
49 | * attribute. Be very careful enabling LTO for this test. | ||
50 | */ | ||
46 | static void __attribute__((__target__("no-vsx"))) altivec_touch_fn(void) | 51 | static void __attribute__((__target__("no-vsx"))) altivec_touch_fn(void) |
47 | { | 52 | { |
48 | c = a + b; | 53 | c = a + b; |
@@ -369,11 +374,11 @@ static void usage(void) | |||
369 | fprintf(stderr, "\t\t--process\tUse processes (default threads)\n"); | 374 | fprintf(stderr, "\t\t--process\tUse processes (default threads)\n"); |
370 | fprintf(stderr, "\t\t--timeout=X\tDuration in seconds to run (default 30)\n"); | 375 | fprintf(stderr, "\t\t--timeout=X\tDuration in seconds to run (default 30)\n"); |
371 | fprintf(stderr, "\t\t--vdso\t\ttouch VDSO\n"); | 376 | fprintf(stderr, "\t\t--vdso\t\ttouch VDSO\n"); |
372 | fprintf(stderr, "\t\t--fp\t\ttouch FP\n"); | 377 | fprintf(stderr, "\t\t--no-fp\t\tDon't touch FP\n"); |
373 | #ifdef __powerpc__ | 378 | #ifdef __powerpc__ |
374 | fprintf(stderr, "\t\t--altivec\ttouch altivec\n"); | 379 | fprintf(stderr, "\t\t--no-altivec\tDon't touch altivec\n"); |
375 | #endif | 380 | #endif |
376 | fprintf(stderr, "\t\t--vector\ttouch vector\n"); | 381 | fprintf(stderr, "\t\t--no-vector\tDon't touch vector\n"); |
377 | } | 382 | } |
378 | 383 | ||
379 | int main(int argc, char *argv[]) | 384 | int main(int argc, char *argv[]) |