title: selected processor does not support `swp x1,x1,[x0]'
body: <p>I try to use swp instruction to implement atomic swap. </p>
  
  <pre><code>asm volatile ("swp %[newval], %[newval], [%[oldval]]"
          : [newval] "+r" (newval), [oldval] "+p" (oldval)
          :
          : "memory");
  </code></pre>
  
  <p>when I compiling the code (using <code>g++ main.cpp -o main -march=armv8-a</code>). I got the following error message.</p>
  
  <pre><code>/tmp/cc0MHTHA.s: Assembler messages:
  /tmp/cc0MHTHA.s:20: Error: selected processor does not support `swp x1,x1,[x0]'
  </code></pre>
  
  <p>The ARM machine I use is with armv8, /proc/cpuinfo is like this (It's a SMP machine with 16 cores, information of others processors is the same besides the first line.)</p>
  
  <pre><code>processor   : 0
  model name  : phytium FT1500a
  flags   : fp asimd evtstrm aes pmull sha1 sha2 crc32
  CPU implementer : 0x70
  CPU architecture: 8
  CPU variant : 0x1
  CPU part    : 0x660
  bogomips    : 3590.55
  CPU revision    : 1
  </code></pre>
  
  <p><code>g++ --version</code> outputs </p>
  
  <pre><code>g++ (Ubuntu/Linaro 4.9.1-16kord6) 4.9.1
  Copyright (C) 2014 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.
  </code></pre>
  
  <p>I'm getting the following errors when using ldrex/strex instructions</p>
  
  <pre><code>/tmp/ccXxJgQH.s: Assembler messages:
  /tmp/ccXxJgQH.s:19: Error: unknown mnemonic `ldrex' -- `ldrex x0,[x0]'
  </code></pre>
  
  <p>Can anyone explain me why and where this error comes and how to deal with this error? The machine does not support SWP or I should add some parameters(maybe -march) on compile command to indicate the CPU architecture? </p>