PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20020615-1.c
blob89bf7d046ab216b8465777ee5ee09f2818d84769
1 /* PR target/7042. When reorg.c changed branches into return insns, it
2 completely forgot about any current_function_epilogue_delay_list and
3 dropped those insns. Uncovered on cris-axis-elf, where an insn in an
4 epilogue delay-slot set the return-value register with the testcase
5 below. Derived from ghostscript-6.52 (GPL) by hp@axis.com. */
7 typedef struct font_hints_s {
8 int axes_swapped;
9 int x_inverted, y_inverted;
10 } font_hints;
11 typedef struct gs_fixed_point_s {
12 long x, y;
13 } gs_fixed_point;
15 int
16 line_hints(const font_hints *fh, const gs_fixed_point *p0,
17 const gs_fixed_point *p1)
19 long dx = p1->x - p0->x;
20 long dy = p1->y - p0->y;
21 long adx, ady;
22 int xi = fh->x_inverted, yi = fh->y_inverted;
23 int hints;
24 if (xi)
25 dx = -dx;
26 if (yi)
27 dy = -dy;
28 if (fh->axes_swapped) {
29 long t = dx;
30 int ti = xi;
31 dx = dy, xi = yi;
32 dy = t, yi = ti;
34 adx = dx < 0 ? -dx : dx;
35 ady = dy < 0 ? -dy : dy;
36 if (dy != 0 && (adx <= ady >> 4)) {
37 hints = dy > 0 ? 2 : 1;
38 if (xi)
39 hints ^= 3;
40 } else if (dx != 0 && (ady <= adx >> 4)) {
41 hints = dx < 0 ? 8 : 4;
42 if (yi)
43 hints ^= 12;
44 } else
45 hints = 0;
46 return hints;
48 int main ()
50 static font_hints fh[] = {{0, 1, 0}, {0, 0, 1}, {0, 0, 0}};
51 static gs_fixed_point gsf[]
52 = {{0x30000, 0x13958}, {0x30000, 0x18189},
53 {0x13958, 0x30000}, {0x18189, 0x30000}};
54 if (line_hints (fh, gsf, gsf + 1) != 1
55 || line_hints (fh + 1, gsf + 2, gsf + 3) != 8
56 || line_hints (fh + 2, gsf + 2, gsf + 3) != 4)
57 abort ();
58 exit (0);