[llvm] [llvm] Fix the MCSubtargetInfo used for module-level assembly. (PR #97685)

Chris Copeland via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 4 00:46:53 PDT 2024


chrisnc wrote:

`test.c`

```c
asm("vmsr fpexc, r0");
```

Without fix:

```bash
$ bin/clang -target arm-none-eabi test.c -c -flto=thin -mcpu=cortex-r4
<inline asm>:1:1: error: instruction requires: VFP2
    1 | vmsr fpexc, r0
      | ^
1 error generated.

$ bin/clang -target arm-none-eabi test.c -c -flto=thin -mcpu=cortex-r5
<inline asm>:1:1: error: instruction requires: VFP2
    1 | vmsr fpexc, r0
      | ^
1 error generated.
```

With fix, using `-mcpu=cortex-r5` (which implies FPU support, while `cortex-r4` does not), does not emit an error:
```bash
$ bin/clang -target arm-none-eabi test.c -c -flto=thin -mcpu=cortex-r4
<inline asm>:1:1: error: instruction requires: VFP2
    1 | vmsr fpexc, r0
      | ^
1 error generated.

$ bin/clang -target arm-none-eabi test.c -c -flto=thin -mcpu=cortex-r5
```

https://github.com/llvm/llvm-project/pull/97685


More information about the llvm-commits mailing list