• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inline Assembly: Assembling ARM/Thumb-16 ADDS or ADD with status update
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inline Assembly: Assembling ARM/Thumb-16 ADDS or ADD with status update


  • Subject: Re: Inline Assembly: Assembling ARM/Thumb-16 ADDS or ADD with status update
  • From: Jonas Maebe <email@hidden>
  • Date: Tue, 21 Jun 2011 10:19:34 +0200


On 21 Jun 2011, at 08:03, Jeffrey Walton wrote:

Unfortunately, the status flags are not being updated, so I'm getting
incorrect results. To remediate, I moved to a ".code 32" directive for
ADDS:

__asm__ volatile
(
"ldr  r4, %[xa]  ;"  // R4 = a
"ldr  r5, %[xb]  ;"  // R5 = b

".code 32      ;"  // same as ".arm"
"adds  r6, r4, r5  ;"  // R6 = R4 + R5, set status
".code 16      ;"  // same as ".thumb"

This cannot work. You cannot just go from ARM to Thumb mode from one instruction to the next. The mode switch always has to occur via bx/ blx or similar instruction.


Regarding the add/adds: GCC by default uses the "divided" assembler syntax, which did use the mnemonic "add" rather than "adds" in Thumb mode. It should still set the flags though (especially if you use three different registers, since the non-flag setting variant only supports two).

You may be able to switch to the unified syntax so that it corresponds to what is used in the current ARM manuals by following the instructions at http://sourceware.org/binutils/docs/as/ARM_002dInstruction_002dSet.html , but I don't know whether this is supported by the GCC
versions that Apple ships.



Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Inline Assembly: Assembling ARM/Thumb-16 ADDS or ADD with status update (From: Jeffrey Walton <email@hidden>)

  • Prev by Date: Inline Assembly: Assembling ARM/Thumb-16 ADDS or ADD with status update
  • Next by Date: XCode 4 cannot import CMAKE_build_type and cannot set BuildType directory in bin directory
  • Previous by thread: Inline Assembly: Assembling ARM/Thumb-16 ADDS or ADD with status update
  • Next by thread: Re: Inline Assembly: Assembling ARM/Thumb-16 ADDS or ADD with status update
  • Index(es):
    • Date
    • Thread