public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]Arm: Update early-break tests to accept thumb output too.
@ 2024-01-09 12:02 Tamar Christina
  2024-01-09 12:12 ` Kyrylo Tkachov
  0 siblings, 1 reply; 3+ messages in thread
From: Tamar Christina @ 2024-01-09 12:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, Richard.Earnshaw, nickc, Kyrylo.Tkachov

[-- Attachment #1: Type: text/plain, Size: 2246 bytes --]

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
--- 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 ()




-- 

[-- Attachment #2: rb18137.patch --]
[-- Type: text/plain, Size: 1835 bytes --]

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 ()




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH]Arm: Update early-break tests to accept thumb output too.
  2024-01-09 12:02 [PATCH]Arm: Update early-break tests to accept thumb output too Tamar Christina
@ 2024-01-09 12:12 ` Kyrylo Tkachov
  2024-01-09 13:09   ` Tamar Christina
  0 siblings, 1 reply; 3+ messages in thread
From: Kyrylo Tkachov @ 2024-01-09 12:12 UTC (permalink / raw)
  To: Tamar Christina, gcc-patches; +Cc: nd, Richard Earnshaw, nickc



> -----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 ()
> 
> 
> 
> 
> --

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH]Arm: Update early-break tests to accept thumb output too.
  2024-01-09 12:12 ` Kyrylo Tkachov
@ 2024-01-09 13:09   ` Tamar Christina
  0 siblings, 0 replies; 3+ messages in thread
From: Tamar Christina @ 2024-01-09 13:09 UTC (permalink / raw)
  To: Kyrylo Tkachov, gcc-patches; +Cc: nd, Richard Earnshaw, nickc

> > 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 ()
> >
> >
> >
> >
> > --

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-09 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 12:02 [PATCH]Arm: Update early-break tests to accept thumb output too Tamar Christina
2024-01-09 12:12 ` Kyrylo Tkachov
2024-01-09 13:09   ` Tamar Christina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).