| 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 [email protected]. */ |
| 6 |
|
| 7 |
void abort (void); |
| 8 |
void exit (int); |
| 9 |
|
| 10 |
typedef struct font_hints_s { |
| 11 |
int axes_swapped; |
| 12 |
int x_inverted, y_inverted; |
| 13 |
} font_hints; |
| 14 |
typedef struct gs_fixed_point_s { |
| 15 |
long x, y; |
| 16 |
} gs_fixed_point; |
| 17 |
|
| 18 |
int |
| 19 |
line_hints(const font_hints *fh, const gs_fixed_point *p0, |
| 20 |
const gs_fixed_point *p1) |
| 21 |
{ |
| 22 |
long dx = p1->x - p0->x; |
| 23 |
long dy = p1->y - p0->y; |
| 24 |
long adx, ady; |
| 25 |
int xi = fh->x_inverted, yi = fh->y_inverted; |
| 26 |
int hints; |
| 27 |
if (xi) |
| 28 |
dx = -dx; |
| 29 |
if (yi) |
| 30 |
dy = -dy; |
| 31 |
if (fh->axes_swapped) { |
| 32 |
long t = dx; |
| 33 |
int ti = xi; |
| 34 |
dx = dy, xi = yi; |
| 35 |
dy = t, yi = ti; |
| 36 |
} |
| 37 |
adx = dx < 0 ? -dx : dx; |
| 38 |
ady = dy < 0 ? -dy : dy; |
| 39 |
if (dy != 0 && (adx <= ady >> 4)) { |
| 40 |
hints = dy > 0 ? 2 : 1; |
| 41 |
if (xi) |
| 42 |
hints ^= 3; |
| 43 |
} else if (dx != 0 && (ady <= adx >> 4)) { |
| 44 |
hints = dx < 0 ? 8 : 4; |
| 45 |
if (yi) |
| 46 |
hints ^= 12; |
| 47 |
} else |
| 48 |
hints = 0; |
| 49 |
return hints; |
| 50 |
} |
| 51 |
int main () |
| 52 |
{ |
| 53 |
static font_hints fh[] = {{0, 1, 0}, {0, 0, 1}, {0, 0, 0}}; |
| 54 |
static gs_fixed_point gsf[] |
| 55 |
= {{0x30000, 0x13958}, {0x30000, 0x18189}, |
| 56 |
{0x13958, 0x30000}, {0x18189, 0x30000}}; |
| 57 |
if (line_hints (fh, gsf, gsf + 1) != 1 |
| 58 |
|| line_hints (fh + 1, gsf + 2, gsf + 3) != 8 |
| 59 |
|| line_hints (fh + 2, gsf + 2, gsf + 3) != 4) |
| 60 |
abort (); |
| 61 |
exit (0); |
| 62 |
} |