diff mbox series

Arm: Update early-break tests to accept thumb output too.

Message ID patch-18137-tamar@arm.com
State New
Headers show
Series Arm: Update early-break tests to accept thumb output too. | expand

Commit Message

Tamar Christina Jan. 9, 2024, 12:02 p.m. UTC
Hi All,

The tests I recently added for early break fail in thumb mode
because in thumb mode `cbz/cbnz` exist and so the cmp+branch
is fused.  This updates the testcases to accept either output.

Tested on arm-none-linux-gnueabihf with -mthumb/-marm.

Ok for master?

Thanks,
Tamar

gcc/testsuite/ChangeLog:

	* gcc.target/arm/vect-early-break-cbranch.c: Accept thumb output.

--- inline copy of patch -- 
diff --git a/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c b/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
index f57bbd8be428d75dcf35aa194b5892fe04124cf6..d5c6d56ec869b8fa868acb78d4c3f40b2a241953 100644




--
diff --git a/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c b/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
index f57bbd8be428d75dcf35aa194b5892fe04124cf6..d5c6d56ec869b8fa868acb78d4c3f40b2a241953 100644
--- a/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
+++ b/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
@@ -16,8 +16,12 @@ int b[N] = {0};
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f1 ()
@@ -37,8 +41,12 @@ void f1 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f2 ()
@@ -58,8 +66,12 @@ void f2 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f3 ()
@@ -80,8 +92,12 @@ void f3 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f4 ()
@@ -101,8 +117,12 @@ void f4 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f5 ()
@@ -122,8 +142,12 @@ void f5 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f6 ()

Comments

Kyrylo Tkachov Jan. 9, 2024, 12:12 p.m. UTC | #1
> -----Original Message-----
> From: Tamar Christina <Tamar.Christina@arm.com>
> Sent: Tuesday, January 9, 2024 12:02 PM
> To: gcc-patches@gcc.gnu.org
> Cc: nd <nd@arm.com>; Richard Earnshaw <Richard.Earnshaw@arm.com>;
> nickc@redhat.com; Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
> Subject: [PATCH]Arm: Update early-break tests to accept thumb output too.
> 
> Hi All,
> 
> The tests I recently added for early break fail in thumb mode
> because in thumb mode `cbz/cbnz` exist and so the cmp+branch
> is fused.  This updates the testcases to accept either output.
> 
> Tested on arm-none-linux-gnueabihf with -mthumb/-marm.
> 
> Ok for master?
> 
> Thanks,
> Tamar
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/arm/vect-early-break-cbranch.c: Accept thumb output.
> 
> --- inline copy of patch --
> diff --git a/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
> b/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
> index
> f57bbd8be428d75dcf35aa194b5892fe04124cf6..d5c6d56ec869b8fa868acb78d4c
> 3f40b2a241953 100644
> --- a/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
> +++ b/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
> @@ -16,8 +16,12 @@ int b[N] = {0};
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vmov	r[0-9]+, s[0-9]+	@ int
> +** (
>  **	cmp	r[0-9]+, #0
>  **	bne	\.L[0-9]+
> +** |
> +**	cbnz	r[0-9]+, \.L.+
> +** )

If we want to be a bit fancy, I think the scan syntax allows to add a target selector, you should be able to do
** | { target_thumb }
**   cbnz...

Ok for trunk with or without that change.
Thanks,
Kyrill

>  **	...
>  */
>  void f1 ()
> @@ -37,8 +41,12 @@ void f1 ()
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vmov	r[0-9]+, s[0-9]+	@ int
> +** (
>  **	cmp	r[0-9]+, #0
>  **	bne	\.L[0-9]+
> +** |
> +**	cbnz	r[0-9]+, \.L.+
> +** )
>  **	...
>  */
>  void f2 ()
> @@ -58,8 +66,12 @@ void f2 ()
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vmov	r[0-9]+, s[0-9]+	@ int
> +** (
>  **	cmp	r[0-9]+, #0
>  **	bne	\.L[0-9]+
> +** |
> +**	cbnz	r[0-9]+, \.L.+
> +** )
>  **	...
>  */
>  void f3 ()
> @@ -80,8 +92,12 @@ void f3 ()
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vmov	r[0-9]+, s[0-9]+	@ int
> +** (
>  **	cmp	r[0-9]+, #0
>  **	bne	\.L[0-9]+
> +** |
> +**	cbnz	r[0-9]+, \.L.+
> +** )
>  **	...
>  */
>  void f4 ()
> @@ -101,8 +117,12 @@ void f4 ()
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vmov	r[0-9]+, s[0-9]+	@ int
> +** (
>  **	cmp	r[0-9]+, #0
>  **	bne	\.L[0-9]+
> +** |
> +**	cbnz	r[0-9]+, \.L.+
> +** )
>  **	...
>  */
>  void f5 ()
> @@ -122,8 +142,12 @@ void f5 ()
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
>  **	vmov	r[0-9]+, s[0-9]+	@ int
> +** (
>  **	cmp	r[0-9]+, #0
>  **	bne	\.L[0-9]+
> +** |
> +**	cbnz	r[0-9]+, \.L.+
> +** )
>  **	...
>  */
>  void f6 ()
> 
> 
> 
> 
> --
Tamar Christina Jan. 9, 2024, 1:09 p.m. UTC | #2
> > 3f40b2a241953 100644
> > --- a/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
> > +++ b/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
> > @@ -16,8 +16,12 @@ int b[N] = {0};
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vmov	r[0-9]+, s[0-9]+	@ int
> > +** (
> >  **	cmp	r[0-9]+, #0
> >  **	bne	\.L[0-9]+
> > +** |
> > +**	cbnz	r[0-9]+, \.L.+
> > +** )
> 
> If we want to be a bit fancy, I think the scan syntax allows to add a target selector,
> you should be able to do
> ** | { target_thumb }
> **   cbnz...
> 

I tried, but it looks like this doesn't work because the | is not a TCL feature, so the contents
of the conditional match gets interpreted as regexpr:

body: .*\tvcgt.s32      q[0-9]+, q[0-9]+, #0
\tvpmax.u32     d[0-9]+, d[0-9]+, d[0-9]+
\tvpmax.u32     d[0-9]+, d[0-9]+, d[0-9]+
\tvmov  r[0-9]+, s[0-9]+        @ int
(?:\tcmp        r[0-9]+, #0
\tbne   \.L[0-9]+
\t| { target_thumb }
\tcbnz  r[0-9]+, \.L.+
).*


> Ok for trunk with or without that change.

Will commit without,

Thanks,
Tamar

> Thanks,
> Kyrill
> 
> >  **	...
> >  */
> >  void f1 ()
> > @@ -37,8 +41,12 @@ void f1 ()
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vmov	r[0-9]+, s[0-9]+	@ int
> > +** (
> >  **	cmp	r[0-9]+, #0
> >  **	bne	\.L[0-9]+
> > +** |
> > +**	cbnz	r[0-9]+, \.L.+
> > +** )
> >  **	...
> >  */
> >  void f2 ()
> > @@ -58,8 +66,12 @@ void f2 ()
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vmov	r[0-9]+, s[0-9]+	@ int
> > +** (
> >  **	cmp	r[0-9]+, #0
> >  **	bne	\.L[0-9]+
> > +** |
> > +**	cbnz	r[0-9]+, \.L.+
> > +** )
> >  **	...
> >  */
> >  void f3 ()
> > @@ -80,8 +92,12 @@ void f3 ()
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vmov	r[0-9]+, s[0-9]+	@ int
> > +** (
> >  **	cmp	r[0-9]+, #0
> >  **	bne	\.L[0-9]+
> > +** |
> > +**	cbnz	r[0-9]+, \.L.+
> > +** )
> >  **	...
> >  */
> >  void f4 ()
> > @@ -101,8 +117,12 @@ void f4 ()
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vmov	r[0-9]+, s[0-9]+	@ int
> > +** (
> >  **	cmp	r[0-9]+, #0
> >  **	bne	\.L[0-9]+
> > +** |
> > +**	cbnz	r[0-9]+, \.L.+
> > +** )
> >  **	...
> >  */
> >  void f5 ()
> > @@ -122,8 +142,12 @@ void f5 ()
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
> >  **	vmov	r[0-9]+, s[0-9]+	@ int
> > +** (
> >  **	cmp	r[0-9]+, #0
> >  **	bne	\.L[0-9]+
> > +** |
> > +**	cbnz	r[0-9]+, \.L.+
> > +** )
> >  **	...
> >  */
> >  void f6 ()
> >
> >
> >
> >
> > --
diff mbox series

Patch

--- a/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
+++ b/gcc/testsuite/gcc.target/arm/vect-early-break-cbranch.c
@@ -16,8 +16,12 @@  int b[N] = {0};
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f1 ()
@@ -37,8 +41,12 @@  void f1 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f2 ()
@@ -58,8 +66,12 @@  void f2 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f3 ()
@@ -80,8 +92,12 @@  void f3 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f4 ()
@@ -101,8 +117,12 @@  void f4 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f5 ()
@@ -122,8 +142,12 @@  void f5 ()
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vpmax.u32	d[0-9]+, d[0-9]+, d[0-9]+
 **	vmov	r[0-9]+, s[0-9]+	@ int
+** (
 **	cmp	r[0-9]+, #0
 **	bne	\.L[0-9]+
+** |
+**	cbnz	r[0-9]+, \.L.+
+** )
 **	...
 */
 void f6 ()