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-2.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 short v1[] __attribute__ ((aligned(16))) =
16
{
17
  0x8000, 0x9000, 1, 10, 0xa000, 0xb000, 2, 20,
18
  3, 30, 0xd000, 0xe000, 0xf000, 0xe000, 25, 30
19
};
20
unsigned short v2[] __attribute__ ((aligned(16))) =
21
{
22
  4, 40, 0xb000, 0x8000, 5, 50, 0xc000, 0xf000,
23
  0xd000, 0xa000, 6, 65, 7, 75, 0xe000, 0xc000
24
};
25
 
26
unsigned short max[] =
27
{
28
  0x8000, 0x9000, 0xb000, 0x8000, 0xa000, 0xb000, 0xc000, 0xf000,
29
  0xd000, 0xa000, 0xd000, 0xe000, 0xf000, 0xe000, 0xe000, 0xc000
30
};
31
 
32
unsigned short min[] =
33
{
34
  4, 40, 1, 10, 5, 50, 2, 20,
35
  3, 30, 6, 65, 7, 75, 25, 30
36
};
37
 
38
unsigned short res[16] __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 < 16; 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 < 16; 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 < 16; i++)
68
    if (res[i] != max[i])
69
      err++;
70
 
71
  find_min ();
72
  for (i = 0; i < 16; 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.