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