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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse4_1-phminposuw-2.c] - Blame information for rev 848

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target sse4 } */
3
/* { dg-options "-O3 -msse4.1 -mno-avx2" } */
4
 
5
#ifndef CHECK_H
6
#define CHECK_H "sse4_1-check.h"
7
#endif
8
 
9
#ifndef TEST
10
#define TEST sse4_1_test
11
#endif
12
 
13
#include CHECK_H
14
 
15
extern void abort (void);
16
 
17
#define N 1024
18
short a[N], c, e;
19
unsigned short b[N], d, f;
20
 
21
__attribute__((noinline)) short
22
vecsmax (void)
23
{
24
  int i;
25
  short r = -32768;
26
  for (i = 0; i < N; ++i)
27
    if (r < a[i]) r = a[i];
28
  return r;
29
}
30
 
31
__attribute__((noinline)) unsigned short
32
vecumax (void)
33
{
34
  int i;
35
  unsigned short r = 0;
36
  for (i = 0; i < N; ++i)
37
    if (r < b[i]) r = b[i];
38
  return r;
39
}
40
 
41
__attribute__((noinline)) short
42
vecsmin (void)
43
{
44
  int i;
45
  short r = 32767;
46
  for (i = 0; i < N; ++i)
47
    if (r > a[i]) r = a[i];
48
  return r;
49
}
50
 
51
__attribute__((noinline)) unsigned short
52
vecumin (void)
53
{
54
  int i;
55
  unsigned short r = 65535;
56
  for (i = 0; i < N; ++i)
57
    if (r > b[i]) r = b[i];
58
  return r;
59
}
60
 
61
static void
62
TEST (void)
63
{
64
  int i;
65
  for (i = 0; i < N; ++i)
66
    {
67
      a[i] = i - N / 2;
68
      b[i] = i + 32768 - N / 2;
69
    }
70
  a[N / 3] = N;
71
  a[2 * N / 3] = -N;
72
  b[N / 5] = 32768 + N;
73
  b[4 * N / 5] = 32768 - N;
74
  if (vecsmax () != N || vecsmin () != -N)
75
    abort ();
76
  if (vecumax () != 32768 + N || vecumin () != 32768 - N)
77
    abort ();
78
}

powered by: WebSVN 2.1.0

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