<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Some Arm CPUs are only known to either clang or llvm (not both)"
   href="https://bugs.llvm.org/show_bug.cgi?id=50454">50454</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Some Arm CPUs are only known to either clang or llvm (not both)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.spickett@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="https://github.com/ClangBuiltLinux/linux/issues/921">https://github.com/ClangBuiltLinux/linux/issues/921</a> reported that doing:
$ ./bin/clang --target=arm-linux-gnueabihf -march=armv3m -c /tmp/test.c -o
/tmp/test.o

Produces:
'arm7m' is not a recognized processor for this target (ignoring processor)
'arm7m' is not a recognized processor for this target (ignoring processor)
'arm7m' is not a recognized processor for this target (ignoring processor)
'arm7m' is not a recognized processor for this target (ignoring processor)
'arm7m' is not a recognized processor for this target (ignoring processor)
'arm7m' is not a recognized processor for this target (ignoring processor)
'arm7m' is not a recognized processor for this target (ignoring processor)
'arm7m' is not a recognized processor for this target (ignoring processor)

Where if you use armv1m, 2m, anything but 4 (or 7/8 which are M profile
architectures) you get:
clang-13: error: the clang compiler does not support '-march=armv4m'

The reason for this is that armv3m is actually a valid arm architecture albeit
a rather old one, and not an M profile arch like armv7-M is.

arm7m (note, no "V" in there) is/was a real CPU that we chose as the default
CPU to use for armv3m. Problem is that llvm doesn't know what this CPU is.

If we compare these two files:
llvm/include/llvm/Support/ARMTargetParser.def (clang side CPUs)
llvm/lib/Target/ARM/ARM.td (backend CPUs)

$ grep -P "^ARM_CPU_NAME" llvm/include/llvm/Support/ARMTargetParser.def | cut
-d\( -f2 | cut -d, -f1 | sort | uniq
$ grep "def : Proc" llvm/lib/Target/ARM/ARM.td | cut -d'<' -f2 | cut -d, -f1

We can see that the lists are not the same:
$ diff /tmp/tpcpus /tmp/tdcpus
8d7
< "arm1136jz-s"
10a10
<span class="quote">> "arm1176j-s"</span >
13,15d12
< "arm2"
< "arm3"
< "arm6"
18d14
< "arm7m"
28d23
< "arm9312"
77c72
< "invalid"
---
<span class="quote">> "generic"</span >

You can ignore the last two. "invalid" is used as an error value for target
parser functions, and the target parser has no need for a "generic" setting.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>