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][ARM][gas] Accept narrow form of tst<condition> rd, rn in Thumb mode


Hi all,

Currently gas fails to assemble:
.syntax unified
it  gt
tstgt.n r0, r4

It seems that it's trying to use a 32-bit encoding when it could use a narrow one.
This patch fixes that. tst doesn't have a "flag setting" variant ("tsts"?) since it's already flag setting, therefore in the do_t_mvn_tst function it should be treated similarly to cmn.

Tests are added and check-gas passes.

Ok to apply to trunk?

Thanks,
Kyrill

[gas/]
2013-10-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * config/tc-arm.c (do_t_mvn_tst): Use narrow form for tst when
    possible.


[gas/testsuite/]
2013-10-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * gas/arm/thumb2_it.s: Add test for narrow tst.
    * gas/arm/thumb2_it.d: Update expected output.
    * gas/arm/thumb2_it_auto.d: Likewise.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 9c8211d..7a26679 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -11267,7 +11267,8 @@ do_t_mvn_tst (void)
 	  || inst.operands[1].shifted
 	  || Rn > 7 || Rm > 7)
 	narrow = FALSE;
-      else if (inst.instruction == T_MNEM_cmn)
+      else if (inst.instruction == T_MNEM_cmn
+	       || inst.instruction == T_MNEM_tst)
 	narrow = TRUE;
       else if (THUMB_SETS_FLAGS (inst.instruction))
 	narrow = !in_it_block ();
diff --git a/gas/testsuite/gas/arm/thumb2_it.d b/gas/testsuite/gas/arm/thumb2_it.d
index b02659f..073d01f 100644
--- a/gas/testsuite/gas/arm/thumb2_it.d
+++ b/gas/testsuite/gas/arm/thumb2_it.d
@@ -60,3 +60,5 @@ Disassembly of section .text:
 0+08a <[^>]+> f1d1 0000 	rsbseq	r0, r1, #0
 0+08e <[^>]+> f1c1 0000 	rsb	r0, r1, #0
 0+092 <[^>]+> 4248      	negs	r0, r1
+0+094 <[^>]+> bfc8      	it	gt
+0+096 <[^>]+> 4220      	tstgt	r0, r4
diff --git a/gas/testsuite/gas/arm/thumb2_it.s b/gas/testsuite/gas/arm/thumb2_it.s
index c12abb6..3b37f34 100644
--- a/gas/testsuite/gas/arm/thumb2_it.s
+++ b/gas/testsuite/gas/arm/thumb2_it.s
@@ -62,3 +62,5 @@ foo:
 	neg r0, r1
 	negs r0, r1
 
+	it gt
+	tstgt.n r0, r4
diff --git a/gas/testsuite/gas/arm/thumb2_it_auto.d b/gas/testsuite/gas/arm/thumb2_it_auto.d
index 03ad87c..384d605 100644
--- a/gas/testsuite/gas/arm/thumb2_it_auto.d
+++ b/gas/testsuite/gas/arm/thumb2_it_auto.d
@@ -60,3 +60,5 @@ Disassembly of section .text:
 0+08a <[^>]+> f1d1 0000 	rsbseq	r0, r1, #0
 0+08e <[^>]+> f1c1 0000 	rsb	r0, r1, #0
 0+092 <[^>]+> 4248      	negs	r0, r1
+0+094 <[^>]+> bfc8      	it	gt
+0+096 <[^>]+> 4220      	tstgt	r0, r4

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