mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-30 07:14:09 +08:00
Add tile generation algorithm fixes
From-SVN: r258522
This commit is contained in:
parent
d5e3c14d8c
commit
cfa2652126
@ -3482,12 +3482,12 @@ struct GTY(()) machine_function {
|
||||
\
|
||||
{2, 8, 8, "HI", (int[8]){0,8,2,10,4,12,6,14}, 1, "ILVEV.H", "RRR", NULL, NULL}, \
|
||||
{2, 8, 8, "HI", (int[8]){1,9,3,11,5,13,7,15}, 1, "ILVOD.H", "RRR", NULL, NULL}, \
|
||||
{2, 8, 8, "HI", (int[8]){0,2,4,6,8,10,12,14}, 1, "PCKEV.H", "RRR", NULL, NULL}, \
|
||||
/*{2, 8, 8, "HI", (int[8]){0,2,4,6,8,10,12,14}, 1, "PCKEV.H", "RRR", NULL, NULL}, \
|
||||
{2, 8, 8, "HI", (int[8]){1,3,5,7,9,11,13,15}, 1, "PCKOD.H", "RRR", NULL, NULL}, \
|
||||
{2, 8, 8, "HI", (int[8]){0,8,1,9,2,10,3,11}, 1, "ILVR.H", "RRR", NULL, NULL}, \
|
||||
{2, 8, 8, "HI", (int[8]){4,12,5,13,6,14,7,15}, 1, "ILVL.H", "RRR", NULL, NULL}, \
|
||||
\
|
||||
/*{2, 16, 16, "QI", (int[16]){0,16,2,18,4,20,6,22,8,24,10,26,12,28,14,30}, 1, \
|
||||
{2, 16, 16, "QI", (int[16]){0,16,2,18,4,20,6,22,8,24,10,26,12,28,14,30}, 1, \
|
||||
"ILVEV.Q", "RRR", NULL, NULL}, \
|
||||
{2, 16, 16, "QI", (int[16]){1,17,3,19,5,21,7,23,9,25,11,27,13,29,15,31}, 1, \
|
||||
"ILVOD.Q", "RRR", NULL, NULL}, \
|
||||
|
@ -762,15 +762,10 @@ create_rule_for_ptree (struct primop_tree *ptree, int spec_idx, int out_vecsize,
|
||||
if (spec_idx != -1)
|
||||
{
|
||||
sprintf (buf, "reg_%s", type_name[type]);
|
||||
sprintf (buf1, "mem_%s", type_name[type]);
|
||||
sprintf (buf2, "const_%s", type_name[type]);
|
||||
|
||||
ruleno = create_rule_NT_to_NT (
|
||||
target_type == 'R' ?
|
||||
create_non_terminal (buf, type) :
|
||||
target_type == 'M' ?
|
||||
create_non_terminal (buf1, type) :
|
||||
create_non_terminal (buf2, type), nt, -1, 0);
|
||||
create_non_terminal (buf, type),
|
||||
nt, -1, 0);
|
||||
}
|
||||
return nt;
|
||||
}
|
||||
@ -1664,10 +1659,10 @@ print_trans_map ()
|
||||
for (j = 0; j < op_list.length (); j++)
|
||||
{
|
||||
if (op_list[j]->pcode == POP_ILV)
|
||||
printf (" int %s_%s_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[i]->type],
|
||||
printf (" int %s_%s_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[j]->type],
|
||||
op_list[j]->arity);
|
||||
else
|
||||
printf (" int %s_%s_%d_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[i]->type],
|
||||
printf (" int %s_%s_%d_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[j]->type],
|
||||
op_list[j]->arity, op_list[j]->sel);
|
||||
|
||||
for (k = 0; k < op_list[j]->act_arity; k++)
|
||||
@ -1682,10 +1677,10 @@ print_trans_map ()
|
||||
for (j = 0; j < op_list.length (); j++)
|
||||
{
|
||||
if (op_list[j]->pcode == POP_ILV)
|
||||
sprintf (str, " transition.%s__%s_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[i]->type],
|
||||
sprintf (str, " transition.%s_%s_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[j]->type],
|
||||
op_list[j]->arity);
|
||||
else
|
||||
sprintf (str, " transition.%s_%s_%d_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[i]->type],
|
||||
sprintf (str, " transition.%s_%s_%d_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[j]->type],
|
||||
op_list[j]->arity, op_list[j]->sel);
|
||||
|
||||
for (i = 0; i < op_list[j]->index_map.length (); i++)
|
||||
@ -1750,15 +1745,25 @@ print_terminals ()
|
||||
printf ("}\n\n");
|
||||
}
|
||||
|
||||
printf ("int get_REG_terminal_state (int vector_size)\n{\n");
|
||||
printf (" switch (vector_size)\n {\n");
|
||||
for (i = 1; i <= floor_log2 (MAX_VECTOR_SIZE); i++)
|
||||
printf ("int get_REG_terminal_state (int type)\n{\n");
|
||||
printf (" switch (type)\n {\n");
|
||||
for (i = 0; i < type_name.length (); i++)
|
||||
{
|
||||
printf ("case %d: return get_REG_%d_terminal_state ();\n",
|
||||
(1 << i), (1 << i));
|
||||
printf ("case %smode: return get_REG_%s_terminal_state ();\n",type_name[i], type_name[i]);
|
||||
}
|
||||
printf (" default:\n gcc_assert (!\"vector size not supported\");\n");
|
||||
printf (" default:\n gcc_assert (!\"Type not supported\");\n");
|
||||
printf (" }\n}\n\n");
|
||||
|
||||
printf ("int get_CONST_terminal_state (int type)\n{\n");
|
||||
printf (" switch (type)\n {\n");
|
||||
for (i = 0; i < type_name.length (); i++)
|
||||
{
|
||||
printf ("case %smode: return get_CONST_%s_terminal_state ();\n",type_name[i], type_name[i]);
|
||||
}
|
||||
printf (" default:\n gcc_assert (!\"Type not supported\");\n");
|
||||
printf (" }\n}\n\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@ -1865,13 +1870,14 @@ print_state_fn_for_ilv ()
|
||||
int i, j;
|
||||
char *str = (char *) xcalloc (100, sizeof (char));
|
||||
printf ("int\ntransition_state_for_ilv");
|
||||
printf (" (int act_arity, vec<int> state_idx)\n{\n");
|
||||
printf (" (int act_arity, vec<int> state_idx, int type)\n{\n");
|
||||
|
||||
for (i = 0; i < op_list.length (); i++)
|
||||
{
|
||||
if (op_list[i]->pcode == POP_ILV)
|
||||
{
|
||||
printf (" if (act_arity == %d)\n {\n", op_list[i]->arity);
|
||||
printf (" if (act_arity == %d && type == %smode)\n {\n", op_list[i]->arity, type_name[op_list[i]->type]);
|
||||
sprintf (str, "");
|
||||
for (j = 0; j < op_list[i]->act_arity; j++)
|
||||
{
|
||||
printf ("\tif (rep_state_map[MAP_OP_ILV_%s_%d_%d]",
|
||||
@ -1896,15 +1902,15 @@ print_state_fn_for_extr ()
|
||||
int i;
|
||||
|
||||
printf ("int\ntransition_state_for_extr");
|
||||
printf (" (int act_arity, int sel, int state_idx)\n{\n");
|
||||
printf (" (int act_arity, int sel, int state_idx, int type)\n{\n");
|
||||
|
||||
for (i = 0; i < op_list.length (); i++)
|
||||
{
|
||||
if (op_list[i]->pcode == POP_EXTR)
|
||||
{
|
||||
printf (" if (act_arity == %d && sel == %d)\n {\n",
|
||||
printf (" if (act_arity == %d && sel == %d && type == %smode)\n {\n",
|
||||
op_list[i]->arity,
|
||||
op_list[i]->sel);
|
||||
op_list[i]->sel, type_name[op_list[i]->type]);
|
||||
printf (" if (rep_state_map[MAP_OP_EXTR_%s_%d_%d]",
|
||||
type_name[op_list[i]->type], op_list[i]->arity, op_list[i]->sel);
|
||||
printf ("[state_idx] == -1)\n");
|
||||
|
@ -2415,7 +2415,7 @@ get_transition_state (struct primop_tree *ptree)
|
||||
registers. */
|
||||
if (PT_NODE_OP (ptree) < MAX_TREE_CODES)
|
||||
{
|
||||
return get_REG_terminal_state (GET_MODE_SIZE (TYPE_MODE (PT_VEC_TYPE (ptree))));
|
||||
return get_REG_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree))));
|
||||
}
|
||||
|
||||
/* We need not handle POP_PH as it is only for tile construction. POP_CONCAT
|
||||
@ -2434,12 +2434,12 @@ get_transition_state (struct primop_tree *ptree)
|
||||
PT_AUX (get_child_at_index (ptree, i)));
|
||||
}
|
||||
|
||||
return transition_state_for_ilv (PT_DIVISION (ptree), idx);
|
||||
return transition_state_for_ilv (PT_DIVISION (ptree), idx, GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree))));
|
||||
|
||||
case POP_EXTR:
|
||||
return transition_state_for_extr (PT_DIVISION (ptree),
|
||||
PT_OPERAND_SELECTOR (ptree),
|
||||
PT_AUX (get_child_at_index (ptree, 0)));
|
||||
PT_AUX (get_child_at_index (ptree, 0)), GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree))));
|
||||
|
||||
default:
|
||||
gcc_assert (!"Operator not handled.");
|
||||
@ -2458,11 +2458,11 @@ label_permute_tree (struct primop_tree *ptree)
|
||||
switch (PT_NODE_OP (ptree))
|
||||
{
|
||||
case POP_MEMREF:
|
||||
PT_AUX (ptree) = get_REG_terminal_state (GET_MODE_SIZE (TYPE_MODE (PT_VEC_TYPE (ptree))));
|
||||
PT_AUX (ptree) = get_REG_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree))));
|
||||
printf ("tree : %d >> state : %d\n", PT_PID (ptree), PT_AUX (ptree));
|
||||
break;
|
||||
case POP_CONST:
|
||||
PT_AUX (ptree) = get_CONST_terminal_state ();
|
||||
PT_AUX (ptree) = get_CONST_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree))));
|
||||
printf ("tree : %d >> state : %d\n", PT_PID (ptree), PT_AUX (ptree));
|
||||
break;
|
||||
default:
|
||||
@ -2487,7 +2487,7 @@ label_permute_tree (struct primop_tree *ptree)
|
||||
if (PT_AUX (ptree) == -1)
|
||||
{
|
||||
printf ("\n labeled to REG\n");
|
||||
PT_AUX (ptree) = (get_REG_terminal_state (GET_MODE_SIZE (TYPE_MODE (PT_VEC_TYPE (ptree)))));
|
||||
PT_AUX (ptree) = (get_REG_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree)))));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2538,7 +2538,7 @@ unified_perm_tree_code_generation (struct ITER_node *inode)
|
||||
reset_aux_field (tmp_tree);
|
||||
ret = label_permute_tree (tmp_tree);
|
||||
if (ret == true)
|
||||
ret = reduce_permute_tree (tmp_tree, get_REG_terminal_state (GET_MODE_SIZE (TYPE_MODE (PT_VEC_TYPE (tmp_tree)))));
|
||||
ret = reduce_permute_tree (tmp_tree, get_REG_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (tmp_tree)))));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -364,11 +364,11 @@ extern inline void set_stmt_attr (gimple *, struct stmt_attr *);
|
||||
extern inline struct stmt_attr *get_stmt_attr (gimple *);
|
||||
extern struct primop_tree * unity_redundancy_elimination (struct primop_tree *);
|
||||
extern void unif_vect_init_funct (void);
|
||||
extern vec<int> transition_state_for_extr (int, int, int);
|
||||
extern vec<int> transition_state_for_ilv (int, vec<int>);
|
||||
extern int transition_state_for_extr (int, int, int, int);
|
||||
extern int transition_state_for_ilv (int, vec<int>, int);
|
||||
extern int get_REG_terminal_state (int);
|
||||
extern bool is_NT2T_rule (int);
|
||||
extern int get_CONST_terminal_state ();
|
||||
extern int get_CONST_terminal_state (int);
|
||||
extern int get_MEM_terminal_state ();
|
||||
//extern int get_goal_nonterminal_state (int);
|
||||
extern int get_rule_number (struct primop_tree *, int);
|
||||
|
Loading…
Reference in New Issue
Block a user