GNU Linux-libre 4.14.332-gnu1
[releases.git] / arch / tile / include / uapi / arch / intreg.h
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Copyright 2017 Tilera Corporation. All Rights Reserved.
4  *
5  *   This program is free software; you can redistribute it and/or
6  *   modify it under the terms of the GNU General Public License
7  *   as published by the Free Software Foundation, version 2.
8  *
9  *   This program is distributed in the hope that it will be useful, but
10  *   WITHOUT ANY WARRANTY; without even the implied warranty of
11  *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12  *   NON INFRINGEMENT.  See the GNU General Public License for
13  *   more details.
14  */
15
16 /**
17  * @file
18  *
19  * Provide types and defines for the type that can hold a register,
20  * in the implementation namespace.
21  */
22
23 #ifndef __ARCH_INTREG_H__
24 #define __ARCH_INTREG_H__
25
26 /*
27  * Get number of bits in a register.  __INT_REG_BITS may be defined
28  * prior to including this header to force a particular bit width.
29  */
30
31 #ifndef __INT_REG_BITS
32 # if defined __tilegx__
33 #  define __INT_REG_BITS 64
34 # elif defined __tilepro__
35 #  define __INT_REG_BITS 32
36 # else
37 #  error Unrecognized architecture
38 # endif
39 #endif
40
41 #if __INT_REG_BITS == 64
42
43 # ifndef __ASSEMBLER__
44 /** Unsigned type that can hold a register. */
45 typedef unsigned long long __uint_reg_t;
46
47 /** Signed type that can hold a register. */
48 typedef long long __int_reg_t;
49 # endif
50
51 /** String prefix to use for printf(). */
52 # define __INT_REG_FMT "ll"
53
54 #elif __INT_REG_BITS == 32
55
56 # ifndef __ASSEMBLER__
57 /** Unsigned type that can hold a register. */
58 typedef unsigned long __uint_reg_t;
59
60 /** Signed type that can hold a register. */
61 typedef long __int_reg_t;
62 # endif
63
64 /** String prefix to use for printf(). */
65 # define __INT_REG_FMT "l"
66
67 #else
68 # error Unrecognized value of __INT_REG_BITS
69 #endif
70
71 #endif /* !__ARCH_INTREG_H__ */