Bug 22094

Summary: Instruction `lsrsne` unknown
Product: binutils Reporter: Paul Menzel <pmenzel+sourceware.org-bugzilla>
Component: gasAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: nickc
Priority: P2    
Version: 2.29   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Paul Menzel 2017-09-06 12:30:40 UTC
Using Debian Sid/unstable binutils-arm-linux-gnueabi 2.29-8.

From the discussion of a change-set for coreboot [1], it turns out that GCC does not understand valid instructions.

```
$ arm-linux-gnueabi-gcc-7 --version
arm-linux-gnueabi-gcc-7 (Debian 7.2.0-1) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat mov1.S
        lsrsne r0, r0, #4
$ arm-linux-gnueabi-gcc-7 mov1.S -c -o mov1.gas
mov1.S: Assembler messages:
mov1.S:1: Error: bad instruction `lsrsne r0,r0,#4'
$ cat mov1.S
        lsrsne r0, r0, #4
$ arm-linux-gnueabi-gcc-7 mov2.S -c -o mov2.gas
```

Julius Werner comments as below.

> FWIW, the ARMv7 A.R.M. says the S comes before the condition code, so this
> should've been MOVSNE instead of MOVNES anyway. It also doesn't explicitly
> allow a source operand shift for MOV, so LSRSNE should be the correct form. I
> bet GCC just has a few additional non-standard aliases, but I would be
> surprised if it can't recognize the official and most obvious notation
> (LSRSNE).

But there is an error with gas.

[1] https://review.coreboot.org/21358/
Comment 1 Nick Clifton 2017-10-11 12:46:21 UTC
Hi Paul,

  I believe you need to enable thumb mode and start an IT block for this to work.
IE:

    .thumb
    it ne
    lsrsne r0, r0, #4

Also in ARMv8 32-bit thumb instructions inside an IT block are deprecated, so this will only work if you are targeting ARMv7 or earlier.

Cheers
  Nick