This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/3] MIPS/GAS/testsuite: Extend the R5900 short loop fix test with border cases


The R5900 short loop fix applies up to and including six loop
instructions including the branch and the delay slot.  This change
extends its test with the border cases of six and seven instructions.
For the latter case, the fix does not apply, which is now also verified.
---
 gas/testsuite/gas/mips/r5900.d | 18 +++++++++++++++++-
 gas/testsuite/gas/mips/r5900.s | 32 ++++++++++++++++++++++++++++----
 2 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/gas/testsuite/gas/mips/r5900.d b/gas/testsuite/gas/mips/r5900.d
index 7ef9a8a96e..082c204a6f 100644
--- a/gas/testsuite/gas/mips/r5900.d
+++ b/gas/testsuite/gas/mips/r5900.d
@@ -87,7 +87,23 @@ Disassembly of section \.text:
 [0-9a-f]+ <[^>]*> 2403012c 	li	\$3,300
 [0-9a-f]+ <[^>]*> 2063ffff 	addi	\$3,\$3,-1
 [0-9a-f]+ <[^>]*> 2084ffff 	addi	\$4,\$4,-1
-[0-9a-f]+ <[^>]*> 1460fffd 	bnez	\$3,[0-9a-f]+ <short_loop1>
+[0-9a-f]+ <[^>]*> 1460fffd 	bnez	\$3,[0-9a-f]+ <short_loop3>
 [0-9a-f]+ <[^>]*> 00000000 	nop
+[0-9a-f]+ <[^>]*> 2403012c 	li	\$3,300
+[0-9a-f]+ <[^>]*> 2063ffff 	addi	\$3,\$3,-1
+[0-9a-f]+ <[^>]*> 2084ffff 	addi	\$4,\$4,-1
+[0-9a-f]+ <[^>]*> 20a5ffff 	addi	\$5,\$5,-1
+[0-9a-f]+ <[^>]*> 20c6ffff 	addi	\$6,\$6,-1
+[0-9a-f]+ <[^>]*> 20e7ffff 	addi	\$7,\$7,-1
+[0-9a-f]+ <[^>]*> 1460fffa 	bnez	\$3,[0-9a-f]+ <short_loop6>
+[0-9a-f]+ <[^>]*> 00000000 	nop
+[0-9a-f]+ <[^>]*> 2403012c 	li	\$3,300
+[0-9a-f]+ <[^>]*> 2063ffff 	addi	\$3,\$3,-1
+[0-9a-f]+ <[^>]*> 2084ffff 	addi	\$4,\$4,-1
+[0-9a-f]+ <[^>]*> 20a5ffff 	addi	\$5,\$5,-1
+[0-9a-f]+ <[^>]*> 20c6ffff 	addi	\$6,\$6,-1
+[0-9a-f]+ <[^>]*> 20e7ffff 	addi	\$7,\$7,-1
+[0-9a-f]+ <[^>]*> 1460fffa 	bnez	\$3,[0-9a-f]+ <short_loop7>
+[0-9a-f]+ <[^>]*> 2108ffff 	addi	\$8,\$8,-1
 [0-9a-f]+ <[^>]*> 24040003 	li	\$4,3
 	\.\.\.
diff --git a/gas/testsuite/gas/mips/r5900.s b/gas/testsuite/gas/mips/r5900.s
index 3a16e28f28..9d16b25ece 100644
--- a/gas/testsuite/gas/mips/r5900.s
+++ b/gas/testsuite/gas/mips/r5900.s
@@ -120,13 +120,37 @@ stuff:
 	.set pop
 	.set push
 	.set reorder
-	# Short loop fix.
+	# Test the short loop fix with 3 loop instructions.
 	li $3, 300
-short_loop1:
+short_loop3:
 	addi $3, -1
 	addi $4, -1
-	# NOP should be inserted in branch delay.
-	bne $3, $0, short_loop1
+	# A NOP will be inserted in the branch delay slot.
+	bne $3, $0, short_loop3
+
+	# Test the short loop fix with 6 loop instructions.
+	li $3, 300
+short_loop6:
+	addi $3, -1
+	addi $4, -1
+	addi $5, -1
+	addi $6, -1
+	addi $7, -1
+	# A NOP will be inserted in the branch delay slot.
+	bne $3, $0, short_loop6
+
+	# Test the short loop fix with 7 loop instructions.
+	li $3, 300
+short_loop7:
+	addi $3, -1
+	addi $4, -1
+	addi $5, -1
+	addi $6, -1
+	addi $7, -1
+	addi $8, -1
+	# The short loop fix does not apply for loops with
+	# more than 6 instructions.
+	bne $3, $0, short_loop7
 
 	li $4, 3
 	.set pop
-- 
2.16.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]