Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
float_regs_xtensa.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef _FLOAT_REGS_XTENSA_H
8#define _FLOAT_REGS_XTENSA_H
9
10#include <zephyr/toolchain.h>
11#include "float_context.h"
12
29static inline void _load_all_float_registers(struct fp_register_set *regs)
30{
31 __asm__ volatile("wfr f0, %0\n" :: "r"(regs->fp_non_volatile.reg[0]));
32 __asm__ volatile("wfr f1, %0\n" :: "r"(regs->fp_non_volatile.reg[1]));
33 __asm__ volatile("wfr f2, %0\n" :: "r"(regs->fp_non_volatile.reg[2]));
34 __asm__ volatile("wfr f3, %0\n" :: "r"(regs->fp_non_volatile.reg[3]));
35 __asm__ volatile("wfr f4, %0\n" :: "r"(regs->fp_non_volatile.reg[4]));
36 __asm__ volatile("wfr f5, %0\n" :: "r"(regs->fp_non_volatile.reg[5]));
37 __asm__ volatile("wfr f6, %0\n" :: "r"(regs->fp_non_volatile.reg[6]));
38 __asm__ volatile("wfr f7, %0\n" :: "r"(regs->fp_non_volatile.reg[7]));
39 __asm__ volatile("wfr f8, %0\n" :: "r"(regs->fp_non_volatile.reg[8]));
40 __asm__ volatile("wfr f9, %0\n" :: "r"(regs->fp_non_volatile.reg[9]));
41 __asm__ volatile("wfr f10, %0\n" :: "r"(regs->fp_non_volatile.reg[10]));
42 __asm__ volatile("wfr f11, %0\n" :: "r"(regs->fp_non_volatile.reg[11]));
43 __asm__ volatile("wfr f12, %0\n" :: "r"(regs->fp_non_volatile.reg[12]));
44 __asm__ volatile("wfr f13, %0\n" :: "r"(regs->fp_non_volatile.reg[13]));
45 __asm__ volatile("wfr f14, %0\n" :: "r"(regs->fp_non_volatile.reg[14]));
46 __asm__ volatile("wfr f15, %0\n" :: "r"(regs->fp_non_volatile.reg[15]));
47 __asm__ volatile("wur.fsr %0\n" :: "r"(regs->fp_non_volatile.reg[16]));
48 __asm__ volatile("wur.fcr %0\n" :: "r"(regs->fp_non_volatile.reg[17]));
49}
50
62static inline void _store_all_float_registers(struct fp_register_set *regs)
63{
64 __asm__ volatile("rfr %0, f0\n" : "=r"(regs->fp_non_volatile.reg[0]));
65 __asm__ volatile("rfr %0, f1\n" : "=r"(regs->fp_non_volatile.reg[1]));
66 __asm__ volatile("rfr %0, f2\n" : "=r"(regs->fp_non_volatile.reg[2]));
67 __asm__ volatile("rfr %0, f3\n" : "=r"(regs->fp_non_volatile.reg[3]));
68 __asm__ volatile("rfr %0, f4\n" : "=r"(regs->fp_non_volatile.reg[4]));
69 __asm__ volatile("rfr %0, f5\n" : "=r"(regs->fp_non_volatile.reg[5]));
70 __asm__ volatile("rfr %0, f6\n" : "=r"(regs->fp_non_volatile.reg[6]));
71 __asm__ volatile("rfr %0, f7\n" : "=r"(regs->fp_non_volatile.reg[7]));
72 __asm__ volatile("rfr %0, f8\n" : "=r"(regs->fp_non_volatile.reg[8]));
73 __asm__ volatile("rfr %0, f9\n" : "=r"(regs->fp_non_volatile.reg[9]));
74 __asm__ volatile("rfr %0, f10\n" : "=r"(regs->fp_non_volatile.reg[10]));
75 __asm__ volatile("rfr %0, f11\n" : "=r"(regs->fp_non_volatile.reg[11]));
76 __asm__ volatile("rfr %0, f12\n" : "=r"(regs->fp_non_volatile.reg[12]));
77 __asm__ volatile("rfr %0, f13\n" : "=r"(regs->fp_non_volatile.reg[13]));
78 __asm__ volatile("rfr %0, f14\n" : "=r"(regs->fp_non_volatile.reg[14]));
79 __asm__ volatile("rfr %0, f15\n" : "=r"(regs->fp_non_volatile.reg[15]));
80 __asm__ volatile("rur.fsr %0\n" : "=r"(regs->fp_non_volatile.reg[16]));
81 __asm__ volatile("rur.fcr %0\n" : "=r"(regs->fp_non_volatile.reg[17]));
82}
83
96static inline void _load_then_store_all_float_registers(struct fp_register_set
97 *regs)
98{
99 _load_all_float_registers(regs);
100 _store_all_float_registers(regs);
101}
102
103#endif /* _FLOAT_REGS_XTENSA_H */
common definitions for the FPU sharing test application
Definition float_context.h:192
struct fp_non_volatile_register_set fp_non_volatile
Definition float_context.h:194
Macros to abstract toolchain specific capabilities.