Date: Fri, 12 Oct 2018 07:44:49 -0700 From: Mark Millard <marklmi@yahoo.com> To: FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD Ports ML <freebsd-ports@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org> Cc: gerald@FreeBSD.org Subject: Two example patches: enable powerpc64 builds of devel/powerpc64-gcc and lang/gcc8 via system-clang ( avoiding clang's reserving vec_step ) Message-ID: <4B3B6F66-9B65-48F3-814B-49528B88EE0E@yahoo.com>
next in thread | raw e-mail | index | archive | help
[I experiment with using modern compilers on powerpc64, here buildworld buildkernel was via devel/powerpc64-xtoolchain-gcc but included building clang and having clang as cc. clang's problems are tied to aspects of buildworld buildkernel but is otherwise usable.] When clang is built with support for altivec for powerpc* (powerpc64 here) and such it reserves a name not from the C/C++ language standards: vec_step . system-clang has enough enabled for powerpc64 to have reserved vec_step. If devel/llvm* ever enable enough powerpc64 support they would reserve vec_step too. (I've not checked if this is already happening.) Unfortunately, various devel/*gcc and lang/gcc* use that name in gcc/tree-vect-loop.c and so on powerpc64 those various *gcc* fail to build. The below just avoids the extra reserved word by renaming each non-comment vec_step in gcc/tree-vect-loop.c to vec_step_renamed . This has allowed me to build the example *gcc* 's in poudriere-devel on powerpc64 (head -r339076 based). One could imagine sed'ing or otherwise processing gcc/tree-vect-loop.c instead of having patch files. In the examples the original gcc/tree-vect-loop.c files are not the same: one patch for all *gcc* would not work. # svnlite status /usr/ports/devel/powerpc64-gcc/files/ | more ? /usr/ports/devel/powerpc64-gcc/files/patch-gcc_tree-vect-loop.c # svnlite status /usr/ports/lang/gcc8/files/ | more ? /usr/ports/lang/gcc8/files/patch-gcc_tree-vect-loop.c # more /usr/ports/devel/powerpc64-gcc/files/patch-gcc_tree-vect-loop.c --- gcc/tree-vect-loop.c.orig 2017-03-28 15:35:56 UTC +++ gcc/tree-vect-loop.c @@ -3832,7 +3832,7 @@ get_initial_def_for_induction (gimple *iv_phi) edge pe =3D loop_preheader_edge (loop); struct loop *iv_loop; basic_block new_bb; - tree new_vec, vec_init, vec_step, t; + tree new_vec, vec_init, vec_step_renamed, t; tree new_name; gimple *new_stmt; gphi *induction_phi; @@ -3986,7 +3986,7 @@ get_initial_def_for_induction (gimple *iv_phi) stepvectype =3D get_vectype_for_scalar_type (TREE_TYPE (new_name)); gcc_assert (stepvectype); new_vec =3D build_vector_from_val (stepvectype, t); - vec_step =3D vect_init_vector (iv_phi, new_vec, stepvectype, NULL); + vec_step_renamed =3D vect_init_vector (iv_phi, new_vec, stepvectype, = NULL); =20 =20 /* Create the following def-use cycle: @@ -4008,7 +4008,7 @@ get_initial_def_for_induction (gimple *iv_phi) induc_def =3D PHI_RESULT (induction_phi); =20 /* Create the iv update inside the loop */ - new_stmt =3D gimple_build_assign (vec_dest, PLUS_EXPR, induc_def, = vec_step); + new_stmt =3D gimple_build_assign (vec_dest, PLUS_EXPR, induc_def, = vec_step_renamed); vec_def =3D make_ssa_name (vec_dest, new_stmt); gimple_assign_set_lhs (new_stmt, vec_def); gsi_insert_before (&si, new_stmt, GSI_SAME_STMT); @@ -4049,7 +4049,7 @@ get_initial_def_for_induction (gimple *iv_phi) gcc_assert (CONSTANT_CLASS_P (new_name) || TREE_CODE (new_name) =3D=3D SSA_NAME); new_vec =3D build_vector_from_val (stepvectype, t); - vec_step =3D vect_init_vector (iv_phi, new_vec, stepvectype, = NULL); + vec_step_renamed =3D vect_init_vector (iv_phi, new_vec, = stepvectype, NULL); =20 vec_def =3D induc_def; prev_stmt_vinfo =3D vinfo_for_stmt (induction_phi); @@ -4057,7 +4057,7 @@ get_initial_def_for_induction (gimple *iv_phi) { /* vec_i =3D vec_prev + vec_step */ new_stmt =3D gimple_build_assign (vec_dest, PLUS_EXPR, - vec_def, vec_step); + vec_def, vec_step_renamed); vec_def =3D make_ssa_name (vec_dest, new_stmt); gimple_assign_set_lhs (new_stmt, vec_def); =20 @@ -6324,13 +6324,13 @@ vectorizable_reduction (gimple *stmt, = gimple_stmt_iter =20 /* Create a vector of the step value. */ tree step =3D build_int_cst (cr_index_scalar_type, = nunits_out); - tree vec_step =3D build_vector_from_val (cr_index_vector_type, = step); + tree vec_step_renamed =3D build_vector_from_val = (cr_index_vector_type, step); =20 /* Create an induction variable. */ gimple_stmt_iterator incr_gsi; bool insert_after; standard_iv_increment_position (loop, &incr_gsi, = &insert_after); - create_iv (series_vect, vec_step, NULL_TREE, loop, &incr_gsi, + create_iv (series_vect, vec_step_renamed, NULL_TREE, loop, = &incr_gsi, insert_after, &indx_before_incr, &indx_after_incr); =20 /* Next create a new phi node vector (NEW_PHI_TREE) which = starts # more /usr/ports/lang/gcc8/files/patch-gcc_tree-vect-loop.c --- gcc/tree-vect-loop.c.orig 2018-10-10 22:41:40.295753000 -0700 +++ gcc/tree-vect-loop.c 2018-10-10 22:57:44.698855000 -0700 @@ -4970,13 +4970,13 @@ =20 /* Create a vector of the step value. */ tree step =3D build_int_cst (cr_index_scalar_type, nunits_out); - tree vec_step =3D build_vector_from_val (cr_index_vector_type, = step); + tree vec_step_renamed =3D build_vector_from_val = (cr_index_vector_type, step); =20 /* Create an induction variable. */ gimple_stmt_iterator incr_gsi; bool insert_after; standard_iv_increment_position (loop, &incr_gsi, &insert_after); - create_iv (series_vect, vec_step, NULL_TREE, loop, &incr_gsi, + create_iv (series_vect, vec_step_renamed, NULL_TREE, loop, = &incr_gsi, insert_after, &indx_before_incr, &indx_after_incr); =20 /* Next create a new phi node vector (NEW_PHI_TREE) which starts @@ -7641,7 +7641,7 @@ tree vec_def; edge pe =3D loop_preheader_edge (loop); basic_block new_bb; - tree new_vec, vec_init, vec_step, t; + tree new_vec, vec_init, vec_step_renamed, t; tree new_name; gimple *new_stmt; gphi *induction_phi; @@ -7834,7 +7834,7 @@ new_name =3D vect_init_vector (phi, new_name, TREE_TYPE (step_expr), NULL); new_vec =3D build_vector_from_val (vectype, new_name); - vec_step =3D vect_init_vector (phi, new_vec, vectype, NULL); + vec_step_renamed =3D vect_init_vector (phi, new_vec, vectype, = NULL); =20 /* Now generate the IVs. */ unsigned group_size =3D SLP_TREE_SCALAR_STMTS (slp_node).length = (); @@ -7873,7 +7873,7 @@ =20 /* Create the iv update inside the loop */ vec_def =3D make_ssa_name (vec_dest); - new_stmt =3D gimple_build_assign (vec_def, PLUS_EXPR, = induc_def, vec_step); + new_stmt =3D gimple_build_assign (vec_def, PLUS_EXPR, = induc_def, vec_step_renamed); gsi_insert_before (&si, new_stmt, GSI_SAME_STMT); set_vinfo_for_stmt (new_stmt, new_stmt_vec_info (new_stmt, = loop_vinfo)); =20 @@ -7904,7 +7904,7 @@ new_name =3D vect_init_vector (phi, new_name, TREE_TYPE (step_expr), NULL); new_vec =3D build_vector_from_val (vectype, new_name); - vec_step =3D vect_init_vector (phi, new_vec, vectype, NULL); + vec_step_renamed =3D vect_init_vector (phi, new_vec, vectype, = NULL); for (; ivn < nvects; ++ivn) { gimple *iv =3D SLP_TREE_VEC_STMTS (slp_node)[ivn - nivs]; @@ -7915,7 +7915,7 @@ def =3D gimple_assign_lhs (iv); new_stmt =3D gimple_build_assign (make_ssa_name (vectype), PLUS_EXPR, - def, vec_step); + def, vec_step_renamed); if (gimple_code (iv) =3D=3D GIMPLE_PHI) gsi_insert_before (&si, new_stmt, GSI_SAME_STMT); else @@ -8041,7 +8041,7 @@ gcc_assert (CONSTANT_CLASS_P (new_name) || TREE_CODE (new_name) =3D=3D SSA_NAME); new_vec =3D build_vector_from_val (vectype, t); - vec_step =3D vect_init_vector (phi, new_vec, vectype, NULL); + vec_step_renamed =3D vect_init_vector (phi, new_vec, vectype, NULL); =20 =20 /* Create the following def-use cycle: @@ -8064,7 +8064,7 @@ =20 /* Create the iv update inside the loop */ vec_def =3D make_ssa_name (vec_dest); - new_stmt =3D gimple_build_assign (vec_def, PLUS_EXPR, induc_def, = vec_step); + new_stmt =3D gimple_build_assign (vec_def, PLUS_EXPR, induc_def, = vec_step_renamed); gsi_insert_before (&si, new_stmt, GSI_SAME_STMT); set_vinfo_for_stmt (new_stmt, new_stmt_vec_info (new_stmt, = loop_vinfo)); =20 @@ -8108,7 +8108,7 @@ gcc_assert (CONSTANT_CLASS_P (new_name) || TREE_CODE (new_name) =3D=3D SSA_NAME); new_vec =3D build_vector_from_val (vectype, t); - vec_step =3D vect_init_vector (phi, new_vec, vectype, NULL); + vec_step_renamed =3D vect_init_vector (phi, new_vec, vectype, = NULL); =20 vec_def =3D induc_def; prev_stmt_vinfo =3D vinfo_for_stmt (induction_phi); @@ -8116,7 +8116,7 @@ { /* vec_i =3D vec_prev + vec_step */ new_stmt =3D gimple_build_assign (vec_dest, PLUS_EXPR, - vec_def, vec_step); + vec_def, vec_step_renamed); vec_def =3D make_ssa_name (vec_dest, new_stmt); gimple_assign_set_lhs (new_stmt, vec_def); =20 =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B3B6F66-9B65-48F3-814B-49528B88EE0E>