From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 991A93860758 for ; Fri, 30 Jun 2023 11:30:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 991A93860758 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BE726D75; Fri, 30 Jun 2023 04:31:18 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8EE623F64C; Fri, 30 Jun 2023 04:30:34 -0700 (PDT) From: Richard Sandiford To: Oluwatamilore Adebayo Mail-Followup-To: Oluwatamilore Adebayo ,, , richard.sandiford@arm.com Cc: , Subject: Re: [PATCH 1/2] Mid engine setup [SU]ABDL References: <20230630082308.112217-1-oluwatamilore.adebayo@arm.com> <20230630082611.112557-1-oluwatamilore.adebayo@arm.com> Date: Fri, 30 Jun 2023 12:28:59 +0100 In-Reply-To: <20230630082611.112557-1-oluwatamilore.adebayo@arm.com> (Oluwatamilore Adebayo's message of "Fri, 30 Jun 2023 09:26:11 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-21.2 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Oluwatamilore Adebayo writes: > From: oluade01 > > This updates vect_recog_abd_pattern to recognize the widening > variant of absolute difference (ABDL, ABDL2). > > gcc/ChangeLog: > > * internal-fn.cc (widening_fn_p, decomposes_to_hilo_fn_p): > Add IFN_VEC_WIDEN_ABD to the switch statement. > * internal-fn.def (VEC_WIDEN_ABD): New internal hilo optab. > * optabs.def (vec_widen_sabd_optab, > vec_widen_sabd_hi_optab, vec_widen_sabd_lo_optab, > vec_widen_sabd_odd_even, vec_widen_sabd_even_optab, > vec_widen_uabd_optab, > vec_widen_uabd_hi_optab, vec_widen_uabd_lo_optab, > vec_widen_uabd_odd_even, vec_widen_uabd_even_optab): > New optabs. > * tree-vect-patterns.cc (vect_recog_abd_pattern): Update to > to build a VEC_WIDEN_ABD call if the input precision is smaller > than the precision of the output. > (vect_recog_widen_abd_pattern): Should an ABD expression be > found preceeding an extension, replace the two with a > VEC_WIDEN_ABD. Thanks. Testing on an updated trunk shows that we need to check INTEGRAL_TYPE_P=E2=80=A6 > @@ -1703,6 +1736,66 @@ vect_recog_widen_minus_pattern (vec_info *vinfo, s= tmt_vec_info last_stmt_info, > &subtype); > } >=20=20 > +/* Try to detect abd on widened inputs, converting IFN_ABD > + to IFN_VEC_WIDEN_ABD. */ > +static gimple * > +vect_recog_widen_abd_pattern (vec_info *vinfo, stmt_vec_info stmt_vinfo, > + tree *type_out) > +{ > + gassign *last_stmt =3D dyn_cast (STMT_VINFO_STMT (stmt_vin= fo)); > + if (!last_stmt || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (last_s= tmt))) > + return NULL; > + > + tree last_rhs =3D gimple_assign_rhs1 (last_stmt); > + > + tree in_type =3D TREE_TYPE (last_rhs); > + tree out_type =3D TREE_TYPE (gimple_assign_lhs (last_stmt)); > + if (TYPE_PRECISION (in_type) * 2 !=3D TYPE_PRECISION (out_type) > + || !TYPE_UNSIGNED (in_type)) > + return NULL; =E2=80=A6here to avoid new stricter testing for TYPE_PRECISION on VECTOR_TY= PEs. I've pushed the series with that change. Thanks again for working on this. It's a really nice improvement. Richard > + > + vect_unpromoted_value unprom; > + tree op =3D vect_look_through_possible_promotion (vinfo, last_rhs, &un= prom); > + if (!op || TYPE_PRECISION (TREE_TYPE (op)) !=3D TYPE_PRECISION (in_typ= e)) > + return NULL; > + > + stmt_vec_info abd_pattern_vinfo =3D vect_get_internal_def (vinfo, op); > + if (!abd_pattern_vinfo) > + return NULL; > + > + abd_pattern_vinfo =3D vect_stmt_to_vectorize (abd_pattern_vinfo); > + gcall *abd_stmt =3D dyn_cast (STMT_VINFO_STMT (abd_pattern_v= info)); > + if (!abd_stmt > + || !gimple_call_internal_p (abd_stmt) > + || gimple_call_internal_fn (abd_stmt) !=3D IFN_ABD) > + return NULL; > + > + tree vectype_in =3D get_vectype_for_scalar_type (vinfo, in_type); > + tree vectype_out =3D get_vectype_for_scalar_type (vinfo, out_type); > + > + code_helper dummy_code; > + int dummy_int; > + auto_vec dummy_vec; > + if (!supportable_widening_operation (vinfo, IFN_VEC_WIDEN_ABD, stmt_vi= nfo, > + vectype_out, vectype_in, > + &dummy_code, &dummy_code, > + &dummy_int, &dummy_vec)) > + return NULL; > + > + vect_pattern_detected ("vect_recog_widen_abd_pattern", last_stmt); > + > + *type_out =3D vectype_out; > + > + tree abd_oprnd0 =3D gimple_call_arg (abd_stmt, 0); > + tree abd_oprnd1 =3D gimple_call_arg (abd_stmt, 1); > + tree widen_abd_result =3D vect_recog_temp_ssa_var (out_type, NULL); > + gcall *widen_abd_stmt =3D gimple_build_call_internal (IFN_VEC_WIDEN_AB= D, 2, > + abd_oprnd0, abd_oprnd1); > + gimple_call_set_lhs (widen_abd_stmt, widen_abd_result); > + gimple_set_location (widen_abd_stmt, gimple_location (last_stmt)); > + return widen_abd_stmt; > +} > + > /* Function vect_recog_ctz_ffs_pattern >=20=20 > Try to find the following pattern: > @@ -6670,6 +6763,7 @@ static vect_recog_func vect_vect_recog_func_ptrs[] = =3D { > { vect_recog_mask_conversion_pattern, "mask_conversion" }, > { vect_recog_widen_plus_pattern, "widen_plus" }, > { vect_recog_widen_minus_pattern, "widen_minus" }, > + { vect_recog_widen_abd_pattern, "widen_abd" }, > /* These must come after the double widening ones. */ > };