* config/xtensa/xtensa.c (function_arg): Generalize logic so that it
[official-gcc.git] / gcc / testsuite / gcc.dg / i386-loop-2.c
blob3a3e69e98b4f64a3f195eefca8d6785da4baf9a3
1 /* PR optimization/9888 */
2 /* Originator: Jim Bray <jb@as220.org> */
3 /* { dg-do run { target i?86-*-* } } */
4 /* { dg-options "-mtune=k6 -Os" } */
6 enum reload_type
8 RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN,
9 RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INPADDR_ADDRESS,
10 RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS,
11 RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR,
12 RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS
15 #define FOO_SIZE 3
17 /* My results, varying with FOO_SIZE:
18 30: asm error "value of ..fff77 too large:
19 3 to 29: ....ff7d...
20 1 to 2: no error. */
22 struct reload
24 int foo[FOO_SIZE];
25 int opnum;
26 enum reload_type when_needed;
27 unsigned int optional:1;
28 unsigned int secondary_p:1;
31 #define N_RELOADS 2
33 struct reload rld[N_RELOADS];
34 int n_reloads = N_RELOADS;
36 int main(void)
38 int i;
40 enum reload_type operand_type[1];
42 enum reload_type address_type[1];
44 int operand_reloadnum[1];
45 int goal_alternative_matches[1];
47 for (i = 0; i < n_reloads; i++)
49 if (rld[i].secondary_p
50 && rld[i].when_needed == operand_type[rld[i].opnum])
51 rld[i].when_needed = address_type[rld[i].opnum];
53 if ((rld[i].when_needed == RELOAD_FOR_INPUT_ADDRESS
54 || rld[i].when_needed == RELOAD_FOR_OUTPUT_ADDRESS
55 || rld[i].when_needed == RELOAD_FOR_INPADDR_ADDRESS
56 || rld[i].when_needed == RELOAD_FOR_OUTADDR_ADDRESS)
57 && (operand_reloadnum[rld[i].opnum] < 0
58 || rld[operand_reloadnum[rld[i].opnum]].optional))
61 if (rld[i].when_needed == RELOAD_FOR_INPADDR_ADDRESS
62 || rld[i].when_needed == RELOAD_FOR_OUTADDR_ADDRESS)
63 rld[i].when_needed = RELOAD_FOR_OPADDR_ADDR;
64 else
65 rld[i].when_needed = RELOAD_FOR_OPERAND_ADDRESS;
68 if ((rld[i].when_needed == RELOAD_FOR_INPUT_ADDRESS
69 || rld[i].when_needed == RELOAD_FOR_INPADDR_ADDRESS)
70 && operand_reloadnum[rld[i].opnum] >= 0
71 && (rld[operand_reloadnum[rld[i].opnum]].when_needed
72 == RELOAD_OTHER))
73 rld[i].when_needed = RELOAD_FOR_OTHER_ADDRESS;
75 if (goal_alternative_matches[rld[i].opnum] >= 0)
76 rld[i].opnum = goal_alternative_matches[rld[i].opnum];
79 return 0;