2007-04-18 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Wed, 18 Apr 2007 13:49:34 +0000 (13:49 +0000)
committerPaul Brook <paul@codesourcery.com>
Wed, 18 Apr 2007 13:49:34 +0000 (13:49 +0000)
gas/testsuite/
* gas/arm/thumb2_add.s: Add rsb #0 test.
* gas/arm/thumb2_add.d: Update expected output.

gas/
* config/tc-arm.c (do_t_rsb): Use 16-bit encoding when possible.

gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/thumb2_add.d
gas/testsuite/gas/arm/thumb2_add.s

index 56b7bab053d27f6f8ad5b8dcb7f5c8099e3bdbe0..110f35b8b048861872463e2ff0a9e7126aafe467 100644 (file)
@@ -1,3 +1,7 @@
+2007-04-18  Paul Brook  <paul@codesourcery.com>
+
+       * config/tc-arm.c (do_t_rsb): Use 16-bit encoding when possible.
+
 2007-04-16  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
 
        * config/tc-sh.c (sh_handle_align):  Call as_bad_where instead
index 9b8db7ab36f9ef44a26ce2fef3d804cee07a100a..b20803f84d89dd286a44e98853406bc32cd5d27a 100644 (file)
@@ -9956,8 +9956,37 @@ do_t_rsb (void)
   inst.instruction |= Rs << 16;
   if (!inst.operands[2].isreg)
     {
-      inst.instruction = (inst.instruction & 0xe1ffffff) | 0x10000000;
-      inst.reloc.type = BFD_RELOC_ARM_T32_IMMEDIATE;
+      bfd_boolean narrow;
+
+      if ((inst.instruction & 0x00100000) != 0)
+       narrow = (current_it_mask == 0);
+      else
+       narrow = (current_it_mask != 0);
+
+      if (Rd > 7 || Rs > 7)
+       narrow = FALSE;
+
+      if (inst.size_req == 4 || !unified_syntax)
+       narrow = FALSE;
+
+      if (inst.reloc.exp.X_op != O_constant
+         || inst.reloc.exp.X_add_number != 0)
+       narrow = FALSE;
+
+      /* Turn rsb #0 into 16-bit neg.  We should probably do this via
+         relaxation, but it doesn't seem worth the hassle.  */
+      if (narrow)
+       {
+         inst.reloc.type = BFD_RELOC_UNUSED;
+         inst.instruction = THUMB_OP16 (T_MNEM_negs);
+         inst.instruction |= Rs << 3;
+         inst.instruction |= Rd;
+       }
+      else
+       {
+         inst.instruction = (inst.instruction & 0xe1ffffff) | 0x10000000;
+         inst.reloc.type = BFD_RELOC_ARM_T32_IMMEDIATE;
+       }
     }
   else
     encode_thumb32_shifted_operand (2);
index 39459e80d7e40e91a7f76bcc71b04e438ed1c1dc..8f6a3907e1c43d6d9d670693e769c59584fbff3d 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-18  Paul Brook  <paul@codesourcery.com>
+
+       * gas/arm/thumb2_add.s: Add rsb #0 test.
+       * gas/arm/thumb2_add.d: Update expected output.
+
 2007-04-04  Paul Brook  <paul@codesourcery.com>
 
        * gas/arm/neon-cov.s: Add new vext test.
index 2d975258e587f5fedcfb2f65e66af1183c855e4c..5100bb691a7a54451f3762ee9b5c05809d385c8e 100644 (file)
@@ -27,4 +27,4 @@ Disassembly of section .text:
 0+04c <[^>]+> a840             add     r0, sp, #256
 0+04e <[^>]+> f50d 6580        add.w   r5, sp, #1024   ; 0x400
 0+052 <[^>]+> f20d 1901        addw    r9, sp, #257    ; 0x101
-0+056 <[^>]+> bf00             nop
+0+056 <[^>]+> 4271             negs    r1, r6
index 3dcd3138fea71d7eb4517e6e410cd5974226e520..a3b178a0529188d5482da2e4a55eca03be7ecf6d 100644 (file)
@@ -28,4 +28,4 @@ thumb2_add:
        add r0, sp, #0x100
        add r5, sp, #0x400
        add r9, sp, #0x101
-       nop
+       rsbs r1, r6, #0
This page took 0.054517 seconds and 4 git commands to generate.