OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [pr42542-1.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O1 -msse2 -ftree-vectorize" } */
3
/* { dg-require-effective-target sse2 } */
4
 
5
#ifndef CHECK_H
6
#define CHECK_H "sse2-check.h"
7
#endif
8
 
9
#ifndef TEST
10
#define TEST sse2_test
11
#endif
12
 
13
#include CHECK_H
14
 
15
unsigned int v1[] __attribute__ ((aligned(16))) =
16
{
17
  0x80000000, 1, 0xa0000000, 2,
18
  3, 0xd0000000, 0xf0000000, 0xe0000000
19
};
20
unsigned int v2[] __attribute__ ((aligned(16))) =
21
{
22
  4, 0xb0000000, 5, 0xc0000000,
23
  0xd0000000, 6, 7, 8
24
};
25
 
26
unsigned int max[] =
27
{
28
  0x80000000, 0xb0000000, 0xa0000000, 0xc0000000,
29
  0xd0000000, 0xd0000000, 0xf0000000, 0xe0000000
30
};
31
 
32
unsigned int min[] =
33
{
34
  4, 1, 5, 2,
35
  3, 6, 7, 8
36
};
37
 
38
unsigned int res[8] __attribute__ ((aligned(16)));
39
 
40
extern void abort (void);
41
 
42
void
43
find_max (void)
44
{
45
  int i;
46
 
47
  for (i = 0; i < 8; i++)
48
    res[i] = v1[i] < v2[i] ? v2[i] : v1[i];
49
}
50
 
51
void
52
find_min (void)
53
{
54
  int i;
55
 
56
  for (i = 0; i < 8; i++)
57
    res[i] = v1[i] > v2[i] ? v2[i] : v1[i];
58
}
59
 
60
static void
61
TEST (void)
62
{
63
  int i;
64
  int err = 0;
65
 
66
  find_max ();
67
  for (i = 0; i < 8; i++)
68
    if (res[i] != max[i])
69
      err++;
70
 
71
  find_min ();
72
  for (i = 0; i < 8; i++)
73
    if (res[i] != min[i])
74
      err++;
75
 
76
  if (err)
77
    abort ();
78
}

powered by: WebSVN 2.1.0

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