[compiler-rt] ef45c12 - [compiler-rt][builtins] Support builtins for armv8m.base
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 14 17:20:59 PDT 2023
Author: Frank Dischner
Date: 2023-03-14T17:20:54-07:00
New Revision: ef45c12f9e6ec687e6281f7dc7c5e38e711bda9c
URL: https://github.com/llvm/llvm-project/commit/ef45c12f9e6ec687e6281f7dc7c5e38e711bda9c
DIFF: https://github.com/llvm/llvm-project/commit/ef45c12f9e6ec687e6281f7dc7c5e38e711bda9c.diff
LOG: [compiler-rt][builtins] Support builtins for armv8m.base
This allows building the compiler builtins library for the Armv8-M
Baseline architecture. It can be built in the same way as other
baremetal targets using the appropriate '--target' flag
(e.g. --target=armv8m.base-eabi).
NOTE: As with the other Cortex-M targets, only the builtins library is
supported. There is no support for sanitizers, etc.
The armv8m.base architecture is a superset of armv6m, so adding it to
the cmake files using thumb1_SOURCES is almost enough for it to compile.
Minor changes are needed to divsi3 and udivsi3, because armv8m.base does
have support for div instructions but not mov with an immediate operand.
Reviewed By: MaskRay, peter.smith
Differential Revision: https://reviews.llvm.org/D143297
Added:
Modified:
compiler-rt/cmake/builtin-config-ix.cmake
compiler-rt/lib/builtins/CMakeLists.txt
compiler-rt/lib/builtins/arm/divsi3.S
compiler-rt/lib/builtins/arm/udivsi3.S
Removed:
################################################################################
diff --git a/compiler-rt/cmake/builtin-config-ix.cmake b/compiler-rt/cmake/builtin-config-ix.cmake
index e045c81a0f74f..3638cff56eb08 100644
--- a/compiler-rt/cmake/builtin-config-ix.cmake
+++ b/compiler-rt/cmake/builtin-config-ix.cmake
@@ -29,7 +29,7 @@ asm(\"cas w0, w1, [x2]\");
")
set(ARM64 aarch64)
-set(ARM32 arm armhf armv4t armv5te armv6 armv6m armv7m armv7em armv7 armv7s armv7k armv8m.main armv8.1m.main)
+set(ARM32 arm armhf armv4t armv5te armv6 armv6m armv7m armv7em armv7 armv7s armv7k armv8m.base armv8m.main armv8.1m.main)
set(AVR avr)
set(HEXAGON hexagon)
set(X86 i386)
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index de2fde2121ecd..0487126a8a54b 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -605,6 +605,7 @@ set(arm64_32_SOURCES ${aarch64_SOURCES})
set(armv6m_SOURCES ${thumb1_SOURCES})
set(armv7m_SOURCES ${arm_SOURCES})
set(armv7em_SOURCES ${arm_SOURCES})
+set(armv8m.base_SOURCES ${thumb1_SOURCES})
set(armv8m.main_SOURCES ${arm_SOURCES})
set(armv8.1m.main_SOURCES ${arm_SOURCES})
diff --git a/compiler-rt/lib/builtins/arm/divsi3.S b/compiler-rt/lib/builtins/arm/divsi3.S
index 761bf49d3ed06..faf9af917ab67 100644
--- a/compiler-rt/lib/builtins/arm/divsi3.S
+++ b/compiler-rt/lib/builtins/arm/divsi3.S
@@ -37,7 +37,8 @@ DEFINE_COMPILERRT_FUNCTION(__divsi3)
sdiv r0, r0, r1
bx lr
LOCAL_LABEL(divzero):
- mov r0,#0
+ // Use movs for compatibility with v8-m.base.
+ movs r0,#0
bx lr
#else
ESTABLISH_FRAME
diff --git a/compiler-rt/lib/builtins/arm/udivsi3.S b/compiler-rt/lib/builtins/arm/udivsi3.S
index 9b1b035b33d6c..0567ab4ab7656 100644
--- a/compiler-rt/lib/builtins/arm/udivsi3.S
+++ b/compiler-rt/lib/builtins/arm/udivsi3.S
@@ -32,7 +32,8 @@ DEFINE_COMPILERRT_FUNCTION(__udivsi3)
bx lr
LOCAL_LABEL(divby0):
- mov r0, #0
+ // Use movs for compatibility with v8-m.base.
+ movs r0, #0
# ifdef __ARM_EABI__
b __aeabi_idiv0
# else
More information about the llvm-commits
mailing list