RE: [PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)]
> -Original Message- > From: Richard Earnshaw (lists) [mailto:richard.earns...@arm.com] > Sent: 12 October 2017 13:57 > To: Tamar Christina; Kyrill Tkachov; gcc-patches@gcc.gnu.org > Cc: nd; Ramana Radhakrishnan; ni...@redhat.com > Subject: Re: [PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)] > > On 06/10/17 13:44, Tamar Christina wrote: > > Hi All, > > > > this is a minor respin with changes echo'd from feedback from aarch64. > > I assume still OK for trunk. > > > > Regtested on arm-none-eabi, armeb-none-eabi, aarch64-none-elf and > > aarch64_be-none-elf with no issues found. > > > > Ok for trunk? > > > > gcc/ > > 2017-10-06 Tamar Christina <tamar.christ...@arm.com> > > > > * config/arm/arm-builtins.c (arm_unsigned_uternop_qualifiers): New. > > (UTERNOP_QUALIFIERS, arm_umac_lane_qualifiers, > UMAC_LANE_QUALIFIERS): New. > > * config/arm/arm_neon_builtins.def (sdot, udot, sdot_lane, > udot_lane): new. > > * config/arm/iterators.md (DOTPROD, VSI2QI, vsi2qi): New. > > (UNSPEC_DOT_S, UNSPEC_DOT_U, opsuffix): New. > > * config/arm/neon.md (neon_dot): New. > > (neon_dot_lane, dot_prod): New. > > * config/arm/types.md (neon_dot, neon_dot_q): New. > > * config/arm/unspecs.md (sup): Add UNSPEC_DOT_S, > UNSPEC_DOT_U. > > OK if this passes a native bootstrap. Bootstrapped on arm-none-linux-gnueabihf and no issues. Thanks, Tamar > > R. > > > > > From: Kyrill Tkachov <kyrylo.tkac...@foss.arm.com> > > Sent: Wednesday, September 13, 2017 10:36:38 AM > > To: Tamar Christina; gcc-patches@gcc.gnu.org > > Cc: nd; Ramana Radhakrishnan; Richard Earnshaw; ni...@redhat.com > > Subject: Re: [PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)] > > > > Hi Tamar, > > > > On 01/09/17 14:33, Tamar Christina wrote: > >> Hi All, > >> > >> This patch adds the instructions for Dot Product to ARM along with > >> the intrinsics and vectorizer pattern. > >> > >> Armv8.2-a dot product supports 8-bit element values both signed and > >> unsigned. > >> > >> Dot product is available from Armv8.2-a and onwards. > >> > >> Regtested and bootstrapped on arm-none-eabi and no issues. > >> > >> Ok for trunk? > > > > This is ok once the prerequisites are approved with one ChangeLog nit. > > > > Kyrill > > > >> gcc/ > >> 2017-09-01 Tamar Christina <tamar.christ...@arm.com> > >> > >> * config/arm/arm-builtins.c (arm_unsigned_uternop_qualifiers): New. > >> (UTERNOP_QUALIFIERS, arm_umac_lane_qualifiers, > UMAC_LANE_QUALIFIERS): New. > >> * config/arm/arm_neon_builtins.def (sdot, udot, sdot_lane, > udot_lane): new. > >> * config/arm/iterators.md (DOTPROD, DOT_MODE, dot_mode): New. > >> (UNSPEC_DOT_S, UNSPEC_DOT_U, opsuffix): New. > >> * config/arm/neon.md (neon_dot): New. > >> (neon_dot_lane, dot_prod): > New. > >> * config/arm/types.md (neon_dot, neon_dot_q): New. > >> * config/arm/unspecs.md (UNSPEC_DOT_S, UNSPEC_DOT_U): New. > >> > > > > diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md > > index > > > 7acbaf1bb40a4f270e75968804546508f7839e49..139e09fd929e17216ad9383505 > f1 > > 453a73d071fb 100644 > > --- a/gcc/config/arm/iterators.md > > > > --snip--- > > > > > > ;; > > ;; Code attributes > > > > ;; > > > > @@ -816,6 +822,7 @@ > > (UNSPEC_VSRA_S_N "s") (UNSPEC_VSRA_U_N "u") > > (UNSPEC_VRSRA_S_N "s") (UNSPEC_VRSRA_U_N "u") > > (UNSPEC_VCVTH_S "s") (UNSPEC_VCVTH_U "u") > > + (UNSPEC_DOT_S "s") (UNSPEC_DOT_U "u") > > ]) > > > > In your ChangeLog you list this as "New" whereas your patch just adds > them to the "sup" int_attr. > >
Re: [PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)]
On 06/10/17 13:44, Tamar Christina wrote: > Hi All, > > this is a minor respin with changes echo'd from feedback from aarch64. > I assume still OK for trunk. > > Regtested on arm-none-eabi, armeb-none-eabi, > aarch64-none-elf and aarch64_be-none-elf with no issues found. > > Ok for trunk? > > gcc/ > 2017-10-06 Tamar Christina <tamar.christ...@arm.com> > > * config/arm/arm-builtins.c (arm_unsigned_uternop_qualifiers): New. > (UTERNOP_QUALIFIERS, arm_umac_lane_qualifiers, UMAC_LANE_QUALIFIERS): > New. > * config/arm/arm_neon_builtins.def (sdot, udot, sdot_lane, > udot_lane): new. > * config/arm/iterators.md (DOTPROD, VSI2QI, vsi2qi): New. > (UNSPEC_DOT_S, UNSPEC_DOT_U, opsuffix): New. > * config/arm/neon.md (neon_dot): New. > (neon_dot_lane, dot_prod): New. > * config/arm/types.md (neon_dot, neon_dot_q): New. > * config/arm/unspecs.md (sup): Add UNSPEC_DOT_S, UNSPEC_DOT_U. OK if this passes a native bootstrap. R. > > From: Kyrill Tkachov <kyrylo.tkac...@foss.arm.com> > Sent: Wednesday, September 13, 2017 10:36:38 AM > To: Tamar Christina; gcc-patches@gcc.gnu.org > Cc: nd; Ramana Radhakrishnan; Richard Earnshaw; ni...@redhat.com > Subject: Re: [PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)] > > Hi Tamar, > > On 01/09/17 14:33, Tamar Christina wrote: >> Hi All, >> >> This patch adds the instructions for Dot Product to ARM along >> with the intrinsics and vectorizer pattern. >> >> Armv8.2-a dot product supports 8-bit element values both >> signed and unsigned. >> >> Dot product is available from Armv8.2-a and onwards. >> >> Regtested and bootstrapped on arm-none-eabi and no issues. >> >> Ok for trunk? > > This is ok once the prerequisites are approved with one ChangeLog nit. > > Kyrill > >> gcc/ >> 2017-09-01 Tamar Christina <tamar.christ...@arm.com> >> >> * config/arm/arm-builtins.c (arm_unsigned_uternop_qualifiers): New. >> (UTERNOP_QUALIFIERS, arm_umac_lane_qualifiers, UMAC_LANE_QUALIFIERS): >> New. >> * config/arm/arm_neon_builtins.def (sdot, udot, sdot_lane, udot_lane): >> new. >> * config/arm/iterators.md (DOTPROD, DOT_MODE, dot_mode): New. >> (UNSPEC_DOT_S, UNSPEC_DOT_U, opsuffix): New. >> * config/arm/neon.md (neon_dot): New. >> (neon_dot_lane, dot_prod): New. >> * config/arm/types.md (neon_dot, neon_dot_q): New. >> * config/arm/unspecs.md (UNSPEC_DOT_S, UNSPEC_DOT_U): New. >> > > diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md > index > 7acbaf1bb40a4f270e75968804546508f7839e49..139e09fd929e17216ad9383505f1453a73d071fb > 100644 > --- a/gcc/config/arm/iterators.md > > --snip--- > > > ;; > ;; Code attributes > > ;; > @@ -816,6 +822,7 @@ > (UNSPEC_VSRA_S_N "s") (UNSPEC_VSRA_U_N "u") > (UNSPEC_VRSRA_S_N "s") (UNSPEC_VRSRA_U_N "u") > (UNSPEC_VCVTH_S "s") (UNSPEC_VCVTH_U "u") > + (UNSPEC_DOT_S "s") (UNSPEC_DOT_U "u") > ]) > > In your ChangeLog you list this as "New" whereas your patch just adds them to > the "sup" int_attr. >
Re: [PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)]
Hi All, this is a minor respin with changes echo'd from feedback from aarch64. I assume still OK for trunk. Regtested on arm-none-eabi, armeb-none-eabi, aarch64-none-elf and aarch64_be-none-elf with no issues found. Ok for trunk? gcc/ 2017-10-06 Tamar Christina <tamar.christ...@arm.com> * config/arm/arm-builtins.c (arm_unsigned_uternop_qualifiers): New. (UTERNOP_QUALIFIERS, arm_umac_lane_qualifiers, UMAC_LANE_QUALIFIERS): New. * config/arm/arm_neon_builtins.def (sdot, udot, sdot_lane, udot_lane): new. * config/arm/iterators.md (DOTPROD, VSI2QI, vsi2qi): New. (UNSPEC_DOT_S, UNSPEC_DOT_U, opsuffix): New. * config/arm/neon.md (neon_dot): New. (neon_dot_lane, dot_prod): New. * config/arm/types.md (neon_dot, neon_dot_q): New. * config/arm/unspecs.md (sup): Add UNSPEC_DOT_S, UNSPEC_DOT_U. From: Kyrill Tkachov <kyrylo.tkac...@foss.arm.com> Sent: Wednesday, September 13, 2017 10:36:38 AM To: Tamar Christina; gcc-patches@gcc.gnu.org Cc: nd; Ramana Radhakrishnan; Richard Earnshaw; ni...@redhat.com Subject: Re: [PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)] Hi Tamar, On 01/09/17 14:33, Tamar Christina wrote: > Hi All, > > This patch adds the instructions for Dot Product to ARM along > with the intrinsics and vectorizer pattern. > > Armv8.2-a dot product supports 8-bit element values both > signed and unsigned. > > Dot product is available from Armv8.2-a and onwards. > > Regtested and bootstrapped on arm-none-eabi and no issues. > > Ok for trunk? This is ok once the prerequisites are approved with one ChangeLog nit. Kyrill > gcc/ > 2017-09-01 Tamar Christina <tamar.christ...@arm.com> > > * config/arm/arm-builtins.c (arm_unsigned_uternop_qualifiers): New. > (UTERNOP_QUALIFIERS, arm_umac_lane_qualifiers, UMAC_LANE_QUALIFIERS): > New. > * config/arm/arm_neon_builtins.def (sdot, udot, sdot_lane, udot_lane): > new. > * config/arm/iterators.md (DOTPROD, DOT_MODE, dot_mode): New. > (UNSPEC_DOT_S, UNSPEC_DOT_U, opsuffix): New. > * config/arm/neon.md (neon_dot): New. > (neon_dot_lane, dot_prod): New. > * config/arm/types.md (neon_dot, neon_dot_q): New. > * config/arm/unspecs.md (UNSPEC_DOT_S, UNSPEC_DOT_U): New. > diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md index 7acbaf1bb40a4f270e75968804546508f7839e49..139e09fd929e17216ad9383505f1453a73d071fb 100644 --- a/gcc/config/arm/iterators.md --snip--- ;; ;; Code attributes ;; @@ -816,6 +822,7 @@ (UNSPEC_VSRA_S_N "s") (UNSPEC_VSRA_U_N "u") (UNSPEC_VRSRA_S_N "s") (UNSPEC_VRSRA_U_N "u") (UNSPEC_VCVTH_S "s") (UNSPEC_VCVTH_U "u") + (UNSPEC_DOT_S "s") (UNSPEC_DOT_U "u") ]) In your ChangeLog you list this as "New" whereas your patch just adds them to the "sup" int_attr. diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c index 569f960fd2e534df6e972245b35ae6def5bec033..6d1b20c80f9a24a8d26a10bea6f6e316886bce31 100644 --- a/gcc/config/arm/arm-builtins.c +++ b/gcc/config/arm/arm-builtins.c @@ -105,6 +105,13 @@ arm_ternop_qualifiers[SIMD_MAX_BUILTIN_ARGS] = { qualifier_none, qualifier_none, qualifier_none, qualifier_none }; #define TERNOP_QUALIFIERS (arm_ternop_qualifiers) +/* unsigned T (unsigned T, unsigned T, unsigned T). */ +static enum arm_type_qualifiers +arm_unsigned_uternop_qualifiers[SIMD_MAX_BUILTIN_ARGS] + = { qualifier_unsigned, qualifier_unsigned, qualifier_unsigned, + qualifier_unsigned }; +#define UTERNOP_QUALIFIERS (arm_unsigned_uternop_qualifiers) + /* T (T, immediate). */ static enum arm_type_qualifiers arm_binop_imm_qualifiers[SIMD_MAX_BUILTIN_ARGS] @@ -131,6 +138,13 @@ arm_mac_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS] qualifier_none, qualifier_lane_index }; #define MAC_LANE_QUALIFIERS (arm_mac_lane_qualifiers) +/* unsigned T (unsigned T, unsigned T, unsigend T, lane index). */ +static enum arm_type_qualifiers +arm_umac_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS] + = { qualifier_unsigned, qualifier_unsigned, qualifier_unsigned, + qualifier_unsigned, qualifier_lane_index }; +#define UMAC_LANE_QUALIFIERS (arm_umac_lane_qualifiers) + /* T (T, T, immediate). */ static enum arm_type_qualifiers arm_ternop_imm_qualifiers[SIMD_MAX_BUILTIN_ARGS] diff --git a/gcc/config/arm/arm_neon_builtins.def b/gcc/config/arm/arm_neon_builtins.def index 07f0368343a0c940c1cc1848d31f28a47a587b6f..982eec810dafb5ec955273099853f8842020d104 100644 --- a/gcc/config/arm/arm_neon_builtins.def +++ b/gcc/config/arm/arm_neon_builtins.def @@ -331,3 +331,7 @@ VAR1
Re: [PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)]
Hi Tamar, On 01/09/17 14:33, Tamar Christina wrote: Hi All, This patch adds the instructions for Dot Product to ARM along with the intrinsics and vectorizer pattern. Armv8.2-a dot product supports 8-bit element values both signed and unsigned. Dot product is available from Armv8.2-a and onwards. Regtested and bootstrapped on arm-none-eabi and no issues. Ok for trunk? This is ok once the prerequisites are approved with one ChangeLog nit. Kyrill gcc/ 2017-09-01 Tamar Christina* config/arm/arm-builtins.c (arm_unsigned_uternop_qualifiers): New. (UTERNOP_QUALIFIERS, arm_umac_lane_qualifiers, UMAC_LANE_QUALIFIERS): New. * config/arm/arm_neon_builtins.def (sdot, udot, sdot_lane, udot_lane): new. * config/arm/iterators.md (DOTPROD, DOT_MODE, dot_mode): New. (UNSPEC_DOT_S, UNSPEC_DOT_U, opsuffix): New. * config/arm/neon.md (neon_dot): New. (neon_dot_lane, dot_prod): New. * config/arm/types.md (neon_dot, neon_dot_q): New. * config/arm/unspecs.md (UNSPEC_DOT_S, UNSPEC_DOT_U): New. diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md index 7acbaf1bb40a4f270e75968804546508f7839e49..139e09fd929e17216ad9383505f1453a73d071fb 100644 --- a/gcc/config/arm/iterators.md --snip--- ;; ;; Code attributes ;; @@ -816,6 +822,7 @@ (UNSPEC_VSRA_S_N "s") (UNSPEC_VSRA_U_N "u") (UNSPEC_VRSRA_S_N "s") (UNSPEC_VRSRA_U_N "u") (UNSPEC_VCVTH_S "s") (UNSPEC_VCVTH_U "u") + (UNSPEC_DOT_S "s") (UNSPEC_DOT_U "u") ]) In your ChangeLog you list this as "New" whereas your patch just adds them to the "sup" int_attr.
[PATCH][GCC][ARM] Dot Product NEON patterns [Patch (2/8)]
Hi All, This patch adds the instructions for Dot Product to ARM along with the intrinsics and vectorizer pattern. Armv8.2-a dot product supports 8-bit element values both signed and unsigned. Dot product is available from Armv8.2-a and onwards. Regtested and bootstrapped on arm-none-eabi and no issues. Ok for trunk? gcc/ 2017-09-01 Tamar Christina* config/arm/arm-builtins.c (arm_unsigned_uternop_qualifiers): New. (UTERNOP_QUALIFIERS, arm_umac_lane_qualifiers, UMAC_LANE_QUALIFIERS): New. * config/arm/arm_neon_builtins.def (sdot, udot, sdot_lane, udot_lane): new. * config/arm/iterators.md (DOTPROD, DOT_MODE, dot_mode): New. (UNSPEC_DOT_S, UNSPEC_DOT_U, opsuffix): New. * config/arm/neon.md (neon_dot): New. (neon_dot_lane, dot_prod): New. * config/arm/types.md (neon_dot, neon_dot_q): New. * config/arm/unspecs.md (UNSPEC_DOT_S, UNSPEC_DOT_U): New. -- diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c index 7504ed581c63a657a0dff48442633704bd252b2e..467596c1dbefe62cc92a0ffb8a03ecaf950f3701 100644 --- a/gcc/config/arm/arm-builtins.c +++ b/gcc/config/arm/arm-builtins.c @@ -105,6 +105,13 @@ arm_ternop_qualifiers[SIMD_MAX_BUILTIN_ARGS] = { qualifier_none, qualifier_none, qualifier_none, qualifier_none }; #define TERNOP_QUALIFIERS (arm_ternop_qualifiers) +/* unsigned T (unsigned T, unsigned T, unsigned T). */ +static enum arm_type_qualifiers +arm_unsigned_uternop_qualifiers[SIMD_MAX_BUILTIN_ARGS] + = { qualifier_unsigned, qualifier_unsigned, qualifier_unsigned, + qualifier_unsigned }; +#define UTERNOP_QUALIFIERS (arm_unsigned_uternop_qualifiers) + /* T (T, immediate). */ static enum arm_type_qualifiers arm_binop_imm_qualifiers[SIMD_MAX_BUILTIN_ARGS] @@ -131,6 +138,13 @@ arm_mac_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS] qualifier_none, qualifier_lane_index }; #define MAC_LANE_QUALIFIERS (arm_mac_lane_qualifiers) +/* unsigned T (unsigned T, unsigned T, unsigend T, lane index). */ +static enum arm_type_qualifiers +arm_umac_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS] + = { qualifier_unsigned, qualifier_unsigned, qualifier_unsigned, + qualifier_unsigned, qualifier_lane_index }; +#define UMAC_LANE_QUALIFIERS (arm_umac_lane_qualifiers) + /* T (T, T, immediate). */ static enum arm_type_qualifiers arm_ternop_imm_qualifiers[SIMD_MAX_BUILTIN_ARGS] diff --git a/gcc/config/arm/arm_neon_builtins.def b/gcc/config/arm/arm_neon_builtins.def index 07f0368343a0c940c1cc1848d31f28a47a587b6f..982eec810dafb5ec955273099853f8842020d104 100644 --- a/gcc/config/arm/arm_neon_builtins.def +++ b/gcc/config/arm/arm_neon_builtins.def @@ -331,3 +331,7 @@ VAR11 (STORE1, vst4, v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf) VAR9 (STORE1LANE, vst4_lane, v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf) +VAR2 (TERNOP, sdot, v8qi, v16qi) +VAR2 (UTERNOP, udot, v8qi, v16qi) +VAR2 (MAC_LANE, sdot_lane, v8qi, v16qi) +VAR2 (UMAC_LANE, udot_lane, v8qi, v16qi) diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md index 7acbaf1bb40a4f270e75968804546508f7839e49..139e09fd929e17216ad9383505f1453a73d071fb 100644 --- a/gcc/config/arm/iterators.md +++ b/gcc/config/arm/iterators.md @@ -410,6 +410,8 @@ (define_int_iterator VFM_LANE_AS [UNSPEC_VFMA_LANE UNSPEC_VFMS_LANE]) +(define_int_iterator DOTPROD [UNSPEC_DOT_S UNSPEC_DOT_U]) + ;; ;; Mode attributes ;; @@ -720,6 +722,10 @@ (define_mode_attr pf [(V8QI "p") (V16QI "p") (V2SF "f") (V4SF "f")]) +;; Mapping attribute for Dot Product input modes based on result mode. +(define_mode_attr DOT_MODE [(V2SI "V8QI") (V4SI "V16QI")]) +(define_mode_attr dot_mode [(V2SI "v8qi") (V4SI "v16qi")]) + ;; ;; Code attributes ;; @@ -816,6 +822,7 @@ (UNSPEC_VSRA_S_N "s") (UNSPEC_VSRA_U_N "u") (UNSPEC_VRSRA_S_N "s") (UNSPEC_VRSRA_U_N "u") (UNSPEC_VCVTH_S "s") (UNSPEC_VCVTH_U "u") + (UNSPEC_DOT_S "s") (UNSPEC_DOT_U "u") ]) (define_int_attr vcvth_op @@ -1003,3 +1010,6 @@ (define_int_attr mrrc [(VUNSPEC_MRRC "mrrc") (VUNSPEC_MRRC2 "mrrc2")]) (define_int_attr MRRC [(VUNSPEC_MRRC "MRRC") (VUNSPEC_MRRC2 "MRRC2")]) + +(define_int_attr opsuffix [(UNSPEC_DOT_S "s8") + (UNSPEC_DOT_U "u8")]) diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index 45b3bd18052dd4a33e4b9c10f3ca2ea7e2eed5ce..4c919f53757ada3ca40609b8244ed3b403be3329 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -3044,6 +3044,71 @@ DONE; }) +;; These instructions map to the __builtins for the Dot Product operations. +(define_insn "neon_dot" + [(set (match_operand:VCVTI 0 "register_operand" "=w") + (unspec:VCVTI