xref: /netbsd-src/external/gpl3/gcc.old/dist/libgcc/config/avr/avr-lib.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1*8feb0f0bSmrg /* Copyright (C) 2012-2020 Free Software Foundation, Inc.
236ac495dSmrg 
336ac495dSmrg This file is part of GCC.
436ac495dSmrg 
536ac495dSmrg GCC is free software; you can redistribute it and/or modify it under
636ac495dSmrg the terms of the GNU General Public License as published by the Free
736ac495dSmrg Software Foundation; either version 3, or (at your option) any later
836ac495dSmrg version.
936ac495dSmrg 
1036ac495dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1136ac495dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
1236ac495dSmrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1336ac495dSmrg for more details.
1436ac495dSmrg 
1536ac495dSmrg Under Section 7 of GPL version 3, you are granted additional
1636ac495dSmrg permissions described in the GCC Runtime Library Exception, version
1736ac495dSmrg 3.1, as published by the Free Software Foundation.
1836ac495dSmrg 
1936ac495dSmrg You should have received a copy of the GNU General Public License and
2036ac495dSmrg a copy of the GCC Runtime Library Exception along with this program;
2136ac495dSmrg see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2236ac495dSmrg <http://www.gnu.org/licenses/>.  */
2336ac495dSmrg 
2436ac495dSmrg #ifdef FLOAT
2536ac495dSmrg #define CMPtype QItype
2636ac495dSmrg #define DF SF
2736ac495dSmrg #define DI SI
2836ac495dSmrg typedef int QItype __attribute__ ((mode (QI)));
2936ac495dSmrg #endif
3036ac495dSmrg 
3136ac495dSmrg /* fixed-bit.h does not define functions for TA and UTA because
3236ac495dSmrg    that part is wrapped in #if MIN_UNITS_PER_WORD > 4.
3336ac495dSmrg    This would lead to empty functions for TA and UTA.
3436ac495dSmrg    Thus, supply appropriate defines as if HAVE_[U]TA == 1.
3536ac495dSmrg    #define HAVE_[U]TA 1 won't work because avr-modes.def
3636ac495dSmrg    uses ADJUST_BYTESIZE(TA,8) and fixed-bit.h is not generic enough
3736ac495dSmrg    to arrange for such changes of the mode size.  */
3836ac495dSmrg 
3936ac495dSmrg typedef unsigned _Fract UTAtype __attribute__ ((mode (UTA)));
4036ac495dSmrg 
4136ac495dSmrg #if defined (UTA_MODE)
4236ac495dSmrg #define FIXED_SIZE      8       /* in bytes */
4336ac495dSmrg #define INT_C_TYPE      UDItype
4436ac495dSmrg #define UINT_C_TYPE     UDItype
4536ac495dSmrg #define HINT_C_TYPE     USItype
4636ac495dSmrg #define HUINT_C_TYPE    USItype
4736ac495dSmrg #define MODE_NAME       UTA
4836ac495dSmrg #define MODE_NAME_S     uta
4936ac495dSmrg #define MODE_UNSIGNED   1
5036ac495dSmrg #endif
5136ac495dSmrg 
5236ac495dSmrg #if defined (FROM_UTA)
5336ac495dSmrg #define FROM_TYPE               4       /* ID for fixed-point */
5436ac495dSmrg #define FROM_MODE_NAME          UTA
5536ac495dSmrg #define FROM_MODE_NAME_S        uta
5636ac495dSmrg #define FROM_INT_C_TYPE         UDItype
5736ac495dSmrg #define FROM_SINT_C_TYPE        DItype
5836ac495dSmrg #define FROM_UINT_C_TYPE        UDItype
5936ac495dSmrg #define FROM_MODE_UNSIGNED      1
6036ac495dSmrg #define FROM_FIXED_SIZE         8       /* in bytes */
6136ac495dSmrg #elif defined (TO_UTA)
6236ac495dSmrg #define TO_TYPE                 4       /* ID for fixed-point */
6336ac495dSmrg #define TO_MODE_NAME            UTA
6436ac495dSmrg #define TO_MODE_NAME_S          uta
6536ac495dSmrg #define TO_INT_C_TYPE           UDItype
6636ac495dSmrg #define TO_SINT_C_TYPE          DItype
6736ac495dSmrg #define TO_UINT_C_TYPE          UDItype
6836ac495dSmrg #define TO_MODE_UNSIGNED        1
6936ac495dSmrg #define TO_FIXED_SIZE           8       /* in bytes */
7036ac495dSmrg #endif
7136ac495dSmrg 
7236ac495dSmrg /* Same for TAmode */
7336ac495dSmrg 
7436ac495dSmrg typedef _Fract TAtype  __attribute__ ((mode (TA)));
7536ac495dSmrg 
7636ac495dSmrg #if defined (TA_MODE)
7736ac495dSmrg #define FIXED_SIZE      8       /* in bytes */
7836ac495dSmrg #define INT_C_TYPE      DItype
7936ac495dSmrg #define UINT_C_TYPE     UDItype
8036ac495dSmrg #define HINT_C_TYPE     SItype
8136ac495dSmrg #define HUINT_C_TYPE    USItype
8236ac495dSmrg #define MODE_NAME       TA
8336ac495dSmrg #define MODE_NAME_S     ta
8436ac495dSmrg #define MODE_UNSIGNED   0
8536ac495dSmrg #endif
8636ac495dSmrg 
8736ac495dSmrg #if defined (FROM_TA)
8836ac495dSmrg #define FROM_TYPE               4       /* ID for fixed-point */
8936ac495dSmrg #define FROM_MODE_NAME          TA
9036ac495dSmrg #define FROM_MODE_NAME_S        ta
9136ac495dSmrg #define FROM_INT_C_TYPE         DItype
9236ac495dSmrg #define FROM_SINT_C_TYPE        DItype
9336ac495dSmrg #define FROM_UINT_C_TYPE        UDItype
9436ac495dSmrg #define FROM_MODE_UNSIGNED      0
9536ac495dSmrg #define FROM_FIXED_SIZE         8       /* in bytes */
9636ac495dSmrg #elif defined (TO_TA)
9736ac495dSmrg #define TO_TYPE                 4       /* ID for fixed-point */
9836ac495dSmrg #define TO_MODE_NAME            TA
9936ac495dSmrg #define TO_MODE_NAME_S          ta
10036ac495dSmrg #define TO_INT_C_TYPE           DItype
10136ac495dSmrg #define TO_SINT_C_TYPE          DItype
10236ac495dSmrg #define TO_UINT_C_TYPE          UDItype
10336ac495dSmrg #define TO_MODE_UNSIGNED        0
10436ac495dSmrg #define TO_FIXED_SIZE           8       /* in bytes */
10536ac495dSmrg #endif
106