1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" } { "-mcpu=power6" } } */
3 /* { dg-additional-options "-O3 -mcpu=power6 -mno-power9-vector -mno-power8-vector -mno-vsx" } */
4 
5 enum reg_class
6 {
7   NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, XGRF_REGS, ALL_REGS,
8     LIM_REG_CLASSES
9 };
10 enum machine_mode
11 {
12   VOIDmode, QImode, HImode, PSImode, SImode, PDImode, DImode, TImode, OImode,
13     QFmode, HFmode, TQFmode, SFmode, DFmode, XFmode, TFmode, SCmode, DCmode,
14     XCmode, TCmode, CQImode, CHImode, CSImode, CDImode, CTImode, COImode,
15     BLKmode, CCmode, CCEVENmode, MAX_MACHINE_MODE
16 };
17 typedef struct rtx_def
18 {
19   int mode:8;
20 }
21  *rtx;
22 extern rtx *regno_reg_rtx;
23 typedef unsigned int HARD_REG_ELT_TYPE;
24 typedef HARD_REG_ELT_TYPE HARD_REG_SET[((64 + 32 - 1) / 32)];
25 extern int reg_alloc_order[64];
26 extern int max_regno;
27 extern int *reg_n_calls_crossed;
28 extern short *reg_renumber;
29 static int *reg_where_dead;
30 static int *reg_where_born;
31 static int *reg_order;
32 static char *regs_change_size;
33 static HARD_REG_SET *after_insn_hard_regs;
34 static int stupid_find_reg (int, enum reg_class, enum machine_mode, int, int,
35 			    int);
36 enum reg_class reg_preferred_class (int);
37 void
stupid_life_analysis(f,nregs,file)38 stupid_life_analysis (f, nregs, file)
39      int nregs, file;
40      rtx f;
41 {
42   register int i;
43   for (i = (((64)) + 3) + 1; i < max_regno; i++)
44     {
45       register int r = reg_order[i];
46       if ((int) LIM_REG_CLASSES > 1)
47 	reg_renumber[r] =
48 	  stupid_find_reg (reg_n_calls_crossed[r], reg_preferred_class (r),
49 			   ((regno_reg_rtx[r])->mode), reg_where_born[r],
50 			   reg_where_dead[r], regs_change_size[r]);
51     }
52 }
53 
54 static int
stupid_find_reg(call_preserved,class,mode,born_insn,dead_insn,changes_size)55 stupid_find_reg (call_preserved, class, mode, born_insn, dead_insn,
56 		 changes_size)
57      int call_preserved, born_insn, dead_insn, changes_size;
58      enum reg_class class;
59      enum machine_mode mode;
60 {
61   register int i, ins;
62   HARD_REG_SET used, this_reg;
63   for (ins = born_insn; ins < dead_insn; ins++)
64     do
65       {
66 	register HARD_REG_ELT_TYPE *scan_tp_ = (used), *scan_fp_ =
67 	  (after_insn_hard_regs[ins]);
68 	for (i = 0; i < ((64 + 32 - 1) / 32); i++)
69 	  *scan_tp_++ |= *scan_fp_++;
70       }
71     while (0);
72   for (i = 0; i < 64; i++)
73     {
74       int regno = reg_alloc_order[i];
75       if (((used)[(regno) / ((unsigned) 32)] &
76 	   (((HARD_REG_ELT_TYPE) (1)) << ((regno) % ((unsigned) 32)))))
77 	{
78 	  register int j;
79 	  if (j == regno)
80 	    return regno;
81 	}
82     }
83 }
84 
85