Index: testsuite/gcc.target/i386/sse4_1-set-v16qi-3.c =================================================================== --- testsuite/gcc.target/i386/sse4_1-set-v16qi-3.c (revision 0) +++ testsuite/gcc.target/i386/sse4_1-set-v16qi-3.c (revision 0) @@ -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" Index: testsuite/gcc.target/i386/sse2-set-v16qi-3.c =================================================================== --- testsuite/gcc.target/i386/sse2-set-v16qi-3.c (revision 0) +++ testsuite/gcc.target/i386/sse2-set-v16qi-3.c (revision 0) @@ -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" Index: testsuite/gcc.target/i386/m128-check.h =================================================================== --- testsuite/gcc.target/i386/m128-check.h (revision 135731) +++ testsuite/gcc.target/i386/m128-check.h (working copy) @@ -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 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++; \ Index: testsuite/gcc.target/i386/set-v16qi-3.h =================================================================== --- testsuite/gcc.target/i386/set-v16qi-3.h (revision 0) +++ testsuite/gcc.target/i386/set-v16qi-3.h (revision 0) @@ -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 (); + } +} Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 135732) +++ config/i386/i386.c (working copy) @@ -23818,6 +23818,8 @@ ix86_expand_vector_init_one_var (bool mm break; case V16QImode: + if (TARGET_SSE4_1) + break; wmode = V8HImode; goto widen; case V8QImode: