Add some tests for AVX2 vectorizer.

2011-10-18  Kirill Yukhin  <kirill.yukhin@intel.com>

	* gcc.target/i386/avx2-vpop-check.h: New header.
	* gcc.target/i386/avx2-vpaddd-3.c: New test.
	* gcc.target/i386/avx2-vpaddw-3.c: Ditto.
	* gcc.target/i386/avx2-vpaddb-3.c: Ditto.
	* gcc.target/i386/avx2-vpaddq-3.c: Ditto.
	* gcc.target/i386/avx2-vpand-3.c: Ditto.
	* gcc.target/i386/avx2-vpmulld-3.c: Ditto.
	* gcc.target/i386/avx2-vpmullw-3.c: Ditto.
	* gcc.target/i386/avx2-vpsrad-3.c: Ditto.
	* gcc.target/i386/avx2-vpsraw-3.c: Ditto.
	* gcc.target/i386/avx2-vpsrld-3.c: Ditto.
	* gcc.target/i386/avx2-vpsrlw-3.c: Ditto.
	* gcc.target/i386/avx2-vpsubb-3.c: Ditto.
	* gcc.target/i386/avx2-vpsubd-3.c: Ditto.
	* gcc.target/i386/avx2-vpsubq-3.c: Ditto.
	* gcc.target/i386/avx2-vpsubw-3.c: Ditto.

From-SVN: r180155
This commit is contained in:
Kirill Yukhin 2011-10-18 15:41:27 +00:00 committed by H.J. Lu
parent 5dac1dae25
commit d8381c04c3
17 changed files with 252 additions and 0 deletions

View File

@ -1,3 +1,22 @@
2011-10-18 Kirill Yukhin <kirill.yukhin@intel.com>
* gcc.target/i386/avx2-vpop-check.h: New header.
* gcc.target/i386/avx2-vpaddd-3.c: New test.
* gcc.target/i386/avx2-vpaddw-3.c: Ditto.
* gcc.target/i386/avx2-vpaddb-3.c: Ditto.
* gcc.target/i386/avx2-vpaddq-3.c: Ditto.
* gcc.target/i386/avx2-vpand-3.c: Ditto.
* gcc.target/i386/avx2-vpmulld-3.c: Ditto.
* gcc.target/i386/avx2-vpmullw-3.c: Ditto.
* gcc.target/i386/avx2-vpsrad-3.c: Ditto.
* gcc.target/i386/avx2-vpsraw-3.c: Ditto.
* gcc.target/i386/avx2-vpsrld-3.c: Ditto.
* gcc.target/i386/avx2-vpsrlw-3.c: Ditto.
* gcc.target/i386/avx2-vpsubb-3.c: Ditto.
* gcc.target/i386/avx2-vpsubd-3.c: Ditto.
* gcc.target/i386/avx2-vpsubq-3.c: Ditto.
* gcc.target/i386/avx2-vpsubw-3.c: Ditto.
2011-10-18 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/50420

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE char
#define BIN_OP(a, b) ((a) + (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpaddb\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE int
#define BIN_OP(a, b) ((a) + (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpaddd\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE long long int
#define BIN_OP(a, b) ((a) + (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpaddq\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE short
#define BIN_OP(a, b) ((a) + (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpaddw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE unsigned
#define BIN_OP(a, b) ((a) & (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpand\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE int
#define BIN_OP(a, b) ((a) * (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpmulld\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE short
#define BIN_OP(a, b) ((a) * (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpmullw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,53 @@
#include "avx2-check.h"
#define SIZE 256
TYPE a[SIZE];
TYPE b[SIZE];
TYPE c[SIZE];
volatile TYPE c_ref[SIZE];
__attribute__ ((__noinline__))
void
gen_pop ()
{
int i;
for (i = 0; i < SIZE; ++i)
#ifdef BIN_OP
c[i] = BIN_OP (a[i], b[i]);
#else /* Must be UN_OP */
c[i] = UN_OP (a[i]);
#endif /* BIN_OP */
}
void
check_pop ()
{
int i;
for (i = 0; i < SIZE; ++i)
#ifdef BIN_OP
c_ref[i] = BIN_OP (a[i], b[i]);
#else /* Must be UN_OP */
c_ref[i] = UN_OP (a[i]);
#endif /* BIN_OP */
}
void static
avx2_test (void)
{
int i, j;
for (i = 0; i < 4; ++i )
{
for ( j = 0; j < SIZE; ++j )
{
a[i] = i * i + i;
b[i] = i * i * i;
}
gen_pop ();
check_pop ();
if (memcmp (c, c_ref, SIZE * sizeof (TYPE)))
abort();
}
}

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE unsigned
#define UN_OP(a) ((a) >> (5))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpsrld\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE short
#define UN_OP(a) ((a) >> (5))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpsraw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE unsigned
#define UN_OP(a) ((a) >> (5))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpsrld\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE unsigned short
#define UN_OP(a) ((a) >> (5))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpsrlw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE char
#define BIN_OP(a, b) ((a) - (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpsubb\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE int
#define BIN_OP(a, b) ((a) - (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpsubd\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE long long int
#define BIN_OP(a, b) ((a) - (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpsubq\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */

View File

@ -0,0 +1,12 @@
/* { dg-do run } */
/* { dg-options "-mavx2 -O2 -ftree-vectorize -save-temps" } */
/* { dg-require-effective-target avx2 } */
#define TYPE short
#define BIN_OP(a, b) ((a) - (b))
#include "avx2-vpop-check.h"
/* { dg-final { scan-assembler-times "vpsubw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
/* { dg-final { cleanup-saved-temps } } */