[gcc r14-8662] AArch64: relax cbranch tests to accepted inverted branches [PR113502]

Tamar Christina tnfchris@gcc.gnu.org
Wed Jan 31 14:53:05 GMT 2024


https://gcc.gnu.org/g:f7935beef7b02fbba0adf33fb2ba5c0a27d7e9ff

commit r14-8662-gf7935beef7b02fbba0adf33fb2ba5c0a27d7e9ff
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Wed Jan 31 14:52:59 2024 +0000

    AArch64: relax cbranch tests to accepted inverted branches [PR113502]
    
    Recently something in the midend had started inverting the branches by inverting
    the condition and the branches.
    
    While this is fine, it makes it hard to actually test.  In RTL I disable
    scheduling and BB reordering to prevent this.  But in GIMPLE there seems to be
    nothing I can do.  __builtin_expect seems to have no impact on the change since
    I suspect this is happening during expand where conditions can be flipped
    regardless of probability during compare_and_branch.
    
    Since the mid-end has plenty of correctness tests, this weakens the backend
    tests to just check that a correct looking sequence is emitted.
    
    gcc/testsuite/ChangeLog:
    
            PR testsuite/113502
            * gcc.target/aarch64/sve/vect-early-break-cbranch.c: Ignore exact branch.
            * gcc.target/aarch64/vect-early-break-cbranch.c: Likewise.

Diff:
---
 .../gcc.target/aarch64/sve/vect-early-break-cbranch.c        | 12 ++++++------
 gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c  | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/sve/vect-early-break-cbranch.c b/gcc/testsuite/gcc.target/aarch64/sve/vect-early-break-cbranch.c
index d15053553f94..d7cef1105410 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/vect-early-break-cbranch.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/vect-early-break-cbranch.c
@@ -9,7 +9,7 @@ int b[N] = {0};
 **	...
 **	cmpgt	p[0-9]+.s, p[0-9]+/z, z[0-9]+.s, #0
 **	ptest	p[0-9]+, p[0-9]+.b
-**	b.any	\.L[0-9]+
+**	b.(any|none)	\.L[0-9]+
 **	...
 */
 void f1 ()
@@ -26,7 +26,7 @@ void f1 ()
 **	...
 **	cmpge	p[0-9]+.s, p[0-9]+/z, z[0-9]+.s, #0
 **	ptest	p[0-9]+, p[0-9]+.b
-**	b.any	\.L[0-9]+
+**	b.(any|none)	\.L[0-9]+
 **	...
 */
 void f2 ()
@@ -43,7 +43,7 @@ void f2 ()
 **	...
 **	cmpeq	p[0-9]+.s, p[0-9]+/z, z[0-9]+.s, #0
 **	ptest	p[0-9]+, p[0-9]+.b
-**	b.any	\.L[0-9]+
+**	b.(any|none)	\.L[0-9]+
 **	...
 */
 void f3 ()
@@ -60,7 +60,7 @@ void f3 ()
 **	...
 **	cmpne	p[0-9]+.s, p[0-9]+/z, z[0-9]+.s, #0
 **	ptest	p[0-9]+, p[0-9]+.b
-**	b.any	\.L[0-9]+
+**	b.(any|none)	\.L[0-9]+
 **	...
 */
 void f4 ()
@@ -77,7 +77,7 @@ void f4 ()
 **	...
 **	cmplt	p[0-9]+.s, p7/z, z[0-9]+.s, #0
 **	ptest	p[0-9]+, p[0-9]+.b
-**	b.any	.L[0-9]+
+**	b.(any|none)	.L[0-9]+
 **	...
 */
 void f5 ()
@@ -94,7 +94,7 @@ void f5 ()
 **	...
 **	cmple	p[0-9]+.s, p[0-9]+/z, z[0-9]+.s, #0
 **	ptest	p[0-9]+, p[0-9]+.b
-**	b.any	\.L[0-9]+
+**	b.(any|none)	\.L[0-9]+
 **	...
 */
 void f6 ()
diff --git a/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c b/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c
index a5e7b94827dd..673b781eb6d0 100644
--- a/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c
+++ b/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c
@@ -15,7 +15,7 @@ int b[N] = {0};
 **	cmgt	v[0-9]+.4s, v[0-9]+.4s, #0
 **	umaxp	v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s
 **	fmov	x[0-9]+, d[0-9]+
-**	cbnz	x[0-9]+, \.L[0-9]+
+**	cbn?z	x[0-9]+, \.L[0-9]+
 **	...
 */
 void f1 ()
@@ -34,7 +34,7 @@ void f1 ()
 **	cmge	v[0-9]+.4s, v[0-9]+.4s, #0
 **	umaxp	v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s
 **	fmov	x[0-9]+, d[0-9]+
-**	cbnz	x[0-9]+, \.L[0-9]+
+**	cbn?z	x[0-9]+, \.L[0-9]+
 **	...
 */
 void f2 ()
@@ -53,7 +53,7 @@ void f2 ()
 **	cmeq	v[0-9]+.4s, v[0-9]+.4s, #0
 **	umaxp	v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s
 **	fmov	x[0-9]+, d[0-9]+
-**	cbnz	x[0-9]+, \.L[0-9]+
+**	cbn?z	x[0-9]+, \.L[0-9]+
 **	...
 */
 void f3 ()
@@ -72,7 +72,7 @@ void f3 ()
 **	cmtst	v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s
 **	umaxp	v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s
 **	fmov	x[0-9]+, d[0-9]+
-**	cbnz	x[0-9]+, \.L[0-9]+
+**	cbn?z	x[0-9]+, \.L[0-9]+
 **	...
 */
 void f4 ()
@@ -91,7 +91,7 @@ void f4 ()
 **	cmlt	v[0-9]+.4s, v[0-9]+.4s, #0
 **	umaxp	v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s
 **	fmov	x[0-9]+, d[0-9]+
-**	cbnz	x[0-9]+, \.L[0-9]+
+**	cbn?z	x[0-9]+, \.L[0-9]+
 **	...
 */
 void f5 ()
@@ -110,7 +110,7 @@ void f5 ()
 **	cmle	v[0-9]+.4s, v[0-9]+.4s, #0
 **	umaxp	v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s
 **	fmov	x[0-9]+, d[0-9]+
-**	cbnz	x[0-9]+, \.L[0-9]+
+**	cbn?z	x[0-9]+, \.L[0-9]+
 **	...
 */
 void f6 ()


More information about the Gcc-cvs mailing list