Initial Release
This commit is contained in:
44
src/rp2_common/pico_int64_ops/CMakeLists.txt
Normal file
44
src/rp2_common/pico_int64_ops/CMakeLists.txt
Normal file
@ -0,0 +1,44 @@
|
||||
if (NOT TARGET pico_int64_ops)
|
||||
|
||||
#shims for ROM functions for -lgcc functions (listed below)
|
||||
add_library(pico_int64_ops INTERFACE)
|
||||
|
||||
# no custom implementation; falls thru to compiler
|
||||
add_library(pico_int64_ops_compiler INTERFACE)
|
||||
# PICO_BUILD_DEFINE: PICO_INT64_OPS_COMPILER, whether compiler provided int64_ops multiplication support is being used, type=bool, default=0, but dependent on CMake options, group=pico_int64_ops
|
||||
target_compile_definitions(pico_int64_ops_compiler INTERFACE
|
||||
PICO_INT64_OPS_COMPILER=1
|
||||
)
|
||||
|
||||
# add alias "default" which is just pico.
|
||||
add_library(pico_int64_ops_default INTERFACE)
|
||||
target_link_libraries(pico_int64_ops_default INTERFACE pico_int64_ops_pico)
|
||||
|
||||
set(PICO_DEFAULT_INT64_OPS_IMPL pico_int64_ops_default)
|
||||
|
||||
target_link_libraries(pico_int64_ops INTERFACE
|
||||
$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_INT64_OPS_IMPL>>,$<TARGET_PROPERTY:PICO_TARGET_INT64_OPS_IMPL>,${PICO_DEFAULT_INT64_OPS_IMPL}>)
|
||||
|
||||
add_library(pico_int64_ops_pico INTERFACE)
|
||||
target_include_directories(pico_int64_ops_pico INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
|
||||
|
||||
target_sources(pico_int64_ops_pico INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/pico_int64_ops_aeabi.S
|
||||
)
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_INT64_OPS_PICO, whether optimized pico/bootrom provided int64_ops multiplication support is being used, type=bool, default=1, but dependent on CMake options, group=pico_int64_ops
|
||||
target_compile_definitions(pico_int64_ops_pico INTERFACE
|
||||
PICO_INT64_OPS_PICO=1
|
||||
)
|
||||
|
||||
pico_wrap_function(pico_int64_ops_pico __aeabi_lmul)
|
||||
|
||||
macro(pico_set_int64_ops_implementation TARGET IMPL)
|
||||
get_target_property(target_type ${TARGET} TYPE)
|
||||
if ("EXECUTABLE" STREQUAL "${target_type}")
|
||||
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_INT64_OPS_IMPL "pico_int64_ops_${IMPL}")
|
||||
else()
|
||||
message(FATAL_ERROR "int64_ops implementation must be set on executable not library")
|
||||
endif()
|
||||
endmacro()
|
||||
endif()
|
20
src/rp2_common/pico_int64_ops/include/pico/int64_ops.h
Normal file
20
src/rp2_common/pico_int64_ops/include/pico/int64_ops.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _PICO_INT64_H
|
||||
#define _PICO_INT64_H
|
||||
|
||||
#include "pico/types.h"
|
||||
|
||||
/** \file int64_ops.h
|
||||
* \defgroup pico_int64_ops pico_int64_ops
|
||||
*
|
||||
* Optimized replacement implementations of the compiler built-in 64 bit multiplication
|
||||
*
|
||||
* This library does not provide any additional functions
|
||||
*/
|
||||
|
||||
#endif
|
40
src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S
Normal file
40
src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
.syntax unified
|
||||
.cpu cortex-m0plus
|
||||
.thumb
|
||||
|
||||
#include "pico/asm_helper.S"
|
||||
|
||||
.section SECTION_NAME(__aeabi_lmul)
|
||||
wrapper_func __aeabi_lmul
|
||||
muls r1, r2
|
||||
muls r3, r0
|
||||
adds r1, r3
|
||||
mov r12, r1
|
||||
lsrs r1, r2, #16
|
||||
uxth r3, r0
|
||||
muls r3, r1
|
||||
push {r4}
|
||||
lsrs r4, r0, #16
|
||||
muls r1, r4
|
||||
uxth r2, r2
|
||||
uxth r0, r0
|
||||
muls r0, r2
|
||||
muls r2, r4
|
||||
lsls r4, r3, #16
|
||||
lsrs r3, #16
|
||||
adds r0, r4
|
||||
pop {r4}
|
||||
adcs r1, r3
|
||||
lsls r3, r2, #16
|
||||
lsrs r2, #16
|
||||
adds r0, r3
|
||||
adcs r1, r2
|
||||
add r1, r12
|
||||
bx lr
|
||||
|
Reference in New Issue
Block a user