xref: /rk3399_rockchip-uboot/arch/arc/lib/libgcc2.h (revision e1cc4d31f889428a4ca73120951389c756404184)
1*a67ef280SAlexey Brodkin /*
2*a67ef280SAlexey Brodkin  * Copyright (C) 1989-2013 Free Software Foundation, Inc.
3*a67ef280SAlexey Brodkin  *
4*a67ef280SAlexey Brodkin  * SPDX-License-Identifier:	GPL-2.0+
5*a67ef280SAlexey Brodkin  */
6*a67ef280SAlexey Brodkin 
7*a67ef280SAlexey Brodkin #ifndef __ASM_LIBGCC_H
8*a67ef280SAlexey Brodkin #define __ASM_LIBGCC_H
9*a67ef280SAlexey Brodkin 
10*a67ef280SAlexey Brodkin #define UNITS_PER_WORD 4	/* for ARC */
11*a67ef280SAlexey Brodkin #define BITS_PER_UNIT 8		/* for ARC */
12*a67ef280SAlexey Brodkin 
13*a67ef280SAlexey Brodkin #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
14*a67ef280SAlexey Brodkin 
15*a67ef280SAlexey Brodkin #define MIN_UNITS_PER_WORD UNITS_PER_WORD
16*a67ef280SAlexey Brodkin 
17*a67ef280SAlexey Brodkin /* Work out the largest "word" size that we can deal with on this target.  */
18*a67ef280SAlexey Brodkin #if MIN_UNITS_PER_WORD > 4
19*a67ef280SAlexey Brodkin # define LIBGCC2_MAX_UNITS_PER_WORD 8
20*a67ef280SAlexey Brodkin #elif (MIN_UNITS_PER_WORD > 2 \
21*a67ef280SAlexey Brodkin        || (MIN_UNITS_PER_WORD > 1 && __SIZEOF_LONG_LONG__ > 4))
22*a67ef280SAlexey Brodkin # define LIBGCC2_MAX_UNITS_PER_WORD 4
23*a67ef280SAlexey Brodkin #else
24*a67ef280SAlexey Brodkin # define LIBGCC2_MAX_UNITS_PER_WORD MIN_UNITS_PER_WORD
25*a67ef280SAlexey Brodkin #endif
26*a67ef280SAlexey Brodkin 
27*a67ef280SAlexey Brodkin /* Work out what word size we are using for this compilation.
28*a67ef280SAlexey Brodkin    The value can be set on the command line.  */
29*a67ef280SAlexey Brodkin #ifndef LIBGCC2_UNITS_PER_WORD
30*a67ef280SAlexey Brodkin #define LIBGCC2_UNITS_PER_WORD LIBGCC2_MAX_UNITS_PER_WORD
31*a67ef280SAlexey Brodkin #endif
32*a67ef280SAlexey Brodkin 
33*a67ef280SAlexey Brodkin typedef		 int QItype	__attribute__ ((mode (QI)));
34*a67ef280SAlexey Brodkin typedef unsigned int UQItype	__attribute__ ((mode (QI)));
35*a67ef280SAlexey Brodkin typedef		 int HItype	__attribute__ ((mode (HI)));
36*a67ef280SAlexey Brodkin typedef unsigned int UHItype	__attribute__ ((mode (HI)));
37*a67ef280SAlexey Brodkin #if MIN_UNITS_PER_WORD > 1
38*a67ef280SAlexey Brodkin /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1.  */
39*a67ef280SAlexey Brodkin typedef 	 int SItype	__attribute__ ((mode (SI)));
40*a67ef280SAlexey Brodkin typedef unsigned int USItype	__attribute__ ((mode (SI)));
41*a67ef280SAlexey Brodkin #if __SIZEOF_LONG_LONG__ > 4
42*a67ef280SAlexey Brodkin /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2.  */
43*a67ef280SAlexey Brodkin typedef		 int DItype	__attribute__ ((mode (DI)));
44*a67ef280SAlexey Brodkin typedef unsigned int UDItype	__attribute__ ((mode (DI)));
45*a67ef280SAlexey Brodkin #if MIN_UNITS_PER_WORD > 4
46*a67ef280SAlexey Brodkin /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4.  */
47*a67ef280SAlexey Brodkin typedef		 int TItype	__attribute__ ((mode (TI)));
48*a67ef280SAlexey Brodkin typedef unsigned int UTItype	__attribute__ ((mode (TI)));
49*a67ef280SAlexey Brodkin #endif
50*a67ef280SAlexey Brodkin #endif
51*a67ef280SAlexey Brodkin #endif
52*a67ef280SAlexey Brodkin 
53*a67ef280SAlexey Brodkin #if LIBGCC2_UNITS_PER_WORD == 8
54*a67ef280SAlexey Brodkin #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
55*a67ef280SAlexey Brodkin #define Wtype	DItype
56*a67ef280SAlexey Brodkin #define UWtype	UDItype
57*a67ef280SAlexey Brodkin #define HWtype	DItype
58*a67ef280SAlexey Brodkin #define UHWtype	UDItype
59*a67ef280SAlexey Brodkin #define DWtype	TItype
60*a67ef280SAlexey Brodkin #define UDWtype	UTItype
61*a67ef280SAlexey Brodkin #ifdef LIBGCC2_GNU_PREFIX
62*a67ef280SAlexey Brodkin #define __NW(a,b)	__gnu_ ## a ## di ## b
63*a67ef280SAlexey Brodkin #define __NDW(a,b)	__gnu_ ## a ## ti ## b
64*a67ef280SAlexey Brodkin #else
65*a67ef280SAlexey Brodkin #define __NW(a,b)	__ ## a ## di ## b
66*a67ef280SAlexey Brodkin #define __NDW(a,b)	__ ## a ## ti ## b
67*a67ef280SAlexey Brodkin #endif
68*a67ef280SAlexey Brodkin #elif LIBGCC2_UNITS_PER_WORD == 4
69*a67ef280SAlexey Brodkin #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
70*a67ef280SAlexey Brodkin #define Wtype	SItype
71*a67ef280SAlexey Brodkin #define UWtype	USItype
72*a67ef280SAlexey Brodkin #define HWtype	SItype
73*a67ef280SAlexey Brodkin #define UHWtype	USItype
74*a67ef280SAlexey Brodkin #define DWtype	DItype
75*a67ef280SAlexey Brodkin #define UDWtype	UDItype
76*a67ef280SAlexey Brodkin #ifdef LIBGCC2_GNU_PREFIX
77*a67ef280SAlexey Brodkin #define __NW(a,b)	__gnu_ ## a ## si ## b
78*a67ef280SAlexey Brodkin #define __NDW(a,b)	__gnu_ ## a ## di ## b
79*a67ef280SAlexey Brodkin #else
80*a67ef280SAlexey Brodkin #define __NW(a,b)	__ ## a ## si ## b
81*a67ef280SAlexey Brodkin #define __NDW(a,b)	__ ## a ## di ## b
82*a67ef280SAlexey Brodkin #endif
83*a67ef280SAlexey Brodkin #elif LIBGCC2_UNITS_PER_WORD == 2
84*a67ef280SAlexey Brodkin #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
85*a67ef280SAlexey Brodkin #define Wtype	HItype
86*a67ef280SAlexey Brodkin #define UWtype	UHItype
87*a67ef280SAlexey Brodkin #define HWtype	HItype
88*a67ef280SAlexey Brodkin #define UHWtype	UHItype
89*a67ef280SAlexey Brodkin #define DWtype	SItype
90*a67ef280SAlexey Brodkin #define UDWtype	USItype
91*a67ef280SAlexey Brodkin #ifdef LIBGCC2_GNU_PREFIX
92*a67ef280SAlexey Brodkin #define __NW(a,b)	__gnu_ ## a ## hi ## b
93*a67ef280SAlexey Brodkin #define __NDW(a,b)	__gnu_ ## a ## si ## b
94*a67ef280SAlexey Brodkin #else
95*a67ef280SAlexey Brodkin #define __NW(a,b)	__ ## a ## hi ## b
96*a67ef280SAlexey Brodkin #define __NDW(a,b)	__ ## a ## si ## b
97*a67ef280SAlexey Brodkin #endif
98*a67ef280SAlexey Brodkin #else
99*a67ef280SAlexey Brodkin #define W_TYPE_SIZE BITS_PER_UNIT
100*a67ef280SAlexey Brodkin #define Wtype	QItype
101*a67ef280SAlexey Brodkin #define UWtype  UQItype
102*a67ef280SAlexey Brodkin #define HWtype	QItype
103*a67ef280SAlexey Brodkin #define UHWtype	UQItype
104*a67ef280SAlexey Brodkin #define DWtype	HItype
105*a67ef280SAlexey Brodkin #define UDWtype	UHItype
106*a67ef280SAlexey Brodkin #ifdef LIBGCC2_GNU_PREFIX
107*a67ef280SAlexey Brodkin #define __NW(a,b)	__gnu_ ## a ## qi ## b
108*a67ef280SAlexey Brodkin #define __NDW(a,b)	__gnu_ ## a ## hi ## b
109*a67ef280SAlexey Brodkin #else
110*a67ef280SAlexey Brodkin #define __NW(a,b)	__ ## a ## qi ## b
111*a67ef280SAlexey Brodkin #define __NDW(a,b)	__ ## a ## hi ## b
112*a67ef280SAlexey Brodkin #endif
113*a67ef280SAlexey Brodkin #endif
114*a67ef280SAlexey Brodkin 
115*a67ef280SAlexey Brodkin typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
116*a67ef280SAlexey Brodkin 
117*a67ef280SAlexey Brodkin #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
118*a67ef280SAlexey Brodkin 	struct DWstruct {Wtype high, low;};
119*a67ef280SAlexey Brodkin #else
120*a67ef280SAlexey Brodkin 	struct DWstruct {Wtype low, high;};
121*a67ef280SAlexey Brodkin #endif
122*a67ef280SAlexey Brodkin 
123*a67ef280SAlexey Brodkin /* We need this union to unpack/pack DImode values, since we don't have
124*a67ef280SAlexey Brodkin    any arithmetic yet.  Incoming DImode parameters are stored into the
125*a67ef280SAlexey Brodkin    `ll' field, and the unpacked result is read from the struct `s'.  */
126*a67ef280SAlexey Brodkin 
127*a67ef280SAlexey Brodkin typedef union {
128*a67ef280SAlexey Brodkin 	struct DWstruct s;
129*a67ef280SAlexey Brodkin 	DWtype ll;
130*a67ef280SAlexey Brodkin } DWunion;
131*a67ef280SAlexey Brodkin 
132*a67ef280SAlexey Brodkin #endif /* __ASM_LIBGCC_H */
133