[3/4] Add multiple branches to ppc64 single step through atomic sequence testcase

Message ID 1395978111-30706-3-git-send-email-anton@samba.org
State Superseded
Headers

Commit Message

Anton Blanchard March 28, 2014, 3:41 a.m. UTC
  Test 3 conditional branches in an atomic sequence, 2 to the same
destination.

gdb/testsuite/
2014-03-28  Anton Blanchard  <anton@samba.org>

	* gdb.arch/ppc64-atomic-inst.s: Add second and third branch
	inside atomic sequence.
---
 gdb/testsuite/gdb.arch/ppc64-atomic-inst.s | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
  

Comments

Joel Brobecker March 28, 2014, 1:14 p.m. UTC | #1
> Test 3 conditional branches in an atomic sequence, 2 to the same
> destination.
> 
> gdb/testsuite/
> 2014-03-28  Anton Blanchard  <anton@samba.org>
> 
> 	* gdb.arch/ppc64-atomic-inst.s: Add second and third branch
> 	inside atomic sequence.

Just a thought - is there no value in keeping the old assembly code
and creating an additional testcase? It would be very similar to
the one you already have, but then you'd be covering most cases...
Otherwise, the patch seems fine.

> ---
>  gdb/testsuite/gdb.arch/ppc64-atomic-inst.s | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s
> index 15ccfd9..0521170 100644
> --- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s
> +++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s
> @@ -39,18 +39,30 @@ main:
>  1:	lwarx	5,0,4
>  	cmpwi	5,0
>  	bne	2f
> +	cmpwi	5,1
> +	beq	3f
> +	cmpwi	5,2
> +	beq	3f	/* branch to same destination */
>  	addi	5,5,1
>  	stwcx.	5,0,4
>  	bne	1b
>  
> -	std	0,0(4)
> -2:	ldarx	5,0,4
> +2:	nop
> +
> +3:	std	0,0(4)
> +1:	ldarx	5,0,4
>  	cmpdi	5,0
> -	bne	3f
> +	bne	2f
> +	cmpdi	5,1
> +	beq	3f
> +	cmpwi	5,2
> +	beq	3f	/* branch to same destination */
>  	addi	5,5,1
>  	stdcx.	5,0,4
>  	bne	1b
>  
> +2:	nop
> +
>  3:	li	3,0
>  	blr
>  
> -- 
> 1.8.3.2
  

Patch

diff --git a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s
index 15ccfd9..0521170 100644
--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s
+++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s
@@ -39,18 +39,30 @@  main:
 1:	lwarx	5,0,4
 	cmpwi	5,0
 	bne	2f
+	cmpwi	5,1
+	beq	3f
+	cmpwi	5,2
+	beq	3f	/* branch to same destination */
 	addi	5,5,1
 	stwcx.	5,0,4
 	bne	1b
 
-	std	0,0(4)
-2:	ldarx	5,0,4
+2:	nop
+
+3:	std	0,0(4)
+1:	ldarx	5,0,4
 	cmpdi	5,0
-	bne	3f
+	bne	2f
+	cmpdi	5,1
+	beq	3f
+	cmpwi	5,2
+	beq	3f	/* branch to same destination */
 	addi	5,5,1
 	stdcx.	5,0,4
 	bne	1b
 
+2:	nop
+
 3:	li	3,0
 	blr