From 10e68fe44f9f1fa25f4fd3afc5d75c4d7503d364 Mon Sep 17 00:00:00 2001 From: Carl Love Date: Mon, 25 Jun 2018 16:04:14 +0000 Subject: [PATCH] p9-extract-1.c: Make second argument of vec_extract a signed int. gcc/testsuite/ChangeLog: 2018-06-25 Carl Love * gcc.target/powerpc/p9-extract-1.c: Make second argument of vec_extract a signed int. Add vec_extract tests for bool char and bool int. * gcc.target/powerpc/p9-extract-4.c: New test file for long long vec_extract tests. From-SVN: r262023 --- gcc/testsuite/ChangeLog | 10 ++++ .../gcc.target/powerpc/p9-extract-1.c | 52 ++++++++++++++----- .../gcc.target/powerpc/p9-extract-4.c | 30 +++++++++++ 3 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-extract-4.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f9912f06452..9d3d16e0b03 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +gcc/testsuite/ChangeLog: + +2018-06-25 Carl Love + + * gcc.target/powerpc/p9-extract-1.c: Make second argument of + vec_extract a signed int. Add vec_extract tests for bool char + and bool int. + * gcc.target/powerpc/p9-extract-4.c: New test file for long long + vec_extract tests. + 2018-06-25 Tom de Vries * lib/gcc-gdb-test.exp (report_gdb): Handle gdb -v failure. diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c index ecbe0ed660d..ab9e766385d 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c @@ -13,84 +13,112 @@ int extract_int_0 (vector int a) { - int b = vec_extract (a, 0); + int c = 0; + int b = vec_extract (a, c); return b; } int extract_int_3 (vector int a) { - int b = vec_extract (a, 3); + int c = 3; + int b = vec_extract (a, c); return b; } unsigned int extract_uint_0 (vector unsigned int a) { - unsigned int b = vec_extract (a, 0); + int c = 0; + unsigned int b = vec_extract (a, c); return b; } unsigned int extract_uint_3 (vector unsigned int a) { - unsigned int b = vec_extract (a, 3); + int c = 3; + unsigned int b = vec_extract (a, c); return b; } short extract_short_0 (vector short a) { - short b = vec_extract (a, 0); + int c = 0; + short b = vec_extract (a, c); return b; } short extract_short_7 (vector short a) { - short b = vec_extract (a, 7); + int c = 7; + short b = vec_extract (a, c); return b; } unsigned short extract_ushort_0 (vector unsigned short a) { - unsigned short b = vec_extract (a, 0); + int c = 0; + unsigned short b = vec_extract (a, c); return b; } unsigned short extract_ushort_7 (vector unsigned short a) { - unsigned short b = vec_extract (a, 7); + int c = 7; + unsigned short b = vec_extract (a, c); return b; } signed char extract_schar_0 (vector signed char a) { - signed char b = vec_extract (a, 0); + int c = 0; + signed char b = vec_extract (a, c); return b; } signed char extract_schar_15 (vector signed char a) { - signed char b = vec_extract (a, 15); + int c = 15; + signed char b = vec_extract (a, c); return b; } unsigned char extract_uchar_0 (vector unsigned char a) { - unsigned char b = vec_extract (a, 0); + int c = 0; + unsigned char b = vec_extract (a, c); return b; } unsigned char extract_uchar_15 (vector unsigned char a) { - signed char b = vec_extract (a, 15); + int c = 15; + signed char b = vec_extract (a, c); + return b; +} + +unsigned char +extract_bool_char_0 (vector bool char a) +{ + int c = 0; + unsigned char b = vec_extract (a, c); + return b; +} + +unsigned int +extract_bool_int_0 (vector bool int a) +{ + int c = 0; + unsigned int b = vec_extract (a, c); return b; } diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-4.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-4.c new file mode 100644 index 00000000000..1f38982fbe7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-extract-4.c @@ -0,0 +1,30 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9 -O2" } */ + +/* This file tests the extraction of 64-bit values. On Power 9, the direct + move is prefered for the 64-bit extract as it is either lower latency or + the same latency as the extract instruction depending on the Endianess of + the system. Furthermore, there can be up to four move instructions in + flight at a time versus only two extract intructions at a time. */ + +#include + +unsigned long long +extract_bool_long_long_0 (vector bool long long a) +{ + int c = 0; + unsigned long long b = vec_extract (a, c); + return b; +} + +unsigned long long int +extract_long_long_0 (vector unsigned long long int a) +{ + int c = 0; + unsigned long long int b = vec_extract (a, c); + return b; +} + +/* { dg-final { scan-assembler-times "m\[ft\]vsr" 2 } } */ -- 2.30.2