Changed vector size

Message ID 20230327103707.1253143-1-chenyixuan@iscas.ac.cn
State New
Headers
Series Changed vector size |

Commit Message

陈逸轩 March 27, 2023, 10:37 a.m. UTC
  From: Yixuan Chen <chenyixuan@iscas.ac.cn>

Observed a vint type "ABS_EXPR" followed by extra 3 int type "ABS_EXPR". If want to test absolute value optimization for vector, maybe don't need 4 times.

gcc/testsuite/ChangeLog:

2023-03-27  Yixuan Chen  <chenyixuan@iscas.ac.cn>

        * g++.dg/pr94920.C: Declare the vector size as long as int.

---
 gcc/testsuite/g++.dg/pr94920.C | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Richard Biener March 27, 2023, 2:49 p.m. UTC | #1
On Mon, Mar 27, 2023 at 12:37 PM <chenyixuan@iscas.ac.cn> wrote:
>
> From: Yixuan Chen <chenyixuan@iscas.ac.cn>
>
> Observed a vint type "ABS_EXPR" followed by extra 3 int type "ABS_EXPR". If want to test absolute value optimization for vector, maybe don't need 4 times.

A better solution would be to scan a dump before the veclower pass?

> gcc/testsuite/ChangeLog:
>
> 2023-03-27  Yixuan Chen  <chenyixuan@iscas.ac.cn>
>
>         * g++.dg/pr94920.C: Declare the vector size as long as int.
>
> ---
>  gcc/testsuite/g++.dg/pr94920.C | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/g++.dg/pr94920.C b/gcc/testsuite/g++.dg/pr94920.C
> index 126b00478d2..498bef93b3a 100644
> --- a/gcc/testsuite/g++.dg/pr94920.C
> +++ b/gcc/testsuite/g++.dg/pr94920.C
> @@ -2,7 +2,7 @@
>  /* { dg-do compile } */
>  /* { dg-options "-O2 -Wno-psabi -fdump-tree-optimized" } */
>
> -typedef int __attribute__((vector_size(4*sizeof(int)))) vint;
> +typedef int __attribute__((vector_size(sizeof(int)))) vint;
>
>  /* Same form as PR.  */
>  __attribute__((noipa)) unsigned int foo(int x) {
> --
> 2.40.0
>
  
陈逸轩 March 29, 2023, 8:34 a.m. UTC | #2
Thanks for your suggestion!But I met the issue that if I declare a int type variable,this variable can't be converted to vector type. Could you teach me more detail?

Best regards!
Yixuan Chen  

&quot;Richard Biener&quot; &lt;richard.guenther@gmail.com&gt;wrote:
> On Mon, Mar 27, 2023 at 12:37 PM <chenyixuan@iscas.ac.cn> wrote:
> >
> > From: Yixuan Chen <chenyixuan@iscas.ac.cn>
> >
> > Observed a vint type "ABS_EXPR" followed by extra 3 int type "ABS_EXPR". If want to test absolute value optimization for vector, maybe don't need 4 times.
> 
> A better solution would be to scan a dump before the veclower pass?
> 
> > gcc/testsuite/ChangeLog:
> >
> > 2023-03-27  Yixuan Chen  <chenyixuan@iscas.ac.cn>
> >
> >         * g++.dg/pr94920.C: Declare the vector size as long as int.
> >
> > ---
> >  gcc/testsuite/g++.dg/pr94920.C | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/gcc/testsuite/g++.dg/pr94920.C b/gcc/testsuite/g++.dg/pr94920.C
> > index 126b00478d2..498bef93b3a 100644
> > --- a/gcc/testsuite/g++.dg/pr94920.C
> > +++ b/gcc/testsuite/g++.dg/pr94920.C
> > @@ -2,7 +2,7 @@
> >  /* { dg-do compile } */
> >  /* { dg-options "-O2 -Wno-psabi -fdump-tree-optimized" } */
> >
> > -typedef int __attribute__((vector_size(4*sizeof(int)))) vint;
> > +typedef int __attribute__((vector_size(sizeof(int)))) vint;
> >
> >  /* Same form as PR.  */
> >  __attribute__((noipa)) unsigned int foo(int x) {
> > --
> > 2.40.0
> >
  
Richard Biener March 29, 2023, 8:47 a.m. UTC | #3
On Wed, Mar 29, 2023 at 10:35 AM 陈逸轩 <chenyixuan@iscas.ac.cn> wrote:
>
> Thanks for your suggestion!But I met the issue that if I declare a int type variable,this variable can't be converted to vector type. Could you teach me more detail?

I don't understand what you mean.  I have pushed a fix.

Richard.

> Best regards!
> Yixuan Chen
>
> &quot;Richard Biener&quot; &lt;richard.guenther@gmail.com&gt;wrote:
> > On Mon, Mar 27, 2023 at 12:37 PM <chenyixuan@iscas.ac.cn> wrote:
> > >
> > > From: Yixuan Chen <chenyixuan@iscas.ac.cn>
> > >
> > > Observed a vint type "ABS_EXPR" followed by extra 3 int type "ABS_EXPR". If want to test absolute value optimization for vector, maybe don't need 4 times.
> >
> > A better solution would be to scan a dump before the veclower pass?
> >
> > > gcc/testsuite/ChangeLog:
> > >
> > > 2023-03-27  Yixuan Chen  <chenyixuan@iscas.ac.cn>
> > >
> > >         * g++.dg/pr94920.C: Declare the vector size as long as int.
> > >
> > > ---
> > >  gcc/testsuite/g++.dg/pr94920.C | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/gcc/testsuite/g++.dg/pr94920.C b/gcc/testsuite/g++.dg/pr94920.C
> > > index 126b00478d2..498bef93b3a 100644
> > > --- a/gcc/testsuite/g++.dg/pr94920.C
> > > +++ b/gcc/testsuite/g++.dg/pr94920.C
> > > @@ -2,7 +2,7 @@
> > >  /* { dg-do compile } */
> > >  /* { dg-options "-O2 -Wno-psabi -fdump-tree-optimized" } */
> > >
> > > -typedef int __attribute__((vector_size(4*sizeof(int)))) vint;
> > > +typedef int __attribute__((vector_size(sizeof(int)))) vint;
> > >
> > >  /* Same form as PR.  */
> > >  __attribute__((noipa)) unsigned int foo(int x) {
> > > --
> > > 2.40.0
> > >
  

Patch

diff --git a/gcc/testsuite/g++.dg/pr94920.C b/gcc/testsuite/g++.dg/pr94920.C
index 126b00478d2..498bef93b3a 100644
--- a/gcc/testsuite/g++.dg/pr94920.C
+++ b/gcc/testsuite/g++.dg/pr94920.C
@@ -2,7 +2,7 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O2 -Wno-psabi -fdump-tree-optimized" } */
 
-typedef int __attribute__((vector_size(4*sizeof(int)))) vint;
+typedef int __attribute__((vector_size(sizeof(int)))) vint;
 
 /* Same form as PR.  */
 __attribute__((noipa)) unsigned int foo(int x) {