From: H.J. Lu Date: Thu, 22 May 2008 05:28:19 +0000 (+0000) Subject: i386.c (ix86_expand_vector_init_one_var): Use ix86_expand_vector_set on V16QImode... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31ebe593ab02c381bc859aa615e1fad4c1677036;p=gcc.git i386.c (ix86_expand_vector_init_one_var): Use ix86_expand_vector_set on V16QImode for SSE4.1. gcc/ 2008-05-21 H.J. Lu * config/i386/i386.c (ix86_expand_vector_init_one_var): Use ix86_expand_vector_set on V16QImode for SSE4.1. gcc/testsuite/ 2008-05-21 H.J. Lu * gcc.target/i386/m128-check.h (ARRAY_SIZE): New. (CHECK_EXP): Use it. * gcc.target/i386/set-v16qi-3.h: New. * gcc.target/i386/sse2-set-v16qi-3.c: Likewise. * gcc.target/i386/sse4_1-set-v16qi-3.c: Likewise. From-SVN: r135750 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 62dfb36f041..9c02b23b4e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-05-21 H.J. Lu + + * config/i386/i386.c (ix86_expand_vector_init_one_var): Use + ix86_expand_vector_set on V16QImode for SSE4.1. + 2008-05-21 Tom Tromey * c.opt (Wimport): Mark as undocumented. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 651eb527798..6f9aaf93320 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -23818,6 +23818,8 @@ ix86_expand_vector_init_one_var (bool mmx_ok, enum machine_mode mode, break; case V16QImode: + if (TARGET_SSE4_1) + break; wmode = V8HImode; goto widen; case V8QImode: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a033ede0a8..e9a2c55e937 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2008-05-21 H.J. Lu + + * gcc.target/i386/m128-check.h (ARRAY_SIZE): New. + (CHECK_EXP): Use it. + + * gcc.target/i386/set-v16qi-3.h: New. + * gcc.target/i386/sse2-set-v16qi-3.c: Likewise. + * gcc.target/i386/sse4_1-set-v16qi-3.c: Likewise. + 2008-05-21 Sebastian Pop PR tree-optimization/36287 diff --git a/gcc/testsuite/gcc.target/i386/m128-check.h b/gcc/testsuite/gcc.target/i386/m128-check.h index 3231c079009..a20f8215082 100644 --- a/gcc/testsuite/gcc.target/i386/m128-check.h +++ b/gcc/testsuite/gcc.target/i386/m128-check.h @@ -37,6 +37,10 @@ typedef union double a[2]; } union128d; +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(A) (sizeof (A) / sizeof ((A)[0])) +#endif + #ifdef DEBUG #define PRINTF printf #else @@ -51,7 +55,7 @@ check_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \ int i; \ int err = 0; \ \ - for (i = 0; i < sizeof (u.a) / sizeof (u.a[0]); i++) \ + for (i = 0; i < ARRAY_SIZE (u.a); i++) \ if (u.a[i] != v[i]) \ { \ err++; \ diff --git a/gcc/testsuite/gcc.target/i386/set-v16qi-3.h b/gcc/testsuite/gcc.target/i386/set-v16qi-3.h new file mode 100644 index 00000000000..faf3cd34425 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/set-v16qi-3.h @@ -0,0 +1,63 @@ +#include CHECK_H + +static __m128i +__attribute__((noinline)) +foo (char x, int i) +{ + switch (i) + { + case 15: + return _mm_set_epi8 (x, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + case 14: + return _mm_set_epi8 (1, x, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + case 13: + return _mm_set_epi8 (1, 1, x, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + case 12: + return _mm_set_epi8 (1, 1, 1, x, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + case 11: + return _mm_set_epi8 (1, 1, 1, 1, x, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + case 10: + return _mm_set_epi8 (1, 1, 1, 1, 1, x, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + case 9: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, x, 1, 1, 1, 1, 1, 1, 1, 1, 1); + case 8: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, x, 1, 1, 1, 1, 1, 1, 1, 1); + case 7: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, 1, x, 1, 1, 1, 1, 1, 1, 1); + case 6: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, 1, 1, x, 1, 1, 1, 1, 1, 1); + case 5: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, x, 1, 1, 1, 1, 1); + case 4: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, x, 1, 1, 1, 1); + case 3: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, x, 1, 1, 1); + case 2: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, x, 1, 1); + case 1: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, x, 1); + case 0: + return _mm_set_epi8 (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, x); + default: + abort (); + } +} + +static void +TEST (void) +{ + char e = 0x13; + char v[16]; + union128i_b u; + int i, j; + + for (i = 0; i < ARRAY_SIZE (v); i++) + { + for (j = 0; j < ARRAY_SIZE (v); j++) + v[j] = 1; + v[i] = e; + u.x = foo (e, i); + if (check_union128i_b (u, v)) + abort (); + } +} diff --git a/gcc/testsuite/gcc.target/i386/sse2-set-v16qi-3.c b/gcc/testsuite/gcc.target/i386/sse2-set-v16qi-3.c new file mode 100644 index 00000000000..2c0227dd775 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse2-set-v16qi-3.c @@ -0,0 +1,7 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -msse2" } */ + +#define CHECK_H "sse2-check.h" +#define TEST sse2_test + +#include "set-v16qi-3.h" diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-set-v16qi-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-set-v16qi-3.c new file mode 100644 index 00000000000..99f563ab198 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_1-set-v16qi-3.c @@ -0,0 +1,8 @@ +/* { dg-do run } */ +/* { dg-require-effective-target sse4 } */ +/* { dg-options "-O2 -msse4.1" } */ + +#define CHECK_H "sse4_1-check.h" +#define TEST sse4_1_test + +#include "set-v16qi-3.h"