Skip to content

Commit

Permalink
Fixup for Cortex-A
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanAntoni committed Oct 12, 2023
1 parent 38fd1d4 commit c74aa02
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 59 deletions.
5 changes: 4 additions & 1 deletion .devcontainer/ubuntu-22.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ RUN pip install \
lit \
python-matrix-runner

RUN bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" &&
sed -i 's/OSH_THEME="font"/OSH_THEME="powerline"/' ~/.bashrc

ADD vcpkg-configuration.json /root/

RUN pushd /root && \
. <(curl https://aka.ms/vcpkg-init.sh -L) && \
echo ". /root/.vcpkg/vcpkg-init" >> .bashrc && \
echo "\n# Initialize vcpkg\n. /root/.vcpkg/vcpkg-init" >> .bashrc && \
vcpkg x-update-registry --all && \
vcpkg activate

Expand Down
18 changes: 18 additions & 0 deletions CMSIS/Core/Test/clz_compat.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// UNSUPPORTED: clz
// RUN: %cc% %ccflags% %ccout% %s.o %s; llvm-objdump --mcpu=%mcpu% -d %s.o | FileCheck --allow-unused-prefixes --check-prefixes %prefixes% %s

#include "cmsis_compiler.h"

static volatile uint32_t a = 10u;

void clz() {
// CHECK-LABEL: <clz>:
// CHECK: cmp [[REG1:r[0-9]+]], #0x0
// CHECK: beq
// CHECK: lsrs [[REG2:r[0-9]+]], [[REG1]], #0x1
// CHECK: orrs [[REG2]], [[REG1]]
// CHECK: lsrs [[REG1]], [[REG2]], #0x2
volatile uint32_t c = __CLZ(a);
// CHECK: {{(bx lr)|(pop {.*pc})}}
}

48 changes: 24 additions & 24 deletions CMSIS/Core/Test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'mcpu': 'cortex-m3',
'mfpu': 'none',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm3.h',
'defines': {
'__CM3_REV': '0x0000U',
Expand All @@ -62,7 +62,7 @@
'mcpu': 'cortex-m4',
'mfpu': 'none',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm4.h',
'defines': {
'__CM4_REV': '0x0000U',
Expand All @@ -80,7 +80,7 @@
'mcpu': 'cortex-m4',
'mfpu': 'fpv4-sp-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm4.h',
'defines': {
'__CM4_REV': '0x0000U',
Expand All @@ -98,7 +98,7 @@
'mcpu': 'cortex-m7',
'mfpu': 'none',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm7.h',
'defines': {
'__CM7_REV': '0x0000U',
Expand All @@ -119,7 +119,7 @@
'mcpu': 'cortex-m7',
'mfpu': 'fpv4-sp-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm7.h',
'defines': {
'__CM7_REV': '0x0000U',
Expand All @@ -140,7 +140,7 @@
'mcpu': 'cortex-m7',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm7.h',
'defines': {
'__CM7_REV': '0x0000U',
Expand Down Expand Up @@ -218,7 +218,7 @@
'mcpu': 'cortex-m33',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm33.h',
'defines': {
'__CM33_REV': '0x0000U',
Expand All @@ -237,7 +237,7 @@
'mcpu': 'cortex-m33',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm33.h',
'defines': {
'__CM33_REV': '0x0000U',
Expand All @@ -256,7 +256,7 @@
'mcpu': 'cortex-m33',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm33.h',
'defines': {
'__CM33_REV': '0x0000U',
Expand All @@ -275,7 +275,7 @@
'mcpu': 'cortex-m35p',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm35p.h',
'defines': {
'__CM35P_REV': '0x0000U',
Expand All @@ -294,7 +294,7 @@
'mcpu': 'cortex-m35p',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm35p.h',
'defines': {
'__CM35P_REV': '0x0000U',
Expand All @@ -313,7 +313,7 @@
'mcpu': 'cortex-m35p',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm35p.h',
'defines': {
'__CM35P_REV': '0x0000U',
Expand All @@ -332,7 +332,7 @@
'mcpu': 'cortex-m55',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm55.h',
'defines': {
'__CM55_REV': '0x0000U',
Expand All @@ -358,7 +358,7 @@
'mcpu': 'cortex-m55',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm55.h',
'defines': {
'__CM55_REV': '0x0000U',
Expand All @@ -384,7 +384,7 @@
'mcpu': 'cortex-m55',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm55.h',
'defines': {
'__CM55_REV': '0x0000U',
Expand All @@ -410,7 +410,7 @@
'mcpu': 'cortex-m85',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm85.h',
'defines': {
'__CM85_REV': '0x0000U',
Expand All @@ -436,7 +436,7 @@
'mcpu': 'cortex-m85',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm85.h',
'defines': {
'__CM85_REV': '0x0000U',
Expand All @@ -462,7 +462,7 @@
'mcpu': 'cortex-m85',
'mfpu': 'fpv5-d16',
'mpu': True,
'features': ['thumbv6m', 'thumbv7m', 'thumbv7em', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex'],
'features': ['thumbv6m', 'thumbv7m', 'dsp', 'thumbv8m.base', 'thumbv8m.main', 'thumbv8.1m.main', 'thumb-2', 'sat', 'ldrex', 'clz'],
'header': 'core_cm85.h',
'defines': {
'__CM85_REV': '0x0000U',
Expand All @@ -488,7 +488,7 @@
'mcpu': 'cortex-a5',
'mfpu': 'none',
'mpu': True,
'features': ['armv7a', 'thumb-2'],
'features': ['armv7a', 'thumb-2', 'sat', 'clz'],
'header': 'core_ca.h',
'defines': {
'__CA_REV': '0x0000U',
Expand All @@ -505,7 +505,7 @@
'mcpu': 'cortex-a5',
'mfpu': 'neon-vfpv4',
'mpu': True,
'features': ['armv7a', 'thumb-2'],
'features': ['armv7a', 'thumb-2', 'sat', 'dsp', 'clz'],
'header': 'core_ca.h',
'defines': {
'__CA_REV': '0x0000U',
Expand All @@ -522,7 +522,7 @@
'mcpu': 'cortex-a7',
'mfpu': 'none',
'mpu': True,
'features': ['armv7a', 'thumb-2'],
'features': ['armv7a', 'thumb-2', 'sat', 'clz'],
'header': 'core_ca.h',
'defines': {
'__CA_REV': '0x0000U',
Expand All @@ -539,7 +539,7 @@
'mcpu': 'cortex-a7',
'mfpu': 'neon-vfpv4',
'mpu': True,
'features': ['armv7a', 'thumb-2'],
'features': ['armv7a', 'thumb-2', 'sat', 'dsp', 'clz'],
'header': 'core_ca.h',
'defines': {
'__CA_REV': '0x0000U',
Expand All @@ -556,7 +556,7 @@
'mcpu': 'cortex-a9',
'mfpu': 'none',
'mpu': True,
'features': ['armv7a', 'thumb-2'],
'features': ['armv7a', 'thumb-2', 'sat', 'clz'],
'header': 'core_ca.h',
'defines': {
'__CA_REV': '0x0000U',
Expand All @@ -573,7 +573,7 @@
'mcpu': 'cortex-a9',
'mfpu': 'neon-vfpv3',
'mpu': True,
'features': ['armv7a', 'thumb-2'],
'features': ['armv7a', 'thumb-2', 'sat', 'dsp', 'ldrex', 'clz'],
'header': 'core_ca.h',
'defines': {
'__CA_REV': '0x0000U',
Expand Down
26 changes: 26 additions & 0 deletions CMSIS/Core/Test/sat.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// REQUIRES: sat
// RUN: %cc% %ccflags% %ccout% %s.o %s; llvm-objdump --mcpu=%mcpu% -d %s.o | FileCheck --allow-unused-prefixes --check-prefixes %prefixes% %s

#include "cmsis_compiler.h"

static volatile uint32_t s32 = 10;
static volatile uint32_t u32 = 10U;

void ssat() {
// CHECK-LABEL: <ssat>:
// CHECK: ssat {{r[0-9]+}}, #0x2, {{r[0-9]+}}
volatile uint32_t c = __SSAT(s32, 2u);
// CHECK: ssat {{r[0-9]+}}, #0x5, {{r[0-9]+}}
volatile uint32_t d = __SSAT(s32, 5u);
// CHECK: {{(bx lr)|(pop {.*pc})}}
}

void usat() {
// CHECK-LABEL: <usat>:
// CHECK: usat {{r[0-9]+}}, #0x2, {{r[0-9]+}}
volatile uint32_t c = __USAT(u32, 2u);
// CHECK: usat {{r[0-9]+}}, #0x5, {{r[0-9]+}}
volatile uint32_t d = __USAT(u32, 5u);
// CHECK: {{(bx lr)|(pop {.*pc})}}
}

14 changes: 9 additions & 5 deletions CMSIS/Core/Test/simd.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// REQUIRES: thumbv7em
// REQUIRES: dsp
// RUN: %cc% %ccflags% %ccout% %s.o %s; llvm-objdump --mcpu=%mcpu% -d %s.o | FileCheck --allow-unused-prefixes --check-prefixes %prefixes% %s

#include "cmsis_compiler.h"
Expand Down Expand Up @@ -480,12 +480,14 @@ void sxtb16_ror() {
// CHECK: sxtb16 {{r[0-9]+}}, {{r[0-9]+}}, ror #24
result = __SXTB16_RORn(s32_1, 24);

// CHECK: ror.w [[REG:r[0-9]+]], {{r[0-9]+}}, {{#5|#0x5}}
// CHECK-THUMB: ror.w [[REG:r[0-9]+]], {{r[0-9]+}}, {{#5|#0x5}}
// CHECK-ARM: ror [[REG:r[0-9]+]], {{r[0-9]+}}, {{#5|#0x5}}
// CHECK: sxtb16 {{r[0-9]+}}, [[REG]]
// CHECK-NOT: , ror
result = __SXTB16_RORn(s32_1, 5);

// CHECK: ror{{.w|ne|s}} {{r[0-9]+}}, {{r[0-9]+}}
// CHECK-THUMB: ror{{.w|ne|s}} {{r[0-9]+}}, {{r[0-9]+}}
// CHECK-ARM: ror {{r[0-9]+}}, {{r[0-9]+}}
// CHECK: sxtb16 {{r[0-9]+}}, {{r[0-9]+}}
// CHECK-NOT: , ror
result = __SXTB16_RORn(s32_1, u8);
Expand All @@ -505,12 +507,14 @@ void sxtab16_ror() {
// CHECK: sxtab16 {{r[0-9]+}}, {{r[0-9]+}}, {{r[0-9]+}}, ror #24
result = __SXTAB16_RORn(s32_1, s32_2, 24);

// CHECK: ror.w [[REG:r[0-9]+]], {{r[0-9]+}}, {{#5|#0x5}}
// CHECK-THUMB: ror.w [[REG:r[0-9]+]], {{r[0-9]+}}, {{#5|#0x5}}
// CHECK-ARM: ror [[REG:r[0-9]+]], {{r[0-9]+}}, {{#5|#0x5}}
// CHECK: sxtab16 {{r[0-9]+}}, {{r[0-9]+}}, [[REG]]
// CHECK-NOT: , ror
result = __SXTAB16_RORn(s32_1, s32_2, 5);

// CHECK: ror{{.w|ne|s}} {{r[0-9]+}}, {{r[0-9]+}}
// CHECK-THUMB: ror{{.w|ne|s}} {{r[0-9]+}}, {{r[0-9]+}}
// CHECK-ARM: ror {{r[0-9]+}}, {{r[0-9]+}}
// CHECK: sxtab16 {{r[0-9]+}}, {{r[0-9]+}}, {{r[0-9]+}}
// CHECK-NOT: , ror
result = __SXTAB16_RORn(s32_1, s32_2, u8);
Expand Down
15 changes: 0 additions & 15 deletions CMSIS/Core/Test/ssat.c

This file was deleted.

14 changes: 0 additions & 14 deletions CMSIS/Core/Test/usat.c

This file was deleted.

0 comments on commit c74aa02

Please sign in to comment.