diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/i386')
40 files changed, 543 insertions, 37 deletions
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vextractf32x4-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vextractf32x4-1.c index c01835ce097..26313f44062 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vextractf32x4-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vextractf32x4-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512vl -O2" } */ -/* { dg-final { scan-assembler-times "vextractf32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vextractf(?:128|32x4)\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vextractf32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vextractf32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vextracti32x4-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vextracti32x4-1.c index 7ee87dd82ec..0826a0b8e04 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vextracti32x4-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vextracti32x4-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512vl -O2" } */ -/* { dg-final { scan-assembler-times "vextracti32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vextracti\(?:128|32x4\)\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vextracti32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vextracti32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/clzero.c b/gcc/testsuite/gcc.target/i386/clzero.c new file mode 100644 index 00000000000..9a68a4928a8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/clzero.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mclzero" } */ + +/* Verify that they work in both 32bit and 64bit. */ + +#include <x86intrin.h> + +void +foo (void *k) +{ + _mm_clzero (k); +} + diff --git a/gcc/testsuite/gcc.target/i386/mpx/memmove-1.c b/gcc/testsuite/gcc.target/i386/mpx/memmove-1.c new file mode 100644 index 00000000000..0efd0303075 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/memmove-1.c @@ -0,0 +1,117 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include <stdint.h> +#include <string.h> +#include "mpx-check.h" + +#ifdef __i386__ +/* i386 directory size is 4MB. */ +#define MPX_NUM_L2_BITS 10 +#define MPX_NUM_IGN_BITS 2 +#else /* __i386__ */ +/* x86_64 directory size is 2GB. */ +#define MPX_NUM_L2_BITS 17 +#define MPX_NUM_IGN_BITS 3 +#endif /* !__i386__ */ + + +/* bt_num_of_elems is the number of elements in bounds table. */ +unsigned long bt_num_of_elems = (1UL << MPX_NUM_L2_BITS); +/* Function to test MPX wrapper of memmove function. + src_bigger_dst determines which address is bigger, can be 0 or 1. + src_bt_index and dst_bt index are bt_indexes + from the beginning of the page. + bd_index_end is the bd index of the last element of src if we define + bd index of the first element as 0. + src_bt index_end is bt index of the last element of src. + pointers inside determines if array being copied includes pointers + src_align and dst_align are alignments of src and dst. + Arrays may contain unaligned pointers. */ +int +test (int src_bigger_dst, int src_bt_index, int dst_bt_index, + int bd_index_end, int src_bt_index_end, int pointers_inside, + int src_align, int dst_align) +{ + const int n = + src_bt_index_end - src_bt_index + bd_index_end * bt_num_of_elems; + if (n < 0) + { + return 0; + } + const int num_of_pointers = (bd_index_end + 2) * bt_num_of_elems; + void **arr = 0; + posix_memalign ((void **) (&arr), + 1UL << (MPX_NUM_L2_BITS + MPX_NUM_IGN_BITS), + num_of_pointers * sizeof (void *)); + void **src = arr, **dst = arr; + if ((src_bigger_dst) && (src_bt_index < dst_bt_index)) + src_bt_index += bt_num_of_elems; + if (!(src_bigger_dst) && (src_bt_index > dst_bt_index)) + dst_bt_index += bt_num_of_elems; + src += src_bt_index; + dst += dst_bt_index; + char *realign = (char *) src; + realign += src_align; + src = (void **) realign; + realign = (char *) dst; + realign += src_align; + dst = (void **) realign; + if (pointers_inside) + { + for (int i = 0; i < n; i++) + src[i] = __bnd_set_ptr_bounds (arr + i, i * sizeof (void *) + 1); + } + memmove (dst, src, n * sizeof (void *)); + if (pointers_inside) + { + for (int i = 0; i < n; i++) + { + if (dst[i] != arr + i) + abort (); + if (__bnd_get_ptr_lbound (dst[i]) != arr + i) + abort (); + if (__bnd_get_ptr_ubound (dst[i]) != arr + 2 * i) + abort (); + } + } + free (arr); + return 0; +} + +/* Call testall to test common cases of memmove for MPX. */ +void +testall () +{ + int align[3]; + align[0] = 0; + align[1] = 1; + align[2] = 7; + for (int pointers_inside = 0; pointers_inside < 2; pointers_inside++) + for (int src_bigger_dst = 0; src_bigger_dst < 2; src_bigger_dst++) + for (int src_align = 0; src_align < 3; src_align ++) + for (int dst_align = 0; dst_align < 3; dst_align ++) + for (int pages = 0; pages < 4; pages++) + { + test (src_bigger_dst, 1, 2, pages, 1, pointers_inside, + align[src_align], align[dst_align]); + test (src_bigger_dst, 1, 2, pages, 2, pointers_inside, + align[src_align], align[dst_align]); + test (src_bigger_dst, 2, 1, pages, 12, pointers_inside, + align[src_align], align[dst_align]); + test (src_bigger_dst, 2, 1, pages, 1, pointers_inside, + align[src_align], align[dst_align]); + test (src_bigger_dst, 2, 3, pages, 12, pointers_inside, + align[src_align], align[dst_align]); + test (src_bigger_dst, 1, bt_num_of_elems - 2, pages, 2, + pointers_inside, align[src_align], align[dst_align]); + } +}; + +int +mpx_test (int argc, const char **argv) +{ + testall (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/memmove-2.c b/gcc/testsuite/gcc.target/i386/mpx/memmove-2.c new file mode 100644 index 00000000000..e1d78fa47c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/memmove-2.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#include <stdint.h> +#include <string.h> +#include "mpx-check.h" + +#ifdef __i386__ +/* i386 directory size is 4MB. */ +#define MPX_NUM_L2_BITS 10 +#define MPX_NUM_IGN_BITS 2 +#else /* __i386__ */ +/* x86_64 directory size is 2GB. */ +#define MPX_NUM_L2_BITS 17 +#define MPX_NUM_IGN_BITS 3 +#endif /* !__i386__ */ + + +/* bt_num_of_elems is the number of elements in bounds table. */ +unsigned long bt_num_of_elems = (1UL << MPX_NUM_L2_BITS); + +/* Function to test MPX wrapper of memmove function. + Check case with no BT allocated for data. */ + +int +mpx_test (int argc, const char **argv) +{ + void **arr = 0; + posix_memalign ((void **) (&arr), + 1UL << (MPX_NUM_L2_BITS + MPX_NUM_IGN_BITS), + 2 * bt_num_of_elems * sizeof (void *)); + void **src = arr, **dst = arr, **ptr = arr; + src += 10; + dst += 1; + ptr += bt_num_of_elems + 100; + ptr[0] = __bnd_set_ptr_bounds (arr + 1, sizeof (void *) + 1); + memmove (dst, src, 5 * sizeof (void *)); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr68337-1.c b/gcc/testsuite/gcc.target/i386/mpx/pr68337-1.c new file mode 100644 index 00000000000..3f8d79d4282 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr68337-1.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +#include "mpx-check.h" + +#define N 2 + +extern void abort (); + +static int +mpx_test (int argc, const char **argv) +{ + char ** src = (char **)malloc (sizeof (char *) * N); + char ** dst = (char **)malloc (sizeof (char *) * N); + int i; + + for (i = 0; i < N; i++) + src[i] = __bnd_set_ptr_bounds (argv[0] + i, i + 1); + + __builtin_memcpy(dst, src, sizeof (char *) * N); + + for (i = 0; i < N; i++) + { + char *p = dst[i]; + if (p != argv[0] + i + || __bnd_get_ptr_lbound (p) != p + || __bnd_get_ptr_ubound (p) != p + i) + abort (); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr68337-2.c b/gcc/testsuite/gcc.target/i386/mpx/pr68337-2.c new file mode 100644 index 00000000000..8845cca79be --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr68337-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ +/* { dg-final { scan-assembler-not "memcpy" } } */ + +void +test (void *dst, void *src) +{ + __builtin_memcpy (dst, src, sizeof (char *) / 2); +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr68416.c b/gcc/testsuite/gcc.target/i386/mpx/pr68416.c new file mode 100644 index 00000000000..10587edf251 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr68416.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mmpx -fcheck-pointer-bounds" } */ +/* { dg-final { scan-assembler-not "bndmov" } } */ + +int +foo(int **arr, int i) +{ + return (*arr)[i]; +} diff --git a/gcc/testsuite/gcc.target/i386/pr65044.c b/gcc/testsuite/gcc.target/i386/pr65044.c index 4f318d62f88..8d3bc9b98b8 100644 --- a/gcc/testsuite/gcc.target/i386/pr65044.c +++ b/gcc/testsuite/gcc.target/i386/pr65044.c @@ -1,7 +1,7 @@ -/* { dg-error "-fcheck-pointer-bounds is not supported with Address Sanitizer" } */ /* { dg-do compile } */ /* { dg-require-effective-target mpx } */ /* { dg-options "-fcheck-pointer-bounds -mmpx -fsanitize=address" } */ +/* { dg-error "-fcheck-pointer-bounds is not supported with Address Sanitizer" "" { target *-*-* } 0 } */ extern int x[]; diff --git a/gcc/testsuite/gcc.target/i386/pr68349.c b/gcc/testsuite/gcc.target/i386/pr68349.c new file mode 100644 index 00000000000..3c38c3a01f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68349.c @@ -0,0 +1,30 @@ +/* PR target/68483 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int a, b; +unsigned long my_strlen(); +typedef struct sHyphenNode { + char sepcnts[0]; + struct sHyphenNode *Daughters[]; +} * PHyphenNode; +int GetIndex(); +PHyphenNode c; +void DoHyphens_Field_1() { + char d[300], e[300]; + int z, f, l = my_strlen(); + for (; z;) + ; + for (; l; z++) { + f = z; + for (; f < l; f++) { + c = c->Daughters[GetIndex(d[f])]; + a = 0; + for (; a <= f - z; a++) + if (e[z + a]) + e[z] = c->sepcnts[a]; + } + } + if (e[z]) + b = 1; +} diff --git a/gcc/testsuite/gcc.target/i386/pr68432-1.c b/gcc/testsuite/gcc.target/i386/pr68432-1.c new file mode 100644 index 00000000000..8493652369e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68432-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-math-errno -fno-trapping-math -msse2 -mfpmath=sse" } */ + +float +f1 (float f) +{ + return __builtin_rintf (f); +} + +double +f2 (double f) +{ + return __builtin_rint (f); +} + +/* { dg-final { scan-assembler-times "\tucomiss\t" 1 } } */ +/* { dg-final { scan-assembler-times "\tucomisd\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr68432-2.c b/gcc/testsuite/gcc.target/i386/pr68432-2.c new file mode 100644 index 00000000000..8a0c2955895 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68432-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -fno-math-errno -fno-trapping-math -msse2 -mfpmath=sse" } */ + +float +f1 (float f) +{ + return __builtin_rintf (f); +} + +double +f2 (double f) +{ + return __builtin_rint (f); +} + +/* { dg-final { scan-assembler-not "\tucomiss\t" } } */ +/* { dg-final { scan-assembler-not "\tucomisd\t" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr68432-3.c b/gcc/testsuite/gcc.target/i386/pr68432-3.c new file mode 100644 index 00000000000..5f22972338e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68432-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-math-errno -fno-trapping-math -msse2 -mfpmath=sse" } */ + +float __attribute__ ((cold)) +f1 (float f) +{ + return __builtin_rintf (f); +} + +double __attribute__ ((cold)) +f2 (double f) +{ + return __builtin_rint (f); +} + +/* { dg-final { scan-assembler-not "\tucomiss\t" } } */ +/* { dg-final { scan-assembler-not "\tucomisd\t" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr68483-1.c b/gcc/testsuite/gcc.target/i386/pr68483-1.c new file mode 100644 index 00000000000..29787e94bd3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68483-1.c @@ -0,0 +1,22 @@ +/* PR target/68483 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -msse2 -mno-sse3" } */ + +void +test (int *input, int *out, unsigned x1, unsigned x2) +{ + unsigned i, j; + unsigned end = x1; + + for (i = j = 0; i < 1000; i++) + { + int sum = 0; + end += x2; + for (; j < end; j++) + sum += input[j]; + out[i] = sum; + } +} + +/* { dg-final { scan-assembler "psrldq\[^\n\r]*(8,|, 8)" { target ia32 } } } */ +/* { dg-final { scan-assembler "psrldq\[^\n\r]*(4,|, 4)" { target ia32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr68483-2.c b/gcc/testsuite/gcc.target/i386/pr68483-2.c new file mode 100644 index 00000000000..394dc1bac76 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68483-2.c @@ -0,0 +1,15 @@ +/* PR target/68483 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -mno-sse3" } */ + +typedef int V __attribute__((vector_size (16))); + +void +foo (V *a, V *b) +{ + V c = { 0, 0, 0, 0 }; + V d = { 1, 2, 3, 4 }; + *a = __builtin_shuffle (*b, c, d); +} + +/* { dg-final { scan-assembler "psrldq\[^\n\r]*(4,|, 4)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr68497.c b/gcc/testsuite/gcc.target/i386/pr68497.c new file mode 100644 index 00000000000..0135cda0d58 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68497.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-fno-checking" } */ + +long double +foo (long double x, long double y) +{ + return x + y; +} diff --git a/gcc/testsuite/gcc.target/i386/pr68633.c b/gcc/testsuite/gcc.target/i386/pr68633.c new file mode 100644 index 00000000000..d7f513d276a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68633.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-Ofast -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include <immintrin.h> + +#define AVX512F + +#include "avx512f-helper.h" + +void abort (); + +void +TEST () +{ + __mmask16 k1, k2, k3; + + __asm__( "kmovw %1, %0" : "=k" (k1) : "r" (1) ); + __asm__( "kmovw %1, %0" : "=k" (k2) : "r" (2) ); + + k3 = _mm512_kunpackb (k1, k2); + if (k3 != 0x201) + abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/pr68647.c b/gcc/testsuite/gcc.target/i386/pr68647.c new file mode 100644 index 00000000000..70549318e87 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68647.c @@ -0,0 +1,18 @@ +/* PR target/68647 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mpopcnt" } */ + +int +f1 (unsigned long long a) +{ + return __builtin_popcountll (a); +} + +int +f2 (unsigned long long a) +{ + return __builtin_parityll (a); +} + +/* { dg-final { scan-assembler-not "__popcountdi2" } } */ +/* { dg-final { scan-assembler-not "__paritydi2" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr68680.c b/gcc/testsuite/gcc.target/i386/pr68680.c new file mode 100644 index 00000000000..5524e156362 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68680.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/68680 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fstack-protector-strong" } */ + +int foo (char *); + +int +bar (unsigned long x) +{ + char a[x]; + return foo (a); +} + +/* Verify that this function is stack protected. */ +/* { dg-final { scan-assembler "stack_chk_fail" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr68691.c b/gcc/testsuite/gcc.target/i386/pr68691.c new file mode 100644 index 00000000000..f522291454c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68691.c @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -g" } */ + +char a, b, i, j; +int c, d, e, f, g, h, n; + +char +fn1 () +{ + char k, l, m; + int p; + e = g > f; + for (b = 0; b < 2; b++) + { + for (p = 0; p < 3; p++) + { + for (; h < 1; h++) + { + for (; m;) + goto lbl; + e = g; + } + l = a < 0 || a < d; + } + d++; + for (;;) + { + k = g; + n = -k; + j = n; + c = j; + e = 2; + if (l) + break; + return 2; + } + } + for (;;) + ; + lbl: + return i; +} diff --git a/gcc/testsuite/gcc.target/i386/pr68701-1.c b/gcc/testsuite/gcc.target/i386/pr68701-1.c new file mode 100644 index 00000000000..008eb6bddd2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68701-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ffixed-ebp -mno-accumulate-outgoing-args" } */ + +/* { dg-warning "fixed ebp register requires" "" { target *-*-* } 0 } */ + +void foo (void); + +int +main (int argc, char *argv[]) +{ + foo (); + return argc - 1; +} diff --git a/gcc/testsuite/gcc.target/i386/pr68701-2.c b/gcc/testsuite/gcc.target/i386/pr68701-2.c new file mode 100644 index 00000000000..bfe592ec8ec --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68701-2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ffixed-ebp -mno-accumulate-outgoing-args -mstackrealign -msse" } */ + +/* { dg-warning "fixed ebp register requires" "" { target *-*-* } 0 } */ + +typedef float V __attribute__((vector_size(16))); + +void bar (V a) +{ + volatile V b = a; +} diff --git a/gcc/testsuite/gcc.target/i386/rop1.c b/gcc/testsuite/gcc.target/i386/rop1.c new file mode 100644 index 00000000000..0b37267678a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/rop1.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-mcmodel=medium -mmitigate-rop" } */ +void +foo (void) +{ +} diff --git a/gcc/testsuite/gcc.target/i386/sse-12.c b/gcc/testsuite/gcc.target/i386/sse-12.c index 1db0d8bddd0..8b7ef6d960b 100644 --- a/gcc/testsuite/gcc.target/i386/sse-12.c +++ b/gcc/testsuite/gcc.target/i386/sse-12.c @@ -3,7 +3,7 @@ popcntintrin.h and mm_malloc.h are usable with -O -std=c89 -pedantic-errors. */ /* { dg-do compile } */ -/* { dg-options "-O -std=c89 -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi -mavx512ifma -mclwb -mpcommit -mmwaitx" } */ +/* { dg-options "-O -std=c89 -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi -mavx512ifma -mclwb -mpcommit -mmwaitx -mclzero" } */ #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/i386/sse-13.c b/gcc/testsuite/gcc.target/i386/sse-13.c index 13d9eb878ef..0592370ef26 100644 --- a/gcc/testsuite/gcc.target/i386/sse-13.c +++ b/gcc/testsuite/gcc.target/i386/sse-13.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512ifma -mclwb -mpcommit -mmwaitx" } */ +/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512ifma -mclwb -mpcommit -mmwaitx -mclzero" } */ #include <mm_malloc.h> diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c index 52f78025d64..1baf6fc0c22 100644 --- a/gcc/testsuite/gcc.target/i386/sse-14.c +++ b/gcc/testsuite/gcc.target/i386/sse-14.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mclwb -mpcommit -mmwaitx" } */ +/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mclwb -mpcommit -mmwaitx -mclzero" } */ /* { dg-add-options bind_pic_locally } */ #include <mm_malloc.h> diff --git a/gcc/testsuite/gcc.target/i386/sse-23.c b/gcc/testsuite/gcc.target/i386/sse-23.c index a3660f8b2cb..45613547c42 100644 --- a/gcc/testsuite/gcc.target/i386/sse-23.c +++ b/gcc/testsuite/gcc.target/i386/sse-23.c @@ -594,6 +594,6 @@ #define __builtin_ia32_extracti64x2_256_mask(A, E, C, D) __builtin_ia32_extracti64x2_256_mask(A, 1, C, D) #define __builtin_ia32_extractf64x2_256_mask(A, E, C, D) __builtin_ia32_extractf64x2_256_mask(A, 1, C, D) -#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,fma,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,xsavec,xsaves,clflushopt,avx512bw,avx512dq,avx512vl,avx512vbmi,avx512ifma,clwb,pcommit,mwaitx") +#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,fma,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,xsavec,xsaves,clflushopt,avx512bw,avx512dq,avx512vl,avx512vbmi,avx512ifma,clwb,pcommit,mwaitx,clzero") #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-round.h b/gcc/testsuite/gcc.target/i386/sse4_1-round.h index 0210ac130b6..dfb0b778cdc 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-round.h +++ b/gcc/testsuite/gcc.target/i386/sse4_1-round.h @@ -28,7 +28,7 @@ init_round (FP_T *src) static FP_T do_round (FP_T f, int type) { - short saved_cw, new_cw, clr_mask; + unsigned short saved_cw, new_cw, clr_mask; FP_T ret; if ((type & 4)) @@ -42,16 +42,15 @@ do_round (FP_T f, int type) clr_mask = ~0x0C3F; } - __asm__ ("fld" ASM_SUFFIX " %0" : : "m" (*&f)); + __asm__ ("fnstcw %0" : "=m" (saved_cw)); - __asm__ ("fstcw %0" : "=m" (*&saved_cw)); new_cw = saved_cw & clr_mask; new_cw |= type; - __asm__ ("fldcw %0" : : "m" (*&new_cw)); - __asm__ ("frndint\n" - "fstp" ASM_SUFFIX " %0\n" : "=m" (*&ret)); - __asm__ ("fldcw %0" : : "m" (*&saved_cw)); + __asm__ ("fldcw %2\n\t" + "frndint\n\t" + "fldcw %3" : "=t" (ret) + : "0" (f), "m" (new_cw), "m" (saved_cw)); return ret; } diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c index 71bc51be232..fab227869fc 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c @@ -7,7 +7,6 @@ #define VEC_T __m128 #define FP_T float -#define ASM_SUFFIX "s" #define ROUND_INTRIN(x, mode) _mm_ceil_ps(x) #define ROUND_MODE _MM_FROUND_CEIL diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c index 672e92067c8..405c55d45a4 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c @@ -7,7 +7,6 @@ #define VEC_T __m128 #define FP_T float -#define ASM_SUFFIX "s" #define ROUND_INTRIN _mm_round_ps #define ROUND_MODE _MM_FROUND_NINT diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c index 4bfc1cacc91..97485b95867 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c @@ -7,7 +7,6 @@ #define VEC_T __m128 #define FP_T float -#define ASM_SUFFIX "s" #define ROUND_INTRIN(x, mode) _mm_floor_ps(x) #define ROUND_MODE _MM_FROUND_FLOOR diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c index ae8881cf0f8..e6cec0b9478 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c @@ -7,7 +7,6 @@ #define VEC_T __m128d #define FP_T double -#define ASM_SUFFIX "l" #define ROUND_INTRIN(x, mode) _mm_ceil_sd(x, x) #define ROUND_MODE _MM_FROUND_CEIL diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c index 70679bb07a0..54ca21f8f2c 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c @@ -7,7 +7,6 @@ #define VEC_T __m128d #define FP_T double -#define ASM_SUFFIX "l" #define ROUND_INTRIN(x, mode) _mm_round_sd(x, x, mode) #define ROUND_MODE _MM_FROUND_NINT diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c index 81a3f760638..a59d6f86e5f 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c @@ -7,7 +7,6 @@ #define VEC_T __m128d #define FP_T double -#define ASM_SUFFIX "l" #define ROUND_INTRIN(x, mode) _mm_floor_sd(x, x) #define ROUND_MODE _MM_FROUND_FLOOR diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c index 124f825021d..ff8b09eeba6 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c @@ -36,7 +36,7 @@ init_round (double *src) static double do_round (double f, int type) { - short saved_cw, new_cw, clr_mask; + unsigned short saved_cw, new_cw, clr_mask; double ret; if ((type & 4)) @@ -50,16 +50,15 @@ do_round (double f, int type) clr_mask = ~0x0C3F; } - __asm__ ("fldl %0" : : "m" (*&f)); + __asm__ ("fnstcw %0" : "=m" (saved_cw)); - __asm__ ("fstcw %0" : "=m" (*&saved_cw)); new_cw = saved_cw & clr_mask; new_cw |= type; - __asm__ ("fldcw %0" : : "m" (*&new_cw)); - __asm__ ("frndint\n" - "fstpl %0\n" : "=m" (*&ret)); - __asm__ ("fldcw %0" : : "m" (*&saved_cw)); + __asm__ ("fldcw %2\n\t" + "frndint\n\t" + "fldcw %3" : "=t" (ret) + : "0" (f), "m" (new_cw), "m" (saved_cw)); return ret; } diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c index 96dd8a6a76f..9c20b90ad05 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c @@ -7,7 +7,6 @@ #define VEC_T __m128 #define FP_T float -#define ASM_SUFFIX "s" #define ROUND_INTRIN(x, mode) _mm_ceil_ss(x, x) #define ROUND_MODE _MM_FROUND_CEIL diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c index f052c029f7a..072664e1573 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c @@ -7,7 +7,6 @@ #define VEC_T __m128 #define FP_T float -#define ASM_SUFFIX "s" #define ROUND_INTRIN(x, mode) _mm_round_ss(x, x, mode) #define ROUND_MODE _MM_FROUND_NINT diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c index 0a696b1cfb7..97c69fdbcb2 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c @@ -7,7 +7,6 @@ #define VEC_T __m128 #define FP_T float -#define ASM_SUFFIX "s" #define ROUND_INTRIN(x, mode) _mm_floor_ss(x, x) #define ROUND_MODE _MM_FROUND_FLOOR diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c index 71042d1b777..95488908630 100644 --- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c +++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c @@ -36,7 +36,7 @@ init_round (float *src) static float do_round (float f, int type) { - short saved_cw, new_cw, clr_mask; + unsigned short saved_cw, new_cw, clr_mask; float ret; if ((type & 4)) @@ -50,16 +50,15 @@ do_round (float f, int type) clr_mask = ~0x0C3F; } - __asm__ ("flds %0" : : "m" (*&f)); + __asm__ ("fnstcw %0" : "=m" (saved_cw)); - __asm__ ("fstcw %0" : "=m" (*&saved_cw)); new_cw = saved_cw & clr_mask; new_cw |= type; - __asm__ ("fldcw %0" : : "m" (*&new_cw)); - __asm__ ("frndint\n" - "fstps %0\n" : "=m" (*&ret)); - __asm__ ("fldcw %0" : : "m" (*&saved_cw)); + __asm__ ("fldcw %2\n\t" + "frndint\n\t" + "fldcw %3" : "=t" (ret) + : "0" (f), "m" (new_cw), "m" (saved_cw)); return ret; } diff --git a/gcc/testsuite/gcc.target/i386/vect-pr67800.c b/gcc/testsuite/gcc.target/i386/vect-pr67800.c new file mode 100644 index 00000000000..324510858ff --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-pr67800.c @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details" } */ +/* { dg-additional-options "-msse4.2" } */ + +#define ubyte unsigned char +#define byte char + +#define SCALE 8 + +#define R2Y (76) +#define G2Y (150) +#define B2Y (30) +#define R2I (127) +#define G2I (-59) +#define B2I (-68) +#define R2Q (51) +#define G2Q (-127) +#define B2Q (76) + +void +convert(ubyte *in, ubyte *out, unsigned n) +{ + ubyte r, g, b; + ubyte y = 0; + byte i, q; + + while (--n) { + r = *in++; + g = *in++; + b = *in++; + + y = (ubyte)(((R2Y * r) + (G2Y * g) + (B2Y * b) + (1 << (SCALE - 1))) >> SCALE); + i = (byte)(((R2I * r) + (G2I * g) + (B2I * b) + (1 << (SCALE - 1))) >> SCALE); + q = (byte)(((R2Q * r) + (G2Q * g) + (B2Q * b) + (1 << (SCALE - 1))) >> SCALE); + + *out++ = y; + *out++ = i; + *out++ = q; + } +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ |