Ersel Aker
Ersel Aker

Reputation: 855

Difference between ADDNES and ADDSNE

I am having trouble with understanding the difference between ADDNES and ADDSNE in ARM assembly. Please can someone help me, with some examples?

Upvotes: 2

Views: 959

Answers (2)

old_timer
old_timer

Reputation: 71546

it is one of those confusing things about arm assembly, all instructions have the condition field, some instructions have extra stuff like add and adds, where does the ne or eq or mi, etc go. Before the s or after? add+ne+s addnes or add+s+ne. I would hope the tools take both, but it sounds from the accepted answer that it is worse than that, some take one some take the other.

Upvotes: 0

Carl Norum
Carl Norum

Reputation: 224944

They're different spellings for the same instruction. Clang, for example, can only handle the addnes format, but otool outputs addsne when disassembling it.

Example:

$ cat example.s
  addnes r0, r0, #1
$ clang -arch arm -c -o example.o example.s
$ otool -tV example.o 
example.o:
(__TEXT,__text) section
00000000    12900001    addsne  r0, r0, #1  @ 0x1

But if trying to use the addnse spelling in clang:

$ cat example.s
  addsne r0, r0, #1
$ clang -arch arm -c -o example.o example.s
example.s:1:bad instruction `addsne r0,r0,#1'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)

Upvotes: 4

Related Questions