GCC with patches for OS216
Revision | cfa26521266eba7c7574a09139c9353824990ca2 (tree) |
---|---|
Zeit | 2018-03-14 20:22:05 |
Autor | Sameera Deshpande <sameerad@gcc....> |
Commiter | Sameera Deshpande |
Add tile generation algorithm fixes
From-SVN: r258522
@@ -3482,12 +3482,12 @@ struct GTY(()) machine_function { | ||
3482 | 3482 | \ |
3483 | 3483 | {2, 8, 8, "HI", (int[8]){0,8,2,10,4,12,6,14}, 1, "ILVEV.H", "RRR", NULL, NULL}, \ |
3484 | 3484 | {2, 8, 8, "HI", (int[8]){1,9,3,11,5,13,7,15}, 1, "ILVOD.H", "RRR", NULL, NULL}, \ |
3485 | - {2, 8, 8, "HI", (int[8]){0,2,4,6,8,10,12,14}, 1, "PCKEV.H", "RRR", NULL, NULL}, \ | |
3485 | + /*{2, 8, 8, "HI", (int[8]){0,2,4,6,8,10,12,14}, 1, "PCKEV.H", "RRR", NULL, NULL}, \ | |
3486 | 3486 | {2, 8, 8, "HI", (int[8]){1,3,5,7,9,11,13,15}, 1, "PCKOD.H", "RRR", NULL, NULL}, \ |
3487 | 3487 | {2, 8, 8, "HI", (int[8]){0,8,1,9,2,10,3,11}, 1, "ILVR.H", "RRR", NULL, NULL}, \ |
3488 | 3488 | {2, 8, 8, "HI", (int[8]){4,12,5,13,6,14,7,15}, 1, "ILVL.H", "RRR", NULL, NULL}, \ |
3489 | 3489 | \ |
3490 | - /*{2, 16, 16, "QI", (int[16]){0,16,2,18,4,20,6,22,8,24,10,26,12,28,14,30}, 1, \ | |
3490 | + {2, 16, 16, "QI", (int[16]){0,16,2,18,4,20,6,22,8,24,10,26,12,28,14,30}, 1, \ | |
3491 | 3491 | "ILVEV.Q", "RRR", NULL, NULL}, \ |
3492 | 3492 | {2, 16, 16, "QI", (int[16]){1,17,3,19,5,21,7,23,9,25,11,27,13,29,15,31}, 1, \ |
3493 | 3493 | "ILVOD.Q", "RRR", NULL, NULL}, \ |
@@ -762,15 +762,10 @@ create_rule_for_ptree (struct primop_tree *ptree, int spec_idx, int out_vecsize, | ||
762 | 762 | if (spec_idx != -1) |
763 | 763 | { |
764 | 764 | sprintf (buf, "reg_%s", type_name[type]); |
765 | - sprintf (buf1, "mem_%s", type_name[type]); | |
766 | - sprintf (buf2, "const_%s", type_name[type]); | |
767 | 765 | |
768 | 766 | ruleno = create_rule_NT_to_NT ( |
769 | - target_type == 'R' ? | |
770 | - create_non_terminal (buf, type) : | |
771 | - target_type == 'M' ? | |
772 | - create_non_terminal (buf1, type) : | |
773 | - create_non_terminal (buf2, type), nt, -1, 0); | |
767 | + create_non_terminal (buf, type), | |
768 | + nt, -1, 0); | |
774 | 769 | } |
775 | 770 | return nt; |
776 | 771 | } |
@@ -1664,10 +1659,10 @@ print_trans_map () | ||
1664 | 1659 | for (j = 0; j < op_list.length (); j++) |
1665 | 1660 | { |
1666 | 1661 | if (op_list[j]->pcode == POP_ILV) |
1667 | - printf (" int %s_%s_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[i]->type], | |
1662 | + printf (" int %s_%s_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[j]->type], | |
1668 | 1663 | op_list[j]->arity); |
1669 | 1664 | else |
1670 | - printf (" int %s_%s_%d_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[i]->type], | |
1665 | + printf (" int %s_%s_%d_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[j]->type], | |
1671 | 1666 | op_list[j]->arity, op_list[j]->sel); |
1672 | 1667 | |
1673 | 1668 | for (k = 0; k < op_list[j]->act_arity; k++) |
@@ -1682,10 +1677,10 @@ print_trans_map () | ||
1682 | 1677 | for (j = 0; j < op_list.length (); j++) |
1683 | 1678 | { |
1684 | 1679 | if (op_list[j]->pcode == POP_ILV) |
1685 | - sprintf (str, " transition.%s__%s_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[i]->type], | |
1680 | + sprintf (str, " transition.%s_%s_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[j]->type], | |
1686 | 1681 | op_list[j]->arity); |
1687 | 1682 | else |
1688 | - sprintf (str, " transition.%s_%s_%d_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[i]->type], | |
1683 | + sprintf (str, " transition.%s_%s_%d_%d", tree_code_name[op_list[j]->pcode], type_name[op_list[j]->type], | |
1689 | 1684 | op_list[j]->arity, op_list[j]->sel); |
1690 | 1685 | |
1691 | 1686 | for (i = 0; i < op_list[j]->index_map.length (); i++) |
@@ -1750,15 +1745,25 @@ print_terminals () | ||
1750 | 1745 | printf ("}\n\n"); |
1751 | 1746 | } |
1752 | 1747 | |
1753 | - printf ("int get_REG_terminal_state (int vector_size)\n{\n"); | |
1754 | - printf (" switch (vector_size)\n {\n"); | |
1755 | - for (i = 1; i <= floor_log2 (MAX_VECTOR_SIZE); i++) | |
1748 | + printf ("int get_REG_terminal_state (int type)\n{\n"); | |
1749 | + printf (" switch (type)\n {\n"); | |
1750 | + for (i = 0; i < type_name.length (); i++) | |
1751 | + { | |
1752 | + printf ("case %smode: return get_REG_%s_terminal_state ();\n",type_name[i], type_name[i]); | |
1753 | + } | |
1754 | + printf (" default:\n gcc_assert (!\"Type not supported\");\n"); | |
1755 | + printf (" }\n}\n\n"); | |
1756 | + | |
1757 | + printf ("int get_CONST_terminal_state (int type)\n{\n"); | |
1758 | + printf (" switch (type)\n {\n"); | |
1759 | + for (i = 0; i < type_name.length (); i++) | |
1756 | 1760 | { |
1757 | - printf ("case %d: return get_REG_%d_terminal_state ();\n", | |
1758 | - (1 << i), (1 << i)); | |
1761 | + printf ("case %smode: return get_CONST_%s_terminal_state ();\n",type_name[i], type_name[i]); | |
1759 | 1762 | } |
1760 | - printf (" default:\n gcc_assert (!\"vector size not supported\");\n"); | |
1763 | + printf (" default:\n gcc_assert (!\"Type not supported\");\n"); | |
1761 | 1764 | printf (" }\n}\n\n"); |
1765 | + | |
1766 | + | |
1762 | 1767 | } |
1763 | 1768 | |
1764 | 1769 | void |
@@ -1865,13 +1870,14 @@ print_state_fn_for_ilv () | ||
1865 | 1870 | int i, j; |
1866 | 1871 | char *str = (char *) xcalloc (100, sizeof (char)); |
1867 | 1872 | printf ("int\ntransition_state_for_ilv"); |
1868 | - printf (" (int act_arity, vec<int> state_idx)\n{\n"); | |
1873 | + printf (" (int act_arity, vec<int> state_idx, int type)\n{\n"); | |
1869 | 1874 | |
1870 | 1875 | for (i = 0; i < op_list.length (); i++) |
1871 | 1876 | { |
1872 | 1877 | if (op_list[i]->pcode == POP_ILV) |
1873 | 1878 | { |
1874 | - printf (" if (act_arity == %d)\n {\n", op_list[i]->arity); | |
1879 | + printf (" if (act_arity == %d && type == %smode)\n {\n", op_list[i]->arity, type_name[op_list[i]->type]); | |
1880 | + sprintf (str, ""); | |
1875 | 1881 | for (j = 0; j < op_list[i]->act_arity; j++) |
1876 | 1882 | { |
1877 | 1883 | printf ("\tif (rep_state_map[MAP_OP_ILV_%s_%d_%d]", |
@@ -1896,15 +1902,15 @@ print_state_fn_for_extr () | ||
1896 | 1902 | int i; |
1897 | 1903 | |
1898 | 1904 | printf ("int\ntransition_state_for_extr"); |
1899 | - printf (" (int act_arity, int sel, int state_idx)\n{\n"); | |
1905 | + printf (" (int act_arity, int sel, int state_idx, int type)\n{\n"); | |
1900 | 1906 | |
1901 | 1907 | for (i = 0; i < op_list.length (); i++) |
1902 | 1908 | { |
1903 | 1909 | if (op_list[i]->pcode == POP_EXTR) |
1904 | 1910 | { |
1905 | - printf (" if (act_arity == %d && sel == %d)\n {\n", | |
1911 | + printf (" if (act_arity == %d && sel == %d && type == %smode)\n {\n", | |
1906 | 1912 | op_list[i]->arity, |
1907 | - op_list[i]->sel); | |
1913 | + op_list[i]->sel, type_name[op_list[i]->type]); | |
1908 | 1914 | printf (" if (rep_state_map[MAP_OP_EXTR_%s_%d_%d]", |
1909 | 1915 | type_name[op_list[i]->type], op_list[i]->arity, op_list[i]->sel); |
1910 | 1916 | printf ("[state_idx] == -1)\n"); |
@@ -2415,7 +2415,7 @@ get_transition_state (struct primop_tree *ptree) | ||
2415 | 2415 | registers. */ |
2416 | 2416 | if (PT_NODE_OP (ptree) < MAX_TREE_CODES) |
2417 | 2417 | { |
2418 | - return get_REG_terminal_state (GET_MODE_SIZE (TYPE_MODE (PT_VEC_TYPE (ptree)))); | |
2418 | + return get_REG_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree)))); | |
2419 | 2419 | } |
2420 | 2420 | |
2421 | 2421 | /* 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) | ||
2434 | 2434 | PT_AUX (get_child_at_index (ptree, i))); |
2435 | 2435 | } |
2436 | 2436 | |
2437 | - return transition_state_for_ilv (PT_DIVISION (ptree), idx); | |
2437 | + return transition_state_for_ilv (PT_DIVISION (ptree), idx, GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree)))); | |
2438 | 2438 | |
2439 | 2439 | case POP_EXTR: |
2440 | 2440 | return transition_state_for_extr (PT_DIVISION (ptree), |
2441 | 2441 | PT_OPERAND_SELECTOR (ptree), |
2442 | - PT_AUX (get_child_at_index (ptree, 0))); | |
2442 | + PT_AUX (get_child_at_index (ptree, 0)), GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree)))); | |
2443 | 2443 | |
2444 | 2444 | default: |
2445 | 2445 | gcc_assert (!"Operator not handled."); |
@@ -2458,11 +2458,11 @@ label_permute_tree (struct primop_tree *ptree) | ||
2458 | 2458 | switch (PT_NODE_OP (ptree)) |
2459 | 2459 | { |
2460 | 2460 | case POP_MEMREF: |
2461 | - PT_AUX (ptree) = get_REG_terminal_state (GET_MODE_SIZE (TYPE_MODE (PT_VEC_TYPE (ptree)))); | |
2461 | + PT_AUX (ptree) = get_REG_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree)))); | |
2462 | 2462 | printf ("tree : %d >> state : %d\n", PT_PID (ptree), PT_AUX (ptree)); |
2463 | 2463 | break; |
2464 | 2464 | case POP_CONST: |
2465 | - PT_AUX (ptree) = get_CONST_terminal_state (); | |
2465 | + PT_AUX (ptree) = get_CONST_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree)))); | |
2466 | 2466 | printf ("tree : %d >> state : %d\n", PT_PID (ptree), PT_AUX (ptree)); |
2467 | 2467 | break; |
2468 | 2468 | default: |
@@ -2487,7 +2487,7 @@ label_permute_tree (struct primop_tree *ptree) | ||
2487 | 2487 | if (PT_AUX (ptree) == -1) |
2488 | 2488 | { |
2489 | 2489 | printf ("\n labeled to REG\n"); |
2490 | - PT_AUX (ptree) = (get_REG_terminal_state (GET_MODE_SIZE (TYPE_MODE (PT_VEC_TYPE (ptree))))); | |
2490 | + PT_AUX (ptree) = (get_REG_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (ptree))))); | |
2491 | 2491 | } |
2492 | 2492 | else |
2493 | 2493 | { |
@@ -2538,7 +2538,7 @@ unified_perm_tree_code_generation (struct ITER_node *inode) | ||
2538 | 2538 | reset_aux_field (tmp_tree); |
2539 | 2539 | ret = label_permute_tree (tmp_tree); |
2540 | 2540 | if (ret == true) |
2541 | - ret = reduce_permute_tree (tmp_tree, get_REG_terminal_state (GET_MODE_SIZE (TYPE_MODE (PT_VEC_TYPE (tmp_tree))))); | |
2541 | + ret = reduce_permute_tree (tmp_tree, get_REG_terminal_state (GET_MODE_INNER (TYPE_MODE (PT_VEC_TYPE (tmp_tree))))); | |
2542 | 2542 | |
2543 | 2543 | return ret; |
2544 | 2544 | } |
@@ -364,11 +364,11 @@ extern inline void set_stmt_attr (gimple *, struct stmt_attr *); | ||
364 | 364 | extern inline struct stmt_attr *get_stmt_attr (gimple *); |
365 | 365 | extern struct primop_tree * unity_redundancy_elimination (struct primop_tree *); |
366 | 366 | extern void unif_vect_init_funct (void); |
367 | -extern vec<int> transition_state_for_extr (int, int, int); | |
368 | -extern vec<int> transition_state_for_ilv (int, vec<int>); | |
367 | +extern int transition_state_for_extr (int, int, int, int); | |
368 | +extern int transition_state_for_ilv (int, vec<int>, int); | |
369 | 369 | extern int get_REG_terminal_state (int); |
370 | 370 | extern bool is_NT2T_rule (int); |
371 | -extern int get_CONST_terminal_state (); | |
371 | +extern int get_CONST_terminal_state (int); | |
372 | 372 | extern int get_MEM_terminal_state (); |
373 | 373 | //extern int get_goal_nonterminal_state (int); |
374 | 374 | extern int get_rule_number (struct primop_tree *, int); |