Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
float_regs_arc_gcc.h
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2019, Synopsys.
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11
12#ifndef _FLOAT_REGS_ARC_GCC_H
13#define _FLOAT_REGS_ARC_GCC_H
14
15#if !defined(__GNUC__) || !defined(CONFIG_ISA_ARCV2)
16#error __FILE__ goes only with ARC GCC
17#endif
18
19#include <toolchain.h>
20#include "float_context.h"
21
39static inline void _load_all_float_registers(struct fp_register_set *regs)
40{
41#ifdef CONFIG_FP_FPU_DA
42 uint32_t temp = 0;
43
44 __asm__ volatile (
45 "ld.ab %1, [%0, 4];\n\t"
46 "sr %1, [%2];\n\t"
47 "ld.ab %1, [%0, 4];\n\t"
48 "sr %1, [%3];\n\t"
49 "ld.ab %1, [%0, 4];\n\t"
50 "sr %1, [%4];\n\t"
51 "ld.ab %1, [%0, 4];\n\t"
52 "sr %1, [%5];\n\t"
53 : : "r" (regs), "r" (temp),
54 "i"(_ARC_V2_FPU_DPFP1L), "i"(_ARC_V2_FPU_DPFP1H),
55 "i"(_ARC_V2_FPU_DPFP2L), "i"(_ARC_V2_FPU_DPFP2H)
56 : "memory"
57 );
58#endif
59}
60
73static inline void _store_all_float_registers(struct fp_register_set *regs)
74{
75#ifdef CONFIG_FP_FPU_DA
76 uint32_t temp = 0;
77
78 __asm__ volatile (
79 "lr %1, [%2];\n\t"
80 "st.ab %1, [%0, 4];\n\t"
81 "lr %1, [%3];\n\t"
82 "st.ab %1, [%0, 4];\n\t"
83 "lr %1, [%4];\n\t"
84 "st.ab %1, [%0, 4];\n\t"
85 "lr %1, [%5];\n\t"
86 "st.ab %1, [%0, 4];\n\t"
87 : : "r" (regs), "r" (temp),
88 "i"(_ARC_V2_FPU_DPFP1L), "i"(_ARC_V2_FPU_DPFP1H),
89 "i"(_ARC_V2_FPU_DPFP2L), "i"(_ARC_V2_FPU_DPFP2H)
90 );
91#endif
92}
93
108static inline void _load_then_store_all_float_registers(struct fp_register_set
109 *regs)
110{
111 _load_all_float_registers(regs);
112 _store_all_float_registers(regs);
113}
114#endif /* _FLOAT_REGS_ARC_GCC_H */
common definitions for the FPU sharing test application
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
Definition: float_context.h:164
Macros to abstract toolchain specific capabilities.