2 This testcase segfaulted on PPC because PIC_OFFSET_TABLE_REGNUM was no
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" } */
9 extern void exit (int);
11 #define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
12 #define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
13 #define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
14 #define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
15 #define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
16 #define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
20 static short iclip
[1024]; /* clipping table */
24 idct_int32(short *const block
)
28 static long X0
, X1
, X2
, X3
, X4
, X5
, X6
, X7
, X8
;
30 for (i
= 0; i
< 8; i
++) /* idct columns */
34 if (! ((X1
= (blk
[8 * 4] << 8)) | (X2
= blk
[8 * 6])
35 | (X3
= blk
[8 * 2]) | (X4
= blk
[8 * 1]) | (X5
= blk
[8 * 7])
36 | (X6
= blk
[8 * 5]) | (X7
= blk
[8 * 3])))
38 blk
[8 * 0] = blk
[8 * 1] = blk
[8 * 2] =
39 blk
[8 * 3] = blk
[8 * 4] =
40 blk
[8 * 5] = blk
[8 * 6] = blk
[8 * 7] =
41 iclp
[(blk
[8 * 0] + 32) >> 6];
44 X0
= (blk
[8 * 0] << 8) + 8192;
47 X8
= W7
* (X4
+ X5
) + 4;
48 X4
= (X8
+ (W1
- W7
) * X4
) >> 3;
49 X5
= (X8
- (W1
+ W7
) * X5
) >> 3;
50 X8
= W3
* (X6
+ X7
) + 4;
51 X6
= (X8
- (W3
- W5
) * X6
) >> 3;
52 X7
= (X8
- (W3
+ W5
) * X7
) >> 3;
57 X1
= W6
* (X3
+ X2
) + 4;
58 X2
= (X1
- (W2
+ W6
) * X2
) >> 3;
59 X3
= (X1
+ (W2
- W6
) * X3
) >> 3;
70 X2
= (181 * (X4
+ X5
) + 128) >> 8;
71 X4
= (181 * (X4
- X5
) + 128) >> 8;
74 blk
[8 * 0] = iclp
[(X7
+ X1
) >> 14];
75 blk
[8 * 1] = iclp
[(X3
+ X2
) >> 14];
76 blk
[8 * 2] = iclp
[(X0
+ X4
) >> 14];
77 blk
[8 * 3] = iclp
[(X8
+ X6
) >> 14];
78 blk
[8 * 4] = iclp
[(X8
- X6
) >> 14];
79 blk
[8 * 5] = iclp
[(X0
- X4
) >> 14];
80 blk
[8 * 6] = iclp
[(X3
- X2
) >> 14];
81 blk
[8 * 7] = iclp
[(X7
- X1
) >> 14];
83 } /* end function idct_int32(block) */
88 unsigned short tab
[64];
90 for (i
= 0 ; i
< 64 ; ++i
)
92 tab
[i
] = (1+(int) (65535)*8000/(2147483647+1.0));
96 for (i
= -512; i
< 512; i
++)
97 iclp
[i
] = (i
< -256) ? -256 : ((i
> 255) ? 255 : i
);
99 idct_int32((short *) tab
);