]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use MVN to build simple inverted constants.
authorNick Clifton <nickc@redhat.com>
Wed, 27 Jun 2001 16:22:47 +0000 (16:22 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 27 Jun 2001 16:22:47 +0000 (16:22 +0000)
gas/ChangeLog
gas/config/tc-arm.c

index 6f390b6303154b7c3186641888764903444fbd47..8d1251a5a88f076be7cc6be0449d79a33274984a 100644 (file)
@@ -1,3 +1,8 @@
+2001-06-27  Nick Clifton  <nickc@cambridge.redhat.com>
+
+       * config/tc-arm.c (do_ldst): Use MVN to build simple inverted
+       constants.
+
 2000-06-20  Tom Rix <trix@redhat.com>
 
        * config/tc-ppc.c (ppc_comm): Change default alignment to 4 bytes.
index 99aff8ef31307494bc2519d2255b3d6b46e54fc0..a6e13a9a87b242bc72c32f0c50ffe3b48a0762bb 100644 (file)
@@ -4431,38 +4431,52 @@ do_ldst (str, flags)
          return;
        }
 
-      if (inst.reloc.exp.X_op == O_constant
-         && (value = validate_immediate (inst.reloc.exp.X_add_number)) != FAIL)
-       {
-         /* This can be done with a mov instruction.  */
-         inst.instruction &= LITERAL_MASK;
-         inst.instruction |= INST_IMMEDIATE | (OPCODE_MOV << DATA_OP_SHIFT);
-         inst.instruction |= (flags & COND_MASK) | (value & 0xfff);
-         end_of_line (str);
-         return;
-       }
-      else
+      if (inst.reloc.exp.X_op == O_constant)
        {
-         /* Insert into literal pool.  */
-         if (add_to_lit_pool () == FAIL)
+         value = validate_immediate (inst.reloc.exp.X_add_number);
+
+         if (value != FAIL)
            {
-             if (!inst.error)
-               inst.error = _("literal pool insertion failed");
+             /* This can be done with a mov instruction.  */
+             inst.instruction &= LITERAL_MASK;
+             inst.instruction |= INST_IMMEDIATE | (OPCODE_MOV << DATA_OP_SHIFT);
+             inst.instruction |= (flags & COND_MASK) | (value & 0xfff);
+             end_of_line (str);
              return;
            }
+         
+         value = validate_immediate (~ inst.reloc.exp.X_add_number);
 
-         /* Change the instruction exp to point to the pool.  */
-         if (halfword)
+         if (value != FAIL)
            {
-             inst.instruction |= HWOFFSET_IMM;
-             inst.reloc.type = BFD_RELOC_ARM_HWLITERAL;
+             /* This can be done with a mvn instruction.  */
+             inst.instruction &= LITERAL_MASK;
+             inst.instruction |= INST_IMMEDIATE | (OPCODE_MVN << DATA_OP_SHIFT);
+             inst.instruction |= (flags & COND_MASK) | (value & 0xfff);
+             end_of_line (str);
+             return;
            }
-         else
-           inst.reloc.type = BFD_RELOC_ARM_LITERAL;
-         inst.reloc.pc_rel = 1;
-         inst.instruction |= (REG_PC << 16);
-         pre_inc = 1;
        }
+
+      /* Insert into literal pool.  */
+      if (add_to_lit_pool () == FAIL)
+       {
+         if (!inst.error)
+           inst.error = _("literal pool insertion failed");
+         return;
+       }
+
+      /* Change the instruction exp to point to the pool.  */
+      if (halfword)
+       {
+         inst.instruction |= HWOFFSET_IMM;
+         inst.reloc.type = BFD_RELOC_ARM_HWLITERAL;
+       }
+      else
+       inst.reloc.type = BFD_RELOC_ARM_LITERAL;
+      inst.reloc.pc_rel = 1;
+      inst.instruction |= (REG_PC << 16);
+      pre_inc = 1;
     }
   else
     {