[PATCH 2/2] AArch64: New RTL for ABDL

2023-06-30 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This patch adds new RTL for ABDL (sabdl, sabdl2, uabdl, uabdl2). gcc/ChangeLog: * config/aarch64/aarch64-simd.md (vec_widen_abdl_lo_, vec_widen_abdl_hi_): Expansions for abd vec widen optabs. (aarch64_abdl_insn): VQW based abdl RTL. * confi

[PATCH 1/2] Mid engine setup [SU]ABDL

2023-06-30 Thread Oluwatamilore Adebayo via Gcc-patches
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_WIDE

Re: [PATCH 2/2] AArch64: New RTL for ABDL

2023-06-30 Thread Oluwatamilore Adebayo via Gcc-patches
> Sorry, my fault, but I meant the comment about avoiding > (minus (max…) (min…)) for both patterns, not just the first. Change made. > I think the review suggestions for 1/2 will change the tests. > For example: > > TEST2(signed, short, char) This is the case and the tests have been updated to

Re: [PATCH 1/2] Mid engine setup [SU]ABDL

2023-06-30 Thread Oluwatamilore Adebayo via Gcc-patches
> Sorry, my fault. I was using the original type names in this > suggestion, rather than the TYPE1…TYPE5 ones. Should be: > >WIDEN_ABD exists to optimize the case where TYPE4 is at least >twice as wide as TYPE3. Change made. > Lingering use of “L” suffixes here. Maybe: > > stmts

[PATCH 2/2] AArch64: New RTL for ABDL

2023-06-28 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This patch adds new RTL for ABDL (sabdl, sabdl2, uabdl, uabdl2). gcc/ChangeLog: * config/aarch64/aarch64-simd.md (vec_widen_abdl_lo_, vec_widen_abdl_hi_): Expansions for abd vec widen optabs. (aarch64_abdl_insn): VQW based abdl RTL. * confi

Re: [PATCH 2/2] AArch64: New RTL for ABDL

2023-06-28 Thread Oluwatamilore Adebayo via Gcc-patches
> > +(define_insn "aarch64_abdl_hi_internal" > > + [(set (match_operand: 0 "register_operand" "=w") > > + (minus: > > + (USMAX: > > + (: > > + (vec_select: > > + (match_operand:VQW 1 "register_operand" "w") > > + (match_operand:VQW 3 "vect_par_cnst_hi_half"

[PATCH 1/2] Mid engine setup [SU]ABDL

2023-06-28 Thread Oluwatamilore Adebayo via Gcc-patches
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_WIDE

Re: [PATCH 1/2] Mid engine setup [SU]ABDL

2023-06-28 Thread Oluwatamilore Adebayo via Gcc-patches
> The new optabs need to be documented in doc/md.texi. Done. > “Long” is a bit of an architecture-specific term. Maybe just: > >Try to find the following ABsolute Difference (ABD) or >widening ABD (WIDEN_ABD) pattern: Change made. > >> - VTYPE x, y, out; > >> + VTYPE x, y; > >

[PATCH 2/2] AArch64: New RTL for ABDL

2023-06-26 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This patch adds new RTL for ABDL (sabdl, sabdl2, uabdl, uabdl2). gcc/ChangeLog: * config/aarch64/aarch64-simd.md (vec_widen_abdl_lo_, vec_widen_abdl_hi_): Expansions for abd vec widen optabs. (aarch64_abdl_insn): VQW based abdl RTL. * confi

[PATCH 1/2] Mid engine setup [SU]ABDL

2023-06-26 Thread Oluwatamilore Adebayo via Gcc-patches
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_WIDE

[PATCH 1/2] Missed opportunity to use [SU]ABD

2023-06-14 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.texi (sabd, uabd): Document them. * internal-fn.def (ABD): Use new optab. * optabs.def (sabd_optab, uabd_optab): New optabs, * tree-vect-pattern

[PATCH 2/2] AArch64: New RTL for ABD

2023-06-13 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This patch adds new RTL and tests for sabd and uabd PR tree-optimization/109156 gcc/ChangeLog: * config/aarch64/aarch64-simd-builtins.def (sabd, uabd): Change the mode to 3. * config/aarch64/aarch64-simd.md (aarch64_abd): Rename to abd3. *

[PATCH 1/2] Missed opportunity to use [SU]ABD

2023-06-13 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.texi (sabd, uabd): Document them. * internal-fn.def (ABD): Use new optab. * optabs.def (sabd_optab, uabd_optab): New optabs, * tree-vect-pattern

[PATCH 2/2] AArch64: New RTL for ABD

2023-06-08 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This patch adds new RTL and tests for sabd and uabd PR tree-optimization/109156 gcc/ChangeLog: * config/aarch64/aarch64-simd-builtins.def (sabd, uabd): Change the mode to 3. * config/aarch64/aarch64-simd.md (aarch64_abd): Rename to abd3. *

Re: [PATCH] rtl: AArch64: New RTL for ABD

2023-06-08 Thread Oluwatamilore Adebayo via Gcc-patches
> It would be good to add a: > > /* { dg-final { scan-assembler-not {\tabs\t} } } */ > > to be the positive tests, to make it more obvious that all separate > ABS instructions are elided. Done. Patch is in the next response.

[PATCH 1/2] Missed opportunity to use [SU]ABD

2023-06-08 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.texi (sabd, uabd): Document them. * internal-fn.def (ABD): Use new optab. * optabs.def (sabd_optab, uabd_optab): New optabs, * tree-vect-pattern

Re: [PATCH] vect: Missed opportunity to use [SU]ABD

2023-06-08 Thread Oluwatamilore Adebayo via Gcc-patches
New patch to address issue brought up in a different thread: mptjzwgplp2@arm.com > > + /* Failed to find a widen operation so we check for a regular > > MINUS_EXPR. */ > > + if (diff > > + && gimple_assign_rhs_code (diff) == MINUS_EXPR > > + && (TYPE_UNSIGNED (abs_type) || TYPE_O

[PATCH 2/2] AArch64: New RTL for ABD

2023-06-06 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This patch adds new RTL and tests for sabd and uabd PR tree-optimization/109156 gcc/ChangeLog: * config/aarch64/aarch64-simd-builtins.def (sabd, uabd): Change the mode to 3. * config/aarch64/aarch64-simd.md (aarch64_abd): Rename to abd3. *

Re: [PATCH] rtl: AArch64: New RTL for ABD

2023-06-06 Thread Oluwatamilore Adebayo via Gcc-patches
> It would be good to mark all of these functions with __attribute__((noipa)), > since I think interprocedural optimisations might otherwise defeat the > runtime test in abd_run_1.c (in the sense that we might end up folding > things at compile time and not testing the vector versions of the functi

[PATCH 1/2] Missed opportunity to use [SU]ABD

2023-06-06 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.texi (sabd, uabd): Document them. * internal-fn.def (ABD): Use new optab. * optabs.def (sabd_optab, uabd_optab): New optabs, * tree-vect-pattern

[PATCH 1/2] Missed opportunity to use [SU]ABD

2023-06-06 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.texi (sabd, uabd): Document them. * internal-fn.def (ABD): Use new optab. * optabs.def (sabd_optab, uabd_optab): New optabs, * tree-vect-pattern

Re: [PATCH] vect: Missed opportunity to use [SU]ABD

2023-06-06 Thread Oluwatamilore Adebayo via Gcc-patches
> > + if (TYPE_PRECISION (unprom_diff.type) != TYPE_PRECISION (abs_type) > > + && TYPE_UNSIGNED (unprom_diff.type) > > + && TYPE_UNSIGNED (abs_type)) > > The last line is now redundant, since TYPE_UNSIGNED was checked above. Done. > > + // Failed to find a widen operation so we check

[PATCH 1/2] Missed opportunity to use [SU]ABD

2023-05-23 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.texi (sabd, uabd): Document them. * internal-fn.def (ABD): Use new optab. * optabs.def (sabd_optab, uabd_optab): New optabs, * tree-vect-pattern

Re: [PATCH] vect: Missed opportunity to use [SU]ABD

2023-05-23 Thread Oluwatamilore Adebayo via Gcc-patches
> > + if (reject_unsigned && TYPE_UNSIGNED (abs_type)) > > +return false; > > + if (!ANY_INTEGRAL_TYPE_P (abs_type) || TYPE_OVERFLOW_WRAPS (abs_type)) > > +return false; > > Could you explain the reject_unsigned behaviour? I'd have expected > TYPE_OVERFLOW_WRAPS (abs_type) to reject the

[PATCH 1/4] Missed opportunity to use [SU]ABD

2023-05-18 Thread Oluwatamilore Adebayo via Gcc-patches
From: oluade01 This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.texi (sabd, uabd): Document them. * internal-fn.def (ABD): Use new optab. * optabs.def (sabd_optab, uabd_optab): New optabs, * tree-vect-pattern

Re: [PATCH] vect: Missed opportunity to use [SU]ABD

2023-05-17 Thread Oluwatamilore Adebayo via Gcc-patches
> Yeah. Like Tami says, this is what the instruction does. > > I think all three definitions are equivalent: the extend/operate/truncate > one, the ?: one above, and the "max - min" one. Probably just personal > preference as to which seems more natural. Decided to switch to using the ?: one as

RE: [PATCH] vect: Missed opportunity to use [SU]ABD

2023-05-15 Thread Oluwatamilore Adebayo via Gcc-patches
From: Oluwatamilore Adebayo Sent: Wednesday, May 10, 2023 14:29 To: Richard Biener ; gcc-patches@gcc.gnu.org; Richard Sandiford Subject: Re: [PATCH] vect: Missed opportunity to use [SU]ABD When using inputs of 0x7fff and 0x8000 the result yielded is -1. When using inputs of -1 and 0x7fff the

Re: [PATCH] vect: Missed opportunity to use [SU]ABD

2023-05-10 Thread Oluwatamilore Adebayo via Gcc-patches
When using inputs of 0x7fff and 0x8000 the result yielded is -1. When using inputs of -1 and 0x7fff the results yielded is 0x8000. Tami From: Richard Biener Sent: Wednesday, May 10, 2023 10:49 AM To: Oluwatamilore Adebayo ; gcc-patches@gcc.gnu.org ; richard.guent

[PATCH] rtl: AArch64: New RTL for ABD

2023-05-09 Thread Oluwatamilore Adebayo via Gcc-patches
>From afa416dab831795f7e1114da2fb9e94ea3b8c519 Mon Sep 17 00:00:00 2001 From: oluade01 Date: Fri, 14 Apr 2023 15:10:07 +0100 Subject: [PATCH 2/4] AArch64: New RTL for ABD This patch adds new RTL and tests for sabd and uabd PR tree-optimization/109156 gcc/ChangeLog: * config/aarch64/aar

[PATCH] vect: Missed opportunity to use [SU]ABD

2023-05-09 Thread Oluwatamilore Adebayo via Gcc-patches
>From 0b5f469171c340ef61a48a31877d495bb77bd35f Mon Sep 17 00:00:00 2001 From: oluade01 Date: Fri, 14 Apr 2023 10:24:43 +0100 Subject: [PATCH 1/4] Missed opportunity to use [SU]ABD This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.tex

[PATCH] vect: Missed opportunity to use [SU]ABD

2023-05-09 Thread Oluwatamilore Adebayo via Gcc-patches
>From 0b5f469171c340ef61a48a31877d495bb77bd35f Mon Sep 17 00:00:00 2001 From: oluade01 Date: Fri, 14 Apr 2023 10:24:43 +0100 Subject: [PATCH 1/4] Missed opportunity to use [SU]ABD This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.tex