bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another minor arm assembler bug


From: Frank Yellin
Subject: Another minor arm assembler bug
Date: Mon, 25 Jun 2001 18:08:00 -0700 (PDT)

The c-arm.texi file claims:

    @cindex @code{LDR reg,=<label>} pseudo op, ARM
     ....
    If expression evaluates to a numeric constant then a MOV or MVN
    instruction will be used in place of the LDR instruction, if the
    constant can be generated by either of these instructions. 
     ...

However, assembly language code such as 
     ldr  r0, =-12
generates
     ldr  r0, [literal-pool entry]
rather than
     mvn  r0, #11
as documented.

In the function do_ldst(), you check:

      if (inst.reloc.exp.X_op == O_constant
          && (value = validate_immediate(inst.reloc.exp.X_add_number)) != FAIL)

You should probably also include an additional case:

   else if (........ && 
         value = validate_immediate(~inst.reloc.exp.X_add_number)) != FAIL){

          <almost identical code using using mvn instead of mov>
      }

There may be someway of doing this instead using negate_data_op, instead, but I
didn't investigate that too thoroughly.

Thanks.


== Frank Yellin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]