[clang] [Clang][ARM] Make CRC and DSP intrinsics always available. (PR #107417)

Daniel Kiss via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 01:50:40 PDT 2024


DanielKristofKiss wrote:

> I think this is OK but do you know if the dsp side works with cortex-m? Target attributes are less likely to be used there, but it's worth testing if the command line args are still all happy.

This seems works fine:
```c
#include <arm_acle.h>
int dsp() {
    return __smlabb(1,3,4);
}
```
cat dpp.c | bin/clang dpp.c -O2 -target thumb-none-gnueabi -mcpu=cortex-m4 -c -o - | llvm-objdump -d -
```
<stdin>:        file format elf32-littlearm

Disassembly of section .text:

00000000 <dsp>:
       0: 2004          movs    r0, #0x4
       2: 2103          movs    r1, #0x3
       4: 2201          movs    r2, #0x1
       6: fb12 0001     smlabb  r0, r2, r1, r0
       a: 4770          bx      lr
```

could be added to the clang/test/Codegen/acle_test.c too. but we seem don't have too many M class test for these things...
```
// RUN: %clang_cc1 -ffreestanding -triple thumbv7em-unknown-none-gnueabi -target-feature -crc -target-feature +dsp -O0 -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s -check-prefixes=ARM,AArch32`
``

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


More information about the cfe-commits mailing list