sse4a-check.h: New file.

* gcc.target/i386/sse4a-check.h: New file.
	* gcc.target/i386/sse4a-extract.c: Include sse4a-check.h. Remove main.
	* gcc.target/i386/sse4a-insert.c: Ditto.
	* gcc.target/i386/sse4a-montsd.c: Ditto.
	* gcc.target/i386/sse4a-montss.c: Ditto.
	* gcc.target/i386/mmx-check.h: New file.
	* gcc.target/i386/mmx-4.c: Include mmx-check.h. Remove main.
	* gcc.target/i386/builtin-apply-mmx.c: Ditto.
	* gcc.target/i386/sse-check.h: New file.
	* gcc.target/i386/pr13685: Include sse-check.h. Remove main.
	* gcc.target/i386/sse-3.c: Ditto.
	* gcc.target/i386/sse-7.c: Ditto.
	* gcc.target/i386/sse-9.c: Ditto.
	* gcc.target/i386/ssefn-3.c: Ditto.
	* gcc.target/i386/sse-recip.c: Ditto.
	* gcc.target/i386/sse-recip-vec.c: Ditto.
	* gcc.target/i386/20020523.c: Ditto. Rename from 20020523-2.c.
	* gcc.target/i386/20020523-1.c: Remove.
	* gcc.target/i386/sse2-lrint-vec.c: Include sse2-check.h. Remove main.
	* gcc.target/i386/sse2-lrintf-vec.c: Ditto.
	* gcc.target/i386/ssefn-4.c: Ditto.
	* gcc.target/i386/sse-6.c: Ditto.
	* gcc.target/i386/sse-10.c: Ditto.
	* gcc.target/i386/sse-11.c: Ditto.
	* gcc.target/i386/sse-18.c: Ditto.
	* gcc.target/i386/fpprec-1.c: Ditto.
	* g++.dg/other/i386-1.C: Ditto.

From-SVN: r128069
This commit is contained in:
Uros Bizjak 2007-09-04 11:02:56 +02:00 committed by Uros Bizjak
parent 04d86531d7
commit 8d67c58f94
28 changed files with 220 additions and 499 deletions

View File

@ -1,3 +1,33 @@
2007-09-04 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/sse4a-check.h: New file.
* gcc.target/i386/sse4a-extract.c: Include sse4a-check.h. Remove main.
* gcc.target/i386/sse4a-insert.c: Ditto.
* gcc.target/i386/sse4a-montsd.c: Ditto.
* gcc.target/i386/sse4a-montss.c: Ditto.
* gcc.target/i386/mmx-check.h: New file.
* gcc.target/i386/mmx-4.c: Include mmx-check.h. Remove main.
* gcc.target/i386/builtin-apply-mmx.c: Ditto.
* gcc.target/i386/sse-check.h: New file.
* gcc.target/i386/pr13685: Include sse-check.h. Remove main.
* gcc.target/i386/sse-3.c: Ditto.
* gcc.target/i386/sse-7.c: Ditto.
* gcc.target/i386/sse-9.c: Ditto.
* gcc.target/i386/ssefn-3.c: Ditto.
* gcc.target/i386/sse-recip.c: Ditto.
* gcc.target/i386/sse-recip-vec.c: Ditto.
* gcc.target/i386/20020523.c: Ditto. Rename from 20020523-2.c.
* gcc.target/i386/20020523-1.c: Remove.
* gcc.target/i386/sse2-lrint-vec.c: Include sse2-check.h. Remove main.
* gcc.target/i386/sse2-lrintf-vec.c: Ditto.
* gcc.target/i386/ssefn-4.c: Ditto.
* gcc.target/i386/sse-6.c: Ditto.
* gcc.target/i386/sse-10.c: Ditto.
* gcc.target/i386/sse-11.c: Ditto.
* gcc.target/i386/sse-18.c: Ditto.
* gcc.target/i386/fpprec-1.c: Ditto.
* g++.dg/other/i386-1.C: Ditto.
2007-09-04 Richard Guenther <rguenther@suse.de> 2007-09-04 Richard Guenther <rguenther@suse.de>
PR tree-optimization/33291 PR tree-optimization/33291

View File

@ -1,30 +1,22 @@
/* { dg-do run { target i?86-*-* x86_64-*-* } } */ /* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-msse2" } */ /* { dg-options "-msse2" } */
#include <xmmintrin.h> #include "../../gcc.target/i386/sse2-check.h"
#include <stdio.h>
#include "../../gcc.dg/i386-cpuid.h"
int main(int argc, char** argv) { #include <xmmintrin.h>
static void
sse2_test (void)
{
float a = 1.0f; float a = 1.0f;
float b = 2.0f; float b = 2.0f;
float c = 3.0f; float c = 3.0f;
float r; float r;
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
/* If host has no vector support, pass. */
return 0;
__m128 v = _mm_set_ps(a, b, c, 0); __m128 v = _mm_set_ps(a, b, c, 0);
v = (__m128)_mm_srli_si128((__m128i)v, 4); v = (__m128)_mm_srli_si128((__m128i)v, 4);
_mm_store_ss(&r, v); _mm_store_ss(&r, v);
if (r != 3.0f) if (r != 3.0f)
abort (); abort ();
exit (0);
} }

View File

@ -1,68 +0,0 @@
/* PR target/6753
This testcase was miscompiled because sse_mov?fcc_const0*
patterns were missing earlyclobber. */
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
/* { dg-require-effective-target nonpic } */
/* { dg-options "-march=pentium3 -msse -ffast-math -O2" } */
extern void abort (void);
extern void exit (int);
float one = 1.f;
void bar (float f)
{
if (__builtin_memcmp (&one, &f, sizeof (float)))
abort ();
}
float foo (void)
{
return 1.f;
}
typedef struct
{
float t;
} T;
void bail_if_no_sse (void)
{
int fl1, fl2;
/* See if we can use cpuid. */
__asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
"pushl %0; popfl; pushfl; popl %0; popfl"
: "=&r" (fl1), "=&r" (fl2)
: "i" (0x00200000));
if (((fl1 ^ fl2) & 0x00200000) == 0)
exit (0);
/* See if cpuid gives capabilities. */
__asm__ ("cpuid" : "=a" (fl1) : "0" (0) : "ebx", "ecx", "edx", "cc");
if (fl1 == 0)
exit (0);
/* See if capabilities include SSE (25th bit; 26 for SSE2). */
__asm__ ("cpuid" : "=a" (fl1), "=d" (fl2) : "0" (1) : "ebx", "ecx", "cc");
if ((fl2 & (1 << 25)) == 0)
exit (0);
}
int main (void)
{
int i;
T x[1];
bail_if_no_sse ();
for (i = 0; i < 1; i++)
{
x[i].t = foo ();
x[i].t = 0.f > x[i].t ? 0.f : x[i].t;
bar (x[i].t);
}
exit (0);
}

View File

@ -1,13 +1,11 @@
/* PR target/6753 /* PR target/6753
This testcase was miscompiled because sse_mov?fcc_const0* This testcase was miscompiled because sse_mov?fcc_const0*
patterns were missing earlyclobber. */ patterns were missing earlyclobber. */
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-march=pentium3 -msse -ffast-math -O2" } */
#include "../../gcc.dg/i386-cpuid.h" /* { dg-do run } */
extern void abort (void); /* { dg-options "-O2 -msse -mfpmath=sse -ffast-math" } */
extern void exit (int);
#include "sse-check.h"
float one = 1.f; float one = 1.f;
@ -27,27 +25,16 @@ typedef struct
float t; float t;
} T; } T;
void bail_if_no_sse (void) static void
{ sse_test (void)
unsigned int edx;
/* See if capabilities include SSE (25th bit; 26 for SSE2). */
edx = i386_cpuid();
if (!(edx & bit_SSE))
exit (0);
}
int main (void)
{ {
int i; int i;
T x[1]; T x[1];
bail_if_no_sse ();
for (i = 0; i < 1; i++) for (i = 0; i < 1; i++)
{ {
x[i].t = foo (); x[i].t = foo ();
x[i].t = 0.f > x[i].t ? 0.f : x[i].t; x[i].t = 0.f > x[i].t ? 0.f : x[i].t;
bar (x[i].t); bar (x[i].t);
} }
exit (0);
} }

View File

@ -13,7 +13,7 @@
/* { dg-options "-O2 -mmmx" } */ /* { dg-options "-O2 -mmmx" } */
/* { dg-require-effective-target ilp32 } */ /* { dg-require-effective-target ilp32 } */
#include "../../gcc.dg/i386-cpuid.h" #include "mmx-check.h"
extern void abort (void); extern void abort (void);
@ -34,19 +34,9 @@ bar (double arg)
__builtin_apply_args (), 16)); __builtin_apply_args (), 16));
} }
int static void
main (int argc, char **argv) mmx_test (void)
{ {
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if (!(cpu_facilities & bit_MMX))
/* If host has no MMX support, pass. */
return 0;
if (bar (116.0) != 117.0) if (bar (116.0) != 117.0)
abort (); abort ();
return 0;
} }

View File

@ -1,10 +1,7 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -fno-math-errno -fno-trapping-math -msse2 -mfpmath=sse" } */ /* { dg-options "-O2 -fno-math-errno -fno-trapping-math -msse2 -mfpmath=sse" } */
#include "../../gcc.dg/i386-cpuid.h" #include "sse2-check.h"
extern void abort(void);
extern int printf(const char *format, ...);
double x[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(), double x[] = { __builtin_nan(""), __builtin_inf(), -__builtin_inf(),
-0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, /* +-DBL_MAX */ -0x1.fffffffffffffp+1023, 0x1.fffffffffffffp+1023, /* +-DBL_MAX */
@ -71,20 +68,12 @@ CHECK(floor)
CHECK(ceil) CHECK(ceil)
CHECK(trunc) CHECK(trunc)
int main() static void
sse2_test (void)
{ {
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & bit_SSE2) != bit_SSE2)
/* If host has no SSE2 support, pass. */
return 0;
check_round (); check_round ();
check_rint (); check_rint ();
check_floor (); check_floor ();
check_ceil (); check_ceil ();
check_trunc (); check_trunc ();
return 0;
} }

View File

@ -1,14 +1,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -mmmx" } */ /* { dg-options "-O2 -mmmx" } */
#include <mmintrin.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../gcc.dg/i386-cpuid.h"
#ifndef NOINLINE #include "mmx-check.h"
#define NOINLINE __attribute__ ((noinline))
#endif #include <mmintrin.h>
#include <string.h>
#define SHIFT (4) #define SHIFT (4)
@ -53,15 +49,10 @@ const char *reference_mmx[] = {
"" ""
}; };
int main()
static void
mmx_test (void)
{ {
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & bit_MMX) == 0)
exit (0);
d64.u[0] = 0x01234567; d64.u[0] = 0x01234567;
d64.u[1] = 0x01234567; d64.u[1] = 0x01234567;
@ -85,22 +76,18 @@ int main()
s64 = b64.v; s64 = b64.v;
if (cpu_facilities & bit_MMX) mmx_tests();
{ check (buf, reference_mmx);
mmx_tests();
check (buf, reference_mmx);
#ifdef DEBUG #ifdef DEBUG
printf ("mmx testing:\n"); printf ("mmx testing:\n");
printf (buf); printf (buf);
printf ("\ncomparison:\n"); printf ("\ncomparison:\n");
printf (comparison); printf (comparison);
#endif #endif
buf[0] = '\0'; buf[0] = '\0';
}
if (errors != 0) if (errors != 0)
abort (); abort ();
exit (0);
} }
void NOINLINE void NOINLINE

View File

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include "../../gcc.dg/i386-cpuid.h"
static void mmx_test (void);
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid_edx ();
/* Run MMX test only if host has MMX support. */
if ((cpu_facilities & bit_MMX))
mmx_test ();
exit (0);
}

View File

@ -1,28 +1,20 @@
/* PR target/13685 */ /* PR target/13685 */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-Os -msse" } */ /* { dg-options "-Os -msse" } */
#include <stdlib.h>
#include <stdio.h> #include "sse-check.h"
#include <xmmintrin.h> #include <xmmintrin.h>
#include "../../gcc.dg/i386-cpuid.h"
void foo (__m128 *, __m64 *, int); void foo (__m128 *, __m64 *, int);
__m128 xmm0 = { 0 }; __m128 xmm0 = { 0 };
__m64 mm0 = { 0 }; __m64 mm0 = { 0 };
int static void
main () sse_test (void)
{ {
unsigned long cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_CMOV))
/* If host has no SSE support, pass. */
return 0;
foo (&xmm0, &mm0, 4); foo (&xmm0, &mm0, 4);
return 0;
} }
void void

View File

@ -2,7 +2,7 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O1 -msse2 -mfpmath=sse -mno-accumulate-outgoing-args -fno-omit-frame-pointer" } */ /* { dg-options "-O1 -msse2 -mfpmath=sse -mno-accumulate-outgoing-args -fno-omit-frame-pointer" } */
#include "../../gcc.dg/i386-cpuid.h" #include "sse2-check.h"
typedef _Complex double complex_16; typedef _Complex double complex_16;
@ -21,14 +21,10 @@ test (complex_16 a[5][5])
} }
} }
int main() static void
sse2_test (void)
{ {
static complex_16 work[5][5]; static complex_16 work[5][5];
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid (); test (work);
if (cpu_facilities & bit_SSE2)
test (work);
return 0;
} }

View File

@ -1,10 +1,10 @@
/* PR rtl-optimization/21239 */ /* PR rtl-optimization/21239 */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -msse2" } */ /* { dg-options "-O2 -msse2" } */
#include <emmintrin.h>
#include "../../gcc.dg/i386-cpuid.h"
extern void abort (void); #include "sse2-check.h"
#include <emmintrin.h>
void void
foo (unsigned int x, double *y, const double *z) foo (unsigned int x, double *y, const double *z)
@ -49,8 +49,8 @@ bar (unsigned int x, float *y, const float *z)
} }
} }
void __attribute__((noinline)) static void
run_tests (void) sse2_test (void)
{ {
unsigned int i; unsigned int i;
double a[16], b[16]; double a[16], b[16];
@ -72,21 +72,3 @@ run_tests (void)
abort (); abort ();
} }
} }
int
main ()
{
unsigned long cpu_facilities;
unsigned int i;
double a[19], b[19];
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
/* If host has no vector support, pass. */
return 0;
run_tests ();
return 0;
}

View File

@ -1,8 +1,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O3 -msse2" } */ /* { dg-options "-O3 -msse2" } */
extern void abort(void);
#include "sse2-check.h"
#include <emmintrin.h> #include <emmintrin.h>
#include "../../gcc.dg/i386-cpuid.h"
__m128i foo (char) __attribute__((noinline)); __m128i foo (char) __attribute__((noinline));
__m128i foo (char x) { __m128i foo (char x) {
return _mm_set1_epi8(x); return _mm_set1_epi8(x);
@ -12,18 +14,11 @@ __m128i bar (char x) {
return _mm_set_epi8 (x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x); return _mm_set_epi8 (x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x);
} }
main() { static void
sse2_test (void) {
int i, j; int i, j;
union u { __m128i v; char c[16]; }; union u { __m128i v; char c[16]; };
union u x, y; union u x, y;
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
/* If host has no vector support, pass. */
return 0;
for (i = -128; i <= 127; i++) for (i = -128; i <= 127; i++)
{ {
@ -33,6 +28,5 @@ main() {
if (x.c[j] != y.c[j]) if (x.c[j] != y.c[j])
abort(); abort();
} }
return 0;
} }

View File

@ -1,10 +1,10 @@
/* PR target/21149 */ /* PR target/21149 */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -msse" } */ /* { dg-options "-O2 -msse" } */
#include <xmmintrin.h>
#include "../../gcc.dg/i386-cpuid.h"
extern void abort (void); #include "sse-check.h"
#include <xmmintrin.h>
void void
__attribute__((noinline)) __attribute__((noinline))
@ -28,26 +28,9 @@ foo (__m128 *x)
check (w, 0, 0, 2, -3); check (w, 0, 0, 2, -3);
} }
void static void
__attribute__((noinline)) sse_test (void)
run_tests (void)
{ {
__m128 y = _mm_set_ps (-3, 2, 1, 9); __m128 y = _mm_set_ps (-3, 2, 1, 9);
foo (&y); foo (&y);
} }
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_CMOV))
/* If host has no vector support, pass. */
return 0;
run_tests ();
return 0;
}

View File

@ -1,14 +1,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -msse2" } */ /* { dg-options "-O2 -msse2" } */
#include <xmmintrin.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../gcc.dg/i386-cpuid.h"
#ifndef NOINLINE #include "sse2-check.h"
#define NOINLINE __attribute__ ((noinline))
#endif #include <emmintrin.h>
#include <string.h>
#define SHIFT (4) #define SHIFT (4)
@ -60,17 +56,9 @@ const char *reference_sse2[] = {
"" ""
}; };
int main() static void
sse2_test (void)
{ {
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
/* If host has no vector support, pass. */
exit (0);
a128.s[0] = 0x01234567; a128.s[0] = 0x01234567;
a128.s[1] = 0x01234567; a128.s[1] = 0x01234567;
a128.s[2] = 0x01234567; a128.s[2] = 0x01234567;
@ -108,22 +96,18 @@ int main()
s128 = b128.v; s128 = b128.v;
if (cpu_facilities & bit_SSE2) sse2_tests();
{ check (buf, reference_sse2);
sse2_tests();
check (buf, reference_sse2);
#ifdef DEBUG #ifdef DEBUG
printf ("sse2 testing:\n"); printf ("sse2 testing:\n");
printf (buf); printf (buf);
printf ("\ncomparison:\n"); printf ("\ncomparison:\n");
printf (comparison); printf (comparison);
#endif #endif
buf[0] = '\0'; buf[0] = '\0';
}
if (errors != 0) if (errors != 0)
abort (); abort ();
exit (0);
} }
void NOINLINE void NOINLINE

View File

@ -1,14 +1,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -msse" } */ /* { dg-options "-O2 -msse" } */
#include <xmmintrin.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../gcc.dg/i386-cpuid.h"
#ifndef NOINLINE #include "sse-check.h"
#define NOINLINE __attribute__ ((noinline))
#endif #include <xmmintrin.h>
#include <string.h>
#define SHIFT (4) #define SHIFT (4)
@ -36,37 +32,25 @@ const char *reference_sse[] = {
"" ""
}; };
int main() static void
sse_test (void)
{ {
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_CMOV))
/* If host has no vector support, pass. */
exit (0);
e64.t = 0x0123456789abcdefULL; e64.t = 0x0123456789abcdefULL;
m64_64 = e64.v; m64_64 = e64.v;
if (cpu_facilities & bit_SSE) sse_tests();
{ check (buf, reference_sse);
sse_tests();
check (buf, reference_sse);
#ifdef DEBUG #ifdef DEBUG
printf ("sse testing:\n"); printf ("sse testing:\n");
printf (buf); printf (buf);
printf ("\ncomparison:\n"); printf ("\ncomparison:\n");
printf (comparison); printf (comparison);
#endif #endif
buf[0] = '\0'; buf[0] = '\0';
}
if (errors != 0) if (errors != 0)
abort (); abort ();
exit (0);
} }
void NOINLINE void NOINLINE

View File

@ -1,25 +1,19 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -msse" } */ /* { dg-options "-O2 -msse" } */
#include "sse-check.h"
#include <xmmintrin.h> #include <xmmintrin.h>
#include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
#include "../../gcc.dg/i386-cpuid.h"
int static void
main() sse_test (void)
{ {
int alignment, n; int alignment, n;
void *ptr; void *ptr;
int errors = 0; int errors = 0;
const char test [] = "This is a test."; const char test [] = "This is a test.";
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & bit_SSE) != bit_SSE )
/* If host has no vector support, pass. */
exit (0);
for (alignment = 1; alignment <= (1 << 20); alignment += alignment) for (alignment = 1; alignment <= (1 << 20); alignment += alignment)
{ {
@ -40,5 +34,4 @@ main()
if (errors != 0) if (errors != 0)
abort (); abort ();
exit (0);
} }

View File

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include "../../gcc.dg/i386-cpuid.h"
static void sse_test (void);
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid_edx ();
/* Run SSE test only if host has SSE support. */
if ((cpu_facilities & bit_SSE))
sse_test ();
exit (0);
}

View File

@ -1,15 +1,14 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip" } */ /* { dg-options "-O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip" } */
#include "../../gcc.dg/i386-cpuid.h" #include "sse-check.h"
extern float sqrtf (float); extern float sqrtf (float);
extern void abort (void);
#define N 8 #define N 8
int __attribute__((noinline)) static void
main1 () sse_test (void)
{ {
float a[N] = { 0.f, 18.f, 108.f, 324.f, 720.f, 1944.f, 3087.f, 5832.f }; float a[N] = { 0.f, 18.f, 108.f, 324.f, 720.f, 1944.f, 3087.f, 5832.f };
float b[N] = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f }; float b[N] = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f };
@ -30,22 +29,4 @@ main1 ()
if (r[i] != rc[i]) if (r[i] != rc[i])
abort(); abort();
} }
return 0;
}
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_CMOV))
/* If host has no vector support, pass. */
return 0;
main1 ();
return 0;
} }

View File

@ -1,15 +1,14 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -ffast-math -msse -mfpmath=sse -mrecip" } */ /* { dg-options "-O2 -ffast-math -msse -mfpmath=sse -mrecip" } */
#include "../../gcc.dg/i386-cpuid.h" #include "sse-check.h"
extern float sqrtf (float); extern float sqrtf (float);
extern void abort (void);
#define N 8 #define N 8
int __attribute__((noinline)) static void
main1 () sse_test (void)
{ {
float a[N] = { 0.f, 18.f, 108.f, 324.f, 720.f, 1944.f, 3087.f, 5832.f }; float a[N] = { 0.f, 18.f, 108.f, 324.f, 720.f, 1944.f, 3087.f, 5832.f };
float b[N] = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f }; float b[N] = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f };
@ -30,22 +29,4 @@ main1 ()
if (r[i] != rc[i]) if (r[i] != rc[i])
abort(); abort();
} }
return 0;
}
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_CMOV))
/* If host has no vector support, pass. */
return 0;
main1 ();
return 0;
} }

View File

@ -1,15 +1,14 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse2" } */ /* { dg-options "-O2 -ffast-math -ftree-vectorize -msse2" } */
#include "../../gcc.dg/i386-cpuid.h" #include "sse2-check.h"
extern long lrint (double); extern long lrint (double);
extern void abort (void);
#define N 32 #define N 32
int __attribute__((noinline)) static void
main1 () sse2_test (void)
{ {
double a[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5}; double a[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5};
long r[N]; long r[N];
@ -27,22 +26,4 @@ main1 ()
if (r[i] != lrint (a[i])) if (r[i] != lrint (a[i]))
abort(); abort();
} }
return 0;
}
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
/* If host has no vector support, pass. */
return 0;
main1 ();
return 0;
} }

View File

@ -1,15 +1,14 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse2" } */ /* { dg-options "-O2 -ffast-math -ftree-vectorize -msse2" } */
#include "../../gcc.dg/i386-cpuid.h" #include "sse2-check.h"
extern long lrintf (float); extern long lrintf (float);
extern void abort (void);
#define N 32 #define N 32
int __attribute__((noinline)) static void
main1 () sse2_test (void)
{ {
float a[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5}; float a[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5};
long r[N]; long r[N];
@ -27,22 +26,4 @@ main1 ()
if (r[i] != lrintf (a[i])) if (r[i] != lrintf (a[i]))
abort(); abort();
} }
return 0;
}
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_cpuid ();
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
!= (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
/* If host has no vector support, pass. */
return 0;
main1 ();
return 0;
} }

View File

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include "../../gcc.dg/i386-cpuid.h"
static void sse4a_test (void);
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_extended_cpuid_ecx ();
/* Run SSE4a test only if host has SSE4a support. */
if ((cpu_facilities & bit_SSE4a))
sse4a_test ();
exit (0);
}

View File

@ -1,11 +1,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-require-effective-target sse4a } */ /* { dg-require-effective-target sse4a } */
/* { dg-options "-O2 -msse4a" } */ /* { dg-options "-O2 -msse4a" } */
#include <ammintrin.h>
#include <stdlib.h>
#include "../../gcc.dg/i386-cpuid.h"
static void sse4a_test (void); #include "sse4a-check.h"
#include <ammintrin.h>
typedef union typedef union
{ {
@ -13,20 +12,6 @@ typedef union
__m128i vec; __m128i vec;
} LI; } LI;
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_extended_cpuid_ecx ();
/* Run SSE4a test only if host has SSE4a support. */
if ((cpu_facilities & bit_SSE4a))
sse4a_test ();
exit (0);
}
static long long static long long
sse4a_test_extrq (long long in) sse4a_test_extrq (long long in)
{ {
@ -96,6 +81,4 @@ sse4a_test (void)
if (fail != 0) if (fail != 0)
abort (); abort ();
exit (0);
} }

View File

@ -1,11 +1,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-require-effective-target sse4a } */ /* { dg-require-effective-target sse4a } */
/* { dg-options "-O2 -msse4a" } */ /* { dg-options "-O2 -msse4a" } */
#include <ammintrin.h>
#include <stdlib.h>
#include "../../gcc.dg/i386-cpuid.h"
static void sse4a_test (void); #include "sse4a-check.h"
#include <ammintrin.h>
typedef union typedef union
{ {
@ -13,20 +12,6 @@ typedef union
__m128i vec; __m128i vec;
} LI; } LI;
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_extended_cpuid_ecx ();
/* Run SSE4a test only if host has SSE4a support. */
if ((cpu_facilities & bit_SSE4a))
sse4a_test ();
exit (0);
}
static long long static long long
sse4a_test_insert (long long in1, long long in2) sse4a_test_insert (long long in1, long long in2)
{ {
@ -106,6 +91,4 @@ sse4a_test (void)
if (fail != 0) if (fail != 0)
abort (); abort ();
exit (0);
} }

View File

@ -1,26 +1,11 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-require-effective-target sse4a } */ /* { dg-require-effective-target sse4a } */
/* { dg-options "-O2 -msse4a" } */ /* { dg-options "-O2 -msse4a" } */
#include "sse4a-check.h"
#include <ammintrin.h> #include <ammintrin.h>
#include <stdlib.h>
#include "../../gcc.dg/i386-cpuid.h"
static void sse4a_test (void);
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_extended_cpuid_ecx ();
/* Run SSE4a test only if host has SSE4a support. */
if ((cpu_facilities & bit_SSE4a))
sse4a_test ();
exit (0);
}
static void static void
sse4a_test_movntsd (double *out, double *in) sse4a_test_movntsd (double *out, double *in)
{ {
@ -60,6 +45,4 @@ sse4a_test (void)
if (fail != 0) if (fail != 0)
abort (); abort ();
exit (0);
} }

View File

@ -1,25 +1,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-require-effective-target sse4a } */ /* { dg-require-effective-target sse4a } */
/* { dg-options "-O2 -msse4a" } */ /* { dg-options "-O2 -msse4a" } */
#include "sse4a-check.h"
#include <ammintrin.h> #include <ammintrin.h>
#include <stdlib.h>
#include "../../gcc.dg/i386-cpuid.h"
static void sse4a_test (void);
int
main ()
{
unsigned long cpu_facilities;
cpu_facilities = i386_extended_cpuid_ecx ();
/* Run SSE4a test only if host has SSE4a support. */
if ((cpu_facilities & bit_SSE4a))
sse4a_test ();
exit (0);
}
static void static void
sse4a_test_movntss (float *out, float *in) sse4a_test_movntss (float *out, float *in)
@ -60,6 +45,4 @@ sse4a_test (void)
if (fail != 0) if (fail != 0)
abort (); abort ();
exit (0);
} }

View File

@ -3,8 +3,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -msse -mfpmath=sse" } */ /* { dg-options "-O2 -msse -mfpmath=sse" } */
#include "sse-check.h"
#include <assert.h> #include <assert.h>
#include "../../gcc.dg/i386-cpuid.h"
static float xs (void) static float xs (void)
{ {
@ -26,18 +28,11 @@ double yd (double a)
return xd () * a; return xd () * a;
} }
int main() static void
sse_test (void)
{ {
unsigned long cpu_facilities; assert (ys (1) == xs ());
assert (ys (2) == xs () * 2);
cpu_facilities = i386_cpuid (); assert (yd (1) == xd ());
assert (yd (2) == xd () * 2);
if (cpu_facilities & bit_SSE)
{
assert (ys (1) == xs ());
assert (ys (2) == xs () * 2);
assert (yd (1) == xd ());
assert (yd (2) == xd () * 2);
}
return 0;
} }

View File

@ -3,8 +3,10 @@
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -msse2 -mfpmath=sse" } */ /* { dg-options "-O2 -msse2 -mfpmath=sse" } */
#include "sse2-check.h"
#include <assert.h> #include <assert.h>
#include "../../gcc.dg/i386-cpuid.h"
static float xs (void) static float xs (void)
{ {
@ -26,18 +28,11 @@ double yd (double a)
return xd () * a; return xd () * a;
} }
int main() static void
sse2_test (void)
{ {
unsigned long cpu_facilities; assert (ys (1) == xs ());
assert (ys (2) == xs () * 2);
cpu_facilities = i386_cpuid (); assert (yd (1) == xd ());
assert (yd (2) == xd () * 2);
if (cpu_facilities & bit_SSE2)
{
assert (ys (1) == xs ());
assert (ys (2) == xs () * 2);
assert (yd (1) == xd ());
assert (yd (2) == xd () * 2);
}
return 0;
} }