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-3.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 char v1[] __attribute__ ((aligned(16))) =
16
{
17
  0x80, 0xd0, 0x90, 0xa0, 1, 15, 10, 15,
18
  0xa0, 0xc0, 0xb0, 0xf0, 2, 25, 20, 35,
19
  3, 34, 30, 36, 0xd0, 0x80, 0xe0, 0xb0,
20
  0xf0, 0xe0, 0xe0, 0x80, 25, 34, 30, 40
21
};
22
unsigned char v2[] __attribute__ ((aligned(16))) =
23
{
24
  4, 44, 40, 48, 0xb0, 0x80, 0x80, 0x90,
25
  5, 55, 50, 51, 0xc0, 0xb0, 0xf0, 0xd0,
26
  0xd0, 0x80, 0xa0, 0xf0, 6, 61, 65, 68,
27
  7, 76, 75, 81, 0xe0, 0xf0, 0xc0, 0x90
28
};
29
 
30
unsigned char max[] =
31
{
32
  0x80, 0xd0, 0x90, 0xa0, 0xb0, 0x80, 0x80, 0x90,
33
  0xa0, 0xc0, 0xb0, 0xf0, 0xc0, 0xb0, 0xf0, 0xd0,
34
  0xd0, 0x80, 0xa0, 0xf0, 0xd0, 0x80, 0xe0, 0xb0,
35
  0xf0, 0xe0, 0xe0, 0x80, 0xe0, 0xf0, 0xc0, 0x90
36
};
37
 
38
unsigned char min[] =
39
{
40
  4, 44, 40, 48, 1, 15, 10, 15,
41
  5, 55, 50, 51, 2, 25, 20, 35,
42
  3, 34, 30, 36, 6, 61, 65, 68,
43
  7, 76, 75, 81, 25, 34, 30, 40
44
};
45
 
46
unsigned char res[32] __attribute__ ((aligned(16)));
47
 
48
extern void abort (void);
49
 
50
void
51
find_max (void)
52
{
53
  int i;
54
 
55
  for (i = 0; i < 32; i++)
56
    res[i] = v1[i] < v2[i] ? v2[i] : v1[i];
57
}
58
 
59
void
60
find_min (void)
61
{
62
  int i;
63
 
64
  for (i = 0; i < 32; i++)
65
    res[i] = v1[i] > v2[i] ? v2[i] : v1[i];
66
}
67
 
68
static void
69
TEST (void)
70
{
71
  int i;
72
  int err = 0;
73
 
74
  find_max ();
75
  for (i = 0; i < 32; i++)
76
    if (res[i] != max[i])
77
      err++;
78
 
79
  find_min ();
80
  for (i = 0; i < 32; i++)
81
    if (res[i] != min[i])
82
      err++;
83
 
84
  if (err)
85
    abort ();
86
}

powered by: WebSVN 2.1.0

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