提交 0c002ccc 编写于 作者: S Sinan Kaya 提交者: Jan Kotas

Allow FPU flag override (#471)

Command line to build for vfpv3-d16 ARM Cortex-5:

./build.sh -cross -arm -cmakeargs -DCLR_ARM_FPU_CAPABILITY=0x3 -cmakeargs -DCLR_ARM_FPU_TYPE=vfpv3-d16

Fixes https://github.com/dotnet/coreclr/issues/17043
上级 875a54a1
......@@ -71,8 +71,17 @@ endif()
if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
add_compile_options(-mthumb)
add_compile_options(-mfpu=vfpv3)
if(TARGET_ARCH_NAME STREQUAL "armel")
if (NOT DEFINED CLR_ARM_FPU_TYPE)
set(CLR_ARM_FPU_TYPE vfpv3)
endif(NOT DEFINED CLR_ARM_FPU_TYPE)
add_compile_options(-mfpu=${CLR_ARM_FPU_TYPE})
if (NOT DEFINED CLR_ARM_FPU_CAPABILITY)
set(CLR_ARM_FPU_CAPABILITY 0x7)
endif(NOT DEFINED CLR_ARM_FPU_CAPABILITY)
add_definitions(-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY})
if(TARGET_ARCH_NAME STREQUAL "armel")
add_compile_options(-mfloat-abi=softfp)
if(DEFINED TIZEN_TOOLCHAIN)
add_compile_options(-Wno-deprecated-declarations) # compile-time option
......
......@@ -537,10 +537,18 @@ if (CLR_CMAKE_PLATFORM_UNIX)
endif(CLR_CMAKE_PLATFORM_UNIX)
if(CLR_CMAKE_PLATFORM_UNIX_ARM)
if (NOT DEFINED CLR_ARM_FPU_TYPE)
set(CLR_ARM_FPU_TYPE vfpv3)
endif(NOT DEFINED CLR_ARM_FPU_TYPE)
# Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang
# we have to set the triple by adding a compiler argument
add_compile_options(-mthumb)
add_compile_options(-mfpu=vfpv3)
add_compile_options(-mfpu=${CLR_ARM_FPU_TYPE})
if (NOT DEFINED CLR_ARM_FPU_CAPABILITY)
set(CLR_ARM_FPU_CAPABILITY 0x7)
endif(NOT DEFINED CLR_ARM_FPU_CAPABILITY)
add_definitions(-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY})
add_compile_options(-march=armv7-a)
if(ARM_SOFTFP)
add_definitions(-DARM_SOFTFP)
......
......@@ -80,7 +80,11 @@ LEAF_ENTRY CONTEXT_CaptureContext, _TEXT
itttt ne
addne r0, CONTEXT_D0
vstmiane r0!, {d0-d15}
#if CLR_ARM_FPU_CAPABILITY & 0x4
vstmiane r0!, {d16-d31}
#else
addne r0, r0, #128
#endif
subne r0, CONTEXT_D31
// Make sure sp is restored
......@@ -130,7 +134,11 @@ LOCAL_LABEL(Restore_CONTEXT_FLOATING_POINT):
itttt ne
addne r0, CONTEXT_D0
vldmiane r0!, {d0-d15}
#if CLR_ARM_FPU_CAPABILITY & 0x4
vldmiane r0, {d16-d31}
#else
nopne
#endif
subne r0, CONTEXT_D16
itt ne
......
......@@ -59,7 +59,16 @@ elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
add_compile_options(-mfloat-abi=softfp)
endif ()
add_compile_options(-mthumb)
add_compile_options(-mfpu=vfpv3)
if (NOT DEFINED CLR_ARM_FPU_TYPE)
set(CLR_ARM_FPU_TYPE vfpv3)
endif(NOT DEFINED CLR_ARM_FPU_TYPE)
add_compile_options(-mfpu=${CLR_ARM_FPU_TYPE})
if (NOT DEFINED CLR_ARM_FPU_CAPABILITY)
set(CLR_ARM_FPU_CAPABILITY 0x7)
endif(NOT DEFINED CLR_ARM_FPU_CAPABILITY)
add_definitions(-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY})
add_compile_options(-march=armv7-a)
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
add_definitions(-DBIT32=1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册