Message ID | 20200925143055.GA28257@arm.com |
---|---|
State | New |
Headers | show |
Series | middle-end Add support for SLP vectorization of complex number instructions. | expand |
ping > -----Original Message----- > From: Gcc-patches <gcc-patches-bounces@gcc.gnu.org> On Behalf Of Tamar > Christina > Sent: Friday, September 25, 2020 3:31 PM > To: gcc-patches@gcc.gnu.org > Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; nd <nd@arm.com>; > Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com> > Subject: [PATCH v2 13/16]Arm: Add support for auto-vectorization using HF > mode. > > Hi All, > > This adds support to the auto-vectorizer to support HFmode vectorization for > AArch32. This is supported when +fp16 is used. I wonder if I should disable > the returning of the type if the option isn't enabled. > > At the moment it will be returned but the vectorizer will try and fail to use it. > It wastes a few compile cycles but doesn't result in bad code. > > Bootstrapped Regtested on arm-none-linux-gnueabihf and no issues. > > Ok for master? > > Thanks, > Tamar > > gcc/ChangeLog: > > * config/arm/arm.c (arm_preferred_simd_mode): Add E_HFmode. > > gcc/testsuite/ChangeLog: > > * gcc.target/arm/vect-half-floats.c: New test. > > --
> -----Original Message----- > From: Tamar Christina <Tamar.Christina@arm.com> > Sent: 25 September 2020 15:31 > To: gcc-patches@gcc.gnu.org > Cc: nd <nd@arm.com>; Ramana Radhakrishnan > <Ramana.Radhakrishnan@arm.com>; Richard Earnshaw > <Richard.Earnshaw@arm.com>; nickc@redhat.com; Kyrylo Tkachov > <Kyrylo.Tkachov@arm.com> > Subject: [PATCH v2 13/16]Arm: Add support for auto-vectorization using HF > mode. > > Hi All, > > This adds support to the auto-vectorizer to support HFmode vectorization for > AArch32. This is supported when +fp16 is used. I wonder if I should disable > the returning of the type if the option isn't enabled. > > At the moment it will be returned but the vectorizer will try and fail to use > it. It wastes a few compile cycles but doesn't result in bad code. > > Bootstrapped Regtested on arm-none-linux-gnueabihf and no issues. > > Ok for master? Ok. Thanks, Kyrill > > Thanks, > Tamar > > gcc/ChangeLog: > > * config/arm/arm.c (arm_preferred_simd_mode): Add E_HFmode. > > gcc/testsuite/ChangeLog: > > * gcc.target/arm/vect-half-floats.c: New test. > > --
On Fri, 25 Sept 2020 at 16:31, Tamar Christina <tamar.christina@arm.com> wrote: > > Hi All, > > This adds support to the auto-vectorizer to support HFmode vectorization for > AArch32. This is supported when +fp16 is used. I wonder if I should disable > the returning of the type if the option isn't enabled. > > At the moment it will be returned but the vectorizer will try and fail to use > it. It wastes a few compile cycles but doesn't result in bad code. > > Bootstrapped Regtested on arm-none-linux-gnueabihf and no issues. > > Ok for master? > > Thanks, > Tamar > > gcc/ChangeLog: > > * config/arm/arm.c (arm_preferred_simd_mode): Add E_HFmode. > > gcc/testsuite/ChangeLog: > > * gcc.target/arm/vect-half-floats.c: New test. > Hi Tamar, I have noticed problems with the new tests: ERROR: gcc.target/arm/vect-half-floats.c: unknown effective target keyword `target_float16' for " dg-require-effective-target 2 target_float16 " This is because there are two typos in the new test: +/* { dg-require-effective-target target_float16 } */ +/* { dg-add-options for_float16 } */ where target_float16 and for_float16 should just be "float16" However, this is not sufficient for the test to pass on my side, because the test is then compiled with: -ansi -pedantic-errors -mfp16-format=ieee -Ofast -ftree-vectorize -fdump-tree-vect-all -std=c11 leading to: vect-half-floats.c:7:11: error: ISO C does not support the '_Float16' type [-Wpedantic] This patch makes the test pass for me: diff --git a/gcc/testsuite/gcc.target/arm/vect-half-floats.c b/gcc/testsuite/gcc.target/arm/vect-half-floats.c index ebfe7f9..49ca2e9 100644 --- a/gcc/testsuite/gcc.target/arm/vect-half-floats.c +++ b/gcc/testsuite/gcc.target/arm/vect-half-floats.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ -/* { dg-require-effective-target target_float16 } */ +/* { dg-options "-Ofast -ftree-vectorize -fdump-tree-vect-all -std=c11" } */ +/* { dg-require-effective-target float16 } */ /* { dg-require-effective-target arm_fp16_ok } */ -/* { dg-add-options for_float16 } */ -/* { dg-additional-options "-Ofast -ftree-vectorize -fdump-tree-vect-all -std=c11" } */ +/* { dg-add-options float16 } */ void foo (_Float16 n1[], _Float16 n2[], _Float16 r[], int n) { OK? I'm sure why you didn't see problems with you ran the validations? Thanks, Christophe > --
> -----Original Message----- > From: Gcc-patches <gcc-patches-bounces@gcc.gnu.org> On Behalf Of > Christophe Lyon via Gcc-patches > Sent: 14 December 2020 10:16 > To: Tamar Christina <Tamar.Christina@arm.com> > Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; nd <nd@arm.com>; > gcc Patches <gcc-patches@gcc.gnu.org>; Ramana Radhakrishnan > <Ramana.Radhakrishnan@arm.com> > Subject: Re: [PATCH v2 13/16]Arm: Add support for auto-vectorization using > HF mode. > > On Fri, 25 Sept 2020 at 16:31, Tamar Christina <tamar.christina@arm.com> > wrote: > > > > Hi All, > > > > This adds support to the auto-vectorizer to support HFmode vectorization > for > > AArch32. This is supported when +fp16 is used. I wonder if I should disable > > the returning of the type if the option isn't enabled. > > > > At the moment it will be returned but the vectorizer will try and fail to use > > it. It wastes a few compile cycles but doesn't result in bad code. > > > > Bootstrapped Regtested on arm-none-linux-gnueabihf and no issues. > > > > Ok for master? > > > > Thanks, > > Tamar > > > > gcc/ChangeLog: > > > > * config/arm/arm.c (arm_preferred_simd_mode): Add E_HFmode. > > > > gcc/testsuite/ChangeLog: > > > > * gcc.target/arm/vect-half-floats.c: New test. > > > > Hi Tamar, > > I have noticed problems with the new tests: > ERROR: gcc.target/arm/vect-half-floats.c: unknown effective target > keyword `target_float16' for " dg-require-effective-target 2 > target_float16 " > > This is because there are two typos in the new test: > +/* { dg-require-effective-target target_float16 } */ > +/* { dg-add-options for_float16 } */ > where target_float16 and for_float16 should just be "float16" > > However, this is not sufficient for the test to pass on my side, > because the test is then compiled with: > -ansi -pedantic-errors -mfp16-format=ieee -Ofast -ftree-vectorize > -fdump-tree-vect-all -std=c11 > leading to: > vect-half-floats.c:7:11: error: ISO C does not support the '_Float16' > type [-Wpedantic] > > > This patch makes the test pass for me: > > diff --git a/gcc/testsuite/gcc.target/arm/vect-half-floats.c > b/gcc/testsuite/gcc.target/arm/vect-half-floats.c > index ebfe7f9..49ca2e9 100644 > --- a/gcc/testsuite/gcc.target/arm/vect-half-floats.c > +++ b/gcc/testsuite/gcc.target/arm/vect-half-floats.c > @@ -1,8 +1,8 @@ > /* { dg-do compile } */ > -/* { dg-require-effective-target target_float16 } */ > +/* { dg-options "-Ofast -ftree-vectorize -fdump-tree-vect-all -std=c11" } */ > +/* { dg-require-effective-target float16 } */ > /* { dg-require-effective-target arm_fp16_ok } */ > -/* { dg-add-options for_float16 } */ > -/* { dg-additional-options "-Ofast -ftree-vectorize > -fdump-tree-vect-all -std=c11" } */ > +/* { dg-add-options float16 } */ > > void foo (_Float16 n1[], _Float16 n2[], _Float16 r[], int n) > { > > > OK? Oops, sorry for not catching these. Ok. Thanks, Kyrill > > I'm sure why you didn't see problems with you ran the validations? > > Thanks, > > Christophe > > > > > > > > > > --
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 022ef6c3f1d723bdf421268c81cd0c759c414d9a..8ca6b913fddb74cd6f4867efc0a7264184c59db0 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -28917,6 +28917,8 @@ arm_preferred_simd_mode (scalar_mode mode) if (TARGET_NEON) switch (mode) { + case E_HFmode: + return TARGET_NEON_VECTORIZE_DOUBLE ? V4HFmode : V8HFmode; case E_SFmode: return TARGET_NEON_VECTORIZE_DOUBLE ? V2SFmode : V4SFmode; case E_SImode: diff --git a/gcc/testsuite/gcc.target/arm/vect-half-floats.c b/gcc/testsuite/gcc.target/arm/vect-half-floats.c new file mode 100644 index 0000000000000000000000000000000000000000..ebfe7f964442a09053b0cbe04bed425e36b0af96 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/vect-half-floats.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target target_float16 } */ +/* { dg-require-effective-target arm_fp16_ok } */ +/* { dg-add-options for_float16 } */ +/* { dg-additional-options "-Ofast -ftree-vectorize -fdump-tree-vect-all -std=c11" } */ + +void foo (_Float16 n1[], _Float16 n2[], _Float16 r[], int n) +{ + for (int i = 0; i < n; i++) + r[i] = n1[i] + n2[i]; +} + +/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */ +