From owner-freebsd-ppc@freebsd.org Fri Oct 12 14:45:00 2018 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA42310C05FC for ; Fri, 12 Oct 2018 14:44:59 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic308-10.consmr.mail.ne1.yahoo.com (sonic308-10.consmr.mail.ne1.yahoo.com [66.163.187.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C4E18587F for ; Fri, 12 Oct 2018 14:44:59 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 5tDIXPkVM1nqBi_rs9XEnOXW9Gk66dqiwPlaM5ARrrgl1B_uefe6Ke1pvn_nwtI wT4e2gsEGrbd9i0isrSySXcfjyoqbycJ3z9yTUfE5stz2XLMbtSahWDOacOLsCiQJJRf3uscI1II Pd.IBv2ZTvEuE8yZc2FdMNvd4i9xANL6GFoH7JPw3fWYIS1fEAq4HLsslroFAvMhMPGZn5Xz5XTA luIBDCsJRbd5YtEdf05yCKlPJ29uXkbUAn7naNExu0cQn3.OrUikQBsq3oa5Ju2ecGqK5trP81Fm d_DZwwYdozMJ30kzIF91PYUCxV7ZXd_HxZY5yk6f7mlfD7557rEpVh636YnJB4dS6w6AfPgtnXtZ XPGTzzxfZeBkSzrc7HxUEPcpOGIh1hm8fAScT50o9zzd3XSbVLL8y5pRHCBj496GDDwPK79Ilp6V wewqkbILGgvj4anfdTv_GmpXFKtBzXqZm8.DqvKyweYrliJPxXHz.5aLZ8E7eGSsLd.8zzSrduf0 vPLTiQnyKcggfOpx9t9_0WfGUSsj7DGOpQ1Ajr8qAslvo2OkrUnzdudIIB9DfZYoBOpLGEqnVeCf wn.HSyKiz0nSQoEcucrukCR7K6WSzj.cHz8ID3TzwkhZ2T27OfQoFkYJWCEZiBe3v_8OMpbw9mde HSXhExyPaVPa.6hQW4iMLc6o.5vhI_0ZPVgzS_UsOiHqnHkygjCOrUCAHV8FeYjtZl3g5wSi1U90 CpK.arJOq34ihSoe1oksSPzuWTzvbl7bQ2tzRUvZ0u3baA5sWrucAu7ktvIkSGiNPOSndzpUk5ta iEBq1snfGGPsTWyU.SW.e9x4q3i3F2QFfNNfFkCA3yPxCBcJZn2OcFtTnmJPAOI3YIv5vyGk9BhL EZcf9AHKh1lZoSAdxr83JjAIeOXmYZ8tQoXXVpb3IZpL8IX0WyzaGo9XyLtDkOIDKZ3Rw1dpHdjG HmndNPHLehLzHpmFfp9WVEHk2cymwPoQerJKsX9DUuZgy_RvdChB35r7YNuGtnQXOA_U9B3Pzmpn q83q2XPQCwFOvAR8_Noltio2VZBWV5s0Jjhf8RIriQv2d.KvYtFH4Nr740JBl5XzRvy3nv2.IOcL xNI6ps8rvuIRj1Spy Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ne1.yahoo.com with HTTP; Fri, 12 Oct 2018 14:44:52 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.25]) ([76.115.7.162]) by smtp409.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID c653ea202ddf8ae0ce4bbcf1f75bf0bb; Fri, 12 Oct 2018 14:44:50 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) 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> Date: Fri, 12 Oct 2018 07:44:49 -0700 Cc: gerald@FreeBSD.org To: FreeBSD Toolchain , FreeBSD Ports ML , FreeBSD PowerPC ML X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2018 14:45:00 -0000 [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)