OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [pr16104-1.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* PR rtl-optimization/16104 */
2
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
3
/* { dg-options "-msse2" } */
4
 
5
#include "../i386-cpuid.h"
6
 
7
extern void abort (void);
8
 
9
typedef int V2SI __attribute__ ((vector_size (8)));
10
typedef unsigned int V2USI __attribute__ ((vector_size (8)));
11
typedef short V2HI __attribute__ ((vector_size (4)));
12
typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
13
 
14
int
15
test1 (void)
16
{
17
  return (long long) (V2SI) 0LL;
18
}
19
 
20
int
21
test2 (V2SI x)
22
{
23
  return (long long) x;
24
}
25
 
26
V2SI
27
test3 (void)
28
{
29
  return (V2SI) (long long) (int) (V2HI) 0;
30
}
31
 
32
V2SI
33
test4 (V2HI x)
34
{
35
  return (V2SI) (long long) (int) x;
36
}
37
 
38
V2SI
39
test5 (V2USI x)
40
{
41
  return (V2SI) x;
42
}
43
 
44
int
45
__attribute__ ((noinline))
46
do_test (void)
47
{
48
  if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
49
    return 0;
50
 
51
  if (test1 () != 0)
52
    abort ();
53
 
54
  V2SI x = { 2, 2 };
55
  if (test2 (x) != 2)
56
    abort ();
57
 
58
  union { V2SI x; int y[2]; V2USI z; long long l; } u;
59
  u.x = test3 ();
60
  if (u.y[0] != 0 || u.y[1] != 0)
61
    abort ();
62
 
63
  V2HI y = { 4, 4 };
64
  union { V2SI x; long long y; } v;
65
  v.x = test4 (y);
66
  if (v.y != 0x40004)
67
    abort ();
68
 
69
  V2USI z = { 6, 6 };
70
  u.x = test5 (z);
71
  if (u.y[0] != 6 || u.y[1] != 6)
72
    abort ();
73
  return 0;
74
}
75
 
76
int
77
main (void)
78
{
79
  unsigned long cpu_facilities;
80
 
81
  cpu_facilities = i386_cpuid ();
82
 
83
  if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV | bit_SSE2))
84
      != (bit_MMX | bit_SSE | bit_CMOV | bit_SSE2))
85
    return 0;
86
 
87
  return do_test ();
88
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.