mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-28 04:23:38 +01:00
sh-generic: add CPU capabilities for optimized SH4 code
On sh-generic targets, the headers <bits/cpucap.h> (in C) and <bits/asm/cpucap.h> (in assembler) provide definitions to acces the __cpucap symbol which provides information on the CPU. Currently, a single capability __CPUCAP_SH4ALDSP is defined; it represents the SH4 extended instructions together with the integrated DSP instructions. The main uses of this capability are [movua.l] (unaligned reads) and [ldrc] (built-in tight loops). Capabilities are initialized to 0 (their safest default) and the runtime can enable them based on what hardware is running.
This commit is contained in:
parent
53751aa9a1
commit
591e453717
4 changed files with 23 additions and 1 deletions
|
@ -168,7 +168,8 @@ if(sh-generic IN_LIST TARGET_FOLDERS)
|
|||
list(APPEND SOURCES
|
||||
src/libc/setjmp/target/sh-generic/setjmp.S
|
||||
src/libc/setjmp/target/sh-generic/longjmp.S
|
||||
src/libc/string/target/sh-generic/memchr.S)
|
||||
src/libc/string/target/sh-generic/memchr.S
|
||||
src/target/sh-generic/cpucap.c)
|
||||
endif()
|
||||
|
||||
if(casiowin-fx IN_LIST TARGET_FOLDERS)
|
||||
|
|
9
include/target/sh-generic/bits/asm/cpucap.h
Normal file
9
include/target/sh-generic/bits/asm/cpucap.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef __BITS_ASM_CPUCAP_H__
|
||||
# define __BITS_ASM_CPUCAP_H__
|
||||
|
||||
/* CPU capabilities for assembler code. See also <bits/cpucap.h>. */
|
||||
|
||||
/* CPU supports the SH4AL-DSP instruction set (with DSP turned on). */
|
||||
#define __CPUCAP_SH4ALDSP 0x01
|
||||
|
||||
#endif /*__BITS_ASM_CPUCAP_H__*/
|
9
include/target/sh-generic/bits/cpucap.h
Normal file
9
include/target/sh-generic/bits/cpucap.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef __BITS_CPUCAP_H__
|
||||
# define __BITS_CPUCAP_H__
|
||||
|
||||
#include <bits/asm/cpucap.h>
|
||||
|
||||
/* CPU flags determined at runtime. */
|
||||
extern int __cpucap;
|
||||
|
||||
#endif /*__BITS_CPUCAP_H__*/
|
3
src/target/sh-generic/cpucap.c
Normal file
3
src/target/sh-generic/cpucap.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include <bits/cpucap.h>
|
||||
|
||||
int __cpucap = 0;
|
Loading…
Reference in a new issue