/* PR rtl-optimization/16104 */
|
/* PR rtl-optimization/16104 */
|
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
|
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
|
/* { dg-options "-msse2" } */
|
/* { dg-options "-msse2" } */
|
|
|
#include "../i386-cpuid.h"
|
#include "../i386-cpuid.h"
|
|
|
extern void abort (void);
|
extern void abort (void);
|
|
|
typedef int V2SI __attribute__ ((vector_size (8)));
|
typedef int V2SI __attribute__ ((vector_size (8)));
|
typedef unsigned int V2USI __attribute__ ((vector_size (8)));
|
typedef unsigned int V2USI __attribute__ ((vector_size (8)));
|
typedef short V2HI __attribute__ ((vector_size (4)));
|
typedef short V2HI __attribute__ ((vector_size (4)));
|
typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
|
typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
|
|
|
int
|
int
|
test1 (void)
|
test1 (void)
|
{
|
{
|
return (long long) (V2SI) 0LL;
|
return (long long) (V2SI) 0LL;
|
}
|
}
|
|
|
int
|
int
|
test2 (V2SI x)
|
test2 (V2SI x)
|
{
|
{
|
return (long long) x;
|
return (long long) x;
|
}
|
}
|
|
|
V2SI
|
V2SI
|
test3 (void)
|
test3 (void)
|
{
|
{
|
return (V2SI) (long long) (int) (V2HI) 0;
|
return (V2SI) (long long) (int) (V2HI) 0;
|
}
|
}
|
|
|
V2SI
|
V2SI
|
test4 (V2HI x)
|
test4 (V2HI x)
|
{
|
{
|
return (V2SI) (long long) (int) x;
|
return (V2SI) (long long) (int) x;
|
}
|
}
|
|
|
V2SI
|
V2SI
|
test5 (V2USI x)
|
test5 (V2USI x)
|
{
|
{
|
return (V2SI) x;
|
return (V2SI) x;
|
}
|
}
|
|
|
int
|
int
|
__attribute__ ((noinline))
|
__attribute__ ((noinline))
|
do_test (void)
|
do_test (void)
|
{
|
{
|
if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
|
if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
|
return 0;
|
return 0;
|
|
|
if (test1 () != 0)
|
if (test1 () != 0)
|
abort ();
|
abort ();
|
|
|
V2SI x = { 2, 2 };
|
V2SI x = { 2, 2 };
|
if (test2 (x) != 2)
|
if (test2 (x) != 2)
|
abort ();
|
abort ();
|
|
|
union { V2SI x; int y[2]; V2USI z; long long l; } u;
|
union { V2SI x; int y[2]; V2USI z; long long l; } u;
|
u.x = test3 ();
|
u.x = test3 ();
|
if (u.y[0] != 0 || u.y[1] != 0)
|
if (u.y[0] != 0 || u.y[1] != 0)
|
abort ();
|
abort ();
|
|
|
V2HI y = { 4, 4 };
|
V2HI y = { 4, 4 };
|
union { V2SI x; long long y; } v;
|
union { V2SI x; long long y; } v;
|
v.x = test4 (y);
|
v.x = test4 (y);
|
if (v.y != 0x40004)
|
if (v.y != 0x40004)
|
abort ();
|
abort ();
|
|
|
V2USI z = { 6, 6 };
|
V2USI z = { 6, 6 };
|
u.x = test5 (z);
|
u.x = test5 (z);
|
if (u.y[0] != 6 || u.y[1] != 6)
|
if (u.y[0] != 6 || u.y[1] != 6)
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
unsigned long cpu_facilities;
|
unsigned long cpu_facilities;
|
|
|
cpu_facilities = i386_cpuid ();
|
cpu_facilities = i386_cpuid ();
|
|
|
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV | bit_SSE2))
|
if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV | bit_SSE2))
|
!= (bit_MMX | bit_SSE | bit_CMOV | bit_SSE2))
|
!= (bit_MMX | bit_SSE | bit_CMOV | bit_SSE2))
|
return 0;
|
return 0;
|
|
|
return do_test ();
|
return do_test ();
|
}
|
}
|
|
|