diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76d4500bae9..763db976613 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-02-04 H.J. Lu + + AVX Programming Reference (January, 2009) + * config/i386/sse.md (*vpclmulqdq): New. + 2009-02-04 Jakub Jelinek PR tree-optimization/38977 diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 393a3161da6..a54133378b5 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -11509,6 +11509,18 @@ (set_attr "prefix" "maybe_vex") (set_attr "mode" "TI")]) +(define_insn "*vpclmulqdq" + [(set (match_operand:V2DI 0 "register_operand" "=x") + (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "x") + (match_operand:V2DI 2 "nonimmediate_operand" "xm") + (match_operand:SI 3 "const_0_to_255_operand" "n")] + UNSPEC_PCLMUL))] + "TARGET_PCLMUL && TARGET_AVX" + "vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}" + [(set_attr "type" "sselog1") + (set_attr "prefix" "vex") + (set_attr "mode" "TI")]) + (define_insn "pclmulqdq" [(set (match_operand:V2DI 0 "register_operand" "=x") (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 37b57834550..e4f877dc47a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2009-02-04 H.J. Lu + + AVX Programming Reference (January, 2009) + * gcc.target/i386/avx-vpclmulqdq.c: New. + * gcc.target/i386/pclmul-avx-check.h: Likewise. + + * gcc.target/i386/i386.exp (check_effective_target_vpclmul): New. + + * gcc.target/i386/pclmulqdq.c (CHECK_H): New. + (TEST): Likewise. + Include CHECK_H instead of "pclmul-check.h". + (pclmul_test): Renamed to ... + (TEST): This. + 2009-02-04 Jakub Jelinek PR c++/39095 diff --git a/gcc/testsuite/gcc.target/i386/avx-vpclmulqdq.c b/gcc/testsuite/gcc.target/i386/avx-vpclmulqdq.c new file mode 100644 index 00000000000..9b015abcd48 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx-vpclmulqdq.c @@ -0,0 +1,8 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vpclmul } */ +/* { dg-options "-O2 -mpclmul -mavx" } */ + +#define CHECK_H "pclmul-avx-check.h" +#define TEST pclmul_avx_test + +#include "pclmulqdq.c" diff --git a/gcc/testsuite/gcc.target/i386/i386.exp b/gcc/testsuite/gcc.target/i386/i386.exp index 612bec48e79..fa470e11a66 100644 --- a/gcc/testsuite/gcc.target/i386/i386.exp +++ b/gcc/testsuite/gcc.target/i386/i386.exp @@ -92,6 +92,21 @@ proc check_effective_target_pclmul { } { } "-O2 -mpclmul" ] } +# Return 1 if vpclmul instructions can be compiled. +proc check_effective_target_vpclmul { } { + return [check_no_compiler_messages vpclmul object { + typedef long long __m128i __attribute__ ((__vector_size__ (16))); + typedef long long __v2di __attribute__ ((__vector_size__ (16))); + + __m128i pclmulqdq_test (__m128i __X, __m128i __Y) + { + return (__m128i) __builtin_ia32_pclmulqdq128 ((__v2di)__X, + (__v2di)__Y, + 1); + } + } "-O2 -mpclmul -mavx" ] +} + # Return 1 if sse4a instructions can be compiled. proc check_effective_target_sse4a { } { return [check_no_compiler_messages sse4a object { diff --git a/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h b/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h new file mode 100644 index 00000000000..de633336157 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pclmul-avx-check.h @@ -0,0 +1,31 @@ +#ifdef DEBUG +#include +#endif +#include +#include "cpuid.h" + +static void pclmul_avx_test (void); + +int +main () +{ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + /* Run PCLMUL + AVX test only if host has PCLMUL + AVX support. */ + if ((ecx & (bit_AVX | bit_PCLMUL)) == (bit_AVX | bit_PCLMUL)) + { + pclmul_avx_test (); +#ifdef DEBUG + printf ("PASSED\n"); +#endif + } +#ifdef DEBUG + else + printf ("SKIPPED\n"); +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pclmulqdq.c b/gcc/testsuite/gcc.target/i386/pclmulqdq.c index d4ab8493e31..1c1d2aabeb6 100644 --- a/gcc/testsuite/gcc.target/i386/pclmulqdq.c +++ b/gcc/testsuite/gcc.target/i386/pclmulqdq.c @@ -2,11 +2,19 @@ /* { dg-require-effective-target pclmul } */ /* { dg-options "-O2 -mpclmul" } */ +#ifndef CHECK_H +#define CHECK_H "pclmul-check.h" +#endif + +#ifndef TEST +#define TEST pclmul_test +#endif + +#include CHECK_H + #include #include -#include "pclmul-check.h" - extern void abort (void); #define NUM 1024 @@ -54,7 +62,7 @@ init_data (__m128i *ls1, __m128i *ls2, __m128i *le_00, __m128i *le_01, } static void -pclmul_test (void) +TEST (void) { int i;