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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.dg/] [20030225-1.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* PR target/9732
2
   This testcase segfaulted on PPC because PIC_OFFSET_TABLE_REGNUM was no
3
   fixed register.
4
   Distilled from the xvid sources by Guillaume Morin <guillaume@morinfr.org>
5
   and Benjamin Herrenschmidt <benh@kernel.crashing.org>.  */
6
/* { dg-do run { target fpic } } */
7
/* { dg-options "-O2 -fPIC" } */
8
/* { dg-bogus "\[Uu\]nresolved symbol .(_GLOBAL_OFFSET_TABLE_|\[_.A-Za-z\]\[_.0-9A-Za-z\]*@(PLT|GOT|GOTOFF))" "PIC unsupported" { xfail *-*-netware* } 0 } */
9
 
10
extern void exit (int);
11
 
12
#define W1 2841                                 /* 2048*sqrt(2)*cos(1*pi/16) */
13
#define W2 2676                                 /* 2048*sqrt(2)*cos(2*pi/16) */
14
#define W3 2408                                 /* 2048*sqrt(2)*cos(3*pi/16) */
15
#define W5 1609                                 /* 2048*sqrt(2)*cos(5*pi/16) */
16
#define W6 1108                                 /* 2048*sqrt(2)*cos(6*pi/16) */
17
#define W7 565                                  /* 2048*sqrt(2)*cos(7*pi/16) */
18
 
19
 
20
/* private data */
21
static short iclip[1024];               /* clipping table */
22
static short *iclp;
23
 
24
void
25
idct_int32(short *const block)
26
{
27
  static short *blk;
28
  static long i;
29
  static long X0, X1, X2, X3, X4, X5, X6, X7, X8;
30
 
31
  for (i = 0; i < 8; i++)                /* idct columns */
32
    {
33
      blk = block + i;
34
      /* shortcut  */
35
      if (! ((X1 = (blk[8 * 4] << 8)) | (X2 = blk[8 * 6])
36
             | (X3 = blk[8 * 2]) | (X4 = blk[8 * 1]) | (X5 = blk[8 * 7])
37
             | (X6 = blk[8 * 5]) | (X7 = blk[8 * 3])))
38
        {
39
          blk[8 * 0] = blk[8 * 1] = blk[8 * 2] =
40
            blk[8 * 3] = blk[8 * 4] =
41
            blk[8 * 5] = blk[8 * 6] = blk[8 * 7] =
42
            iclp[(blk[8 * 0] + 32) >> 6];
43
          continue;
44
        }
45
      X0 = (blk[8 * 0] << 8) + 8192;
46
 
47
      /* first stage  */
48
      X8 = W7 * (X4 + X5) + 4;
49
      X4 = (X8 + (W1 - W7) * X4) >> 3;
50
      X5 = (X8 - (W1 + W7) * X5) >> 3;
51
      X8 = W3 * (X6 + X7) + 4;
52
      X6 = (X8 - (W3 - W5) * X6) >> 3;
53
      X7 = (X8 - (W3 + W5) * X7) >> 3;
54
 
55
      /* second stage  */
56
      X8 = X0 + X1;
57
      X0 -= X1;
58
      X1 = W6 * (X3 + X2) + 4;
59
      X2 = (X1 - (W2 + W6) * X2) >> 3;
60
      X3 = (X1 + (W2 - W6) * X3) >> 3;
61
      X1 = X4 + X6;
62
      X4 -= X6;
63
      X6 = X5 + X7;
64
      X5 -= X7;
65
 
66
      /* third stage  */
67
      X7 = X8 + X3;
68
      X8 -= X3;
69
      X3 = X0 + X2;
70
      X0 -= X2;
71
      X2 = (181 * (X4 + X5) + 128) >> 8;
72
      X4 = (181 * (X4 - X5) + 128) >> 8;
73
 
74
      /* fourth stage  */
75
      blk[8 * 0] = iclp[(X7 + X1) >> 14];
76
      blk[8 * 1] = iclp[(X3 + X2) >> 14];
77
      blk[8 * 2] = iclp[(X0 + X4) >> 14];
78
      blk[8 * 3] = iclp[(X8 + X6) >> 14];
79
      blk[8 * 4] = iclp[(X8 - X6) >> 14];
80
      blk[8 * 5] = iclp[(X0 - X4) >> 14];
81
      blk[8 * 6] = iclp[(X3 - X2) >> 14];
82
      blk[8 * 7] = iclp[(X7 - X1) >> 14];
83
    }
84
}                                                               /* end function idct_int32(block) */
85
 
86
 
87
int main(void) {
88
  int i;
89
  unsigned short tab[64];
90
 
91
  for (i = 0 ; i < 64 ; ++i)
92
    {
93
      tab[i] = (1+(int) (65535)*8000/(2147483647+1.0));
94
    }
95
 
96
  iclp = iclip + 512;
97
  for (i = -512; i < 512; i++)
98
    iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
99
 
100
  idct_int32((short *) tab);
101
  exit (0);
102
}

powered by: WebSVN 2.1.0

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