xref: /linux/arch/arc/include/asm/fpu.h (revision 02680c23d7b3febe45ea3d4f9818c2b2dc89020a)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com)
4  *
5  */
6 
7 #ifndef _ASM_ARC_FPU_H
8 #define _ASM_ARC_FPU_H
9 
10 #ifdef CONFIG_ARC_FPU_SAVE_RESTORE
11 
12 #include <asm/ptrace.h>
13 
14 #ifdef CONFIG_ISA_ARCOMPACT
15 
16 /* These DPFP regs need to be saved/restored across ctx-sw */
17 struct arc_fpu {
18 	struct {
19 		unsigned int l, h;
20 	} aux_dpfp[2];
21 };
22 
23 #define fpu_init_task(regs)
24 
25 #else
26 
27 /*
28  * ARCv2 FPU Control aux register
29  *   - bits to enable Traps on Exceptions
30  *   - Rounding mode
31  *
32  * ARCv2 FPU Status aux register
33  *   - FPU exceptions flags (Inv, Div-by-Zero, overflow, underflow, inexact)
34  *   - Flag Write Enable to clear flags explicitly (vs. by fpu instructions
35  *     only
36  */
37 
38 struct arc_fpu {
39 	unsigned int ctrl, status;
40 };
41 
42 extern void fpu_init_task(struct pt_regs *regs);
43 
44 #endif	/* !CONFIG_ISA_ARCOMPACT */
45 
46 struct task_struct;
47 
48 extern void fpu_save_restore(struct task_struct *p, struct task_struct *n);
49 
50 #else	/* !CONFIG_ARC_FPU_SAVE_RESTORE */
51 
52 #define fpu_save_restore(p, n)
53 #define fpu_init_task(regs)
54 
55 #endif	/* CONFIG_ARC_FPU_SAVE_RESTORE */
56 
57 #endif	/* _ASM_ARC_FPU_H */
58