136ac495dSmrg /* libgcc routines for MSP430
2*8feb0f0bSmrg Copyright (C) 2005-2020 Free Software Foundation, Inc.
336ac495dSmrg Contributed by Red Hat.
436ac495dSmrg
536ac495dSmrg This file is part of GCC.
636ac495dSmrg
736ac495dSmrg GCC is free software; you can redistribute it and/or modify it
836ac495dSmrg under the terms of the GNU General Public License as published
936ac495dSmrg by the Free Software Foundation; either version 3, or (at your
1036ac495dSmrg option) any later version.
1136ac495dSmrg
1236ac495dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT
1336ac495dSmrg ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1436ac495dSmrg or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
1536ac495dSmrg License for more details.
1636ac495dSmrg
1736ac495dSmrg Under Section 7 of GPL version 3, you are granted additional
1836ac495dSmrg permissions described in the GCC Runtime Library Exception, version
1936ac495dSmrg 3.1, as published by the Free Software Foundation.
2036ac495dSmrg
2136ac495dSmrg You should have received a copy of the GNU General Public License and
2236ac495dSmrg a copy of the GCC Runtime Library Exception along with this program;
2336ac495dSmrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
2436ac495dSmrg <http://www.gnu.org/licenses/>. */
2536ac495dSmrg
2636ac495dSmrg typedef unsigned int uint32_type __attribute__ ((mode (SI)));
2736ac495dSmrg typedef unsigned int uint16_type __attribute__ ((mode (HI)));
2836ac495dSmrg typedef unsigned int uint08_type __attribute__ ((mode (QI)));
2936ac495dSmrg
3036ac495dSmrg #define C3B(a,b,c) a##b##c
3136ac495dSmrg #define C3(a,b,c) C3B(a,b,c)
3236ac495dSmrg
3336ac495dSmrg #if defined MUL_NONE
3436ac495dSmrg
3536ac495dSmrg /* The software multiply library needs __mspabi_mpyll. */
3636ac495dSmrg
3736ac495dSmrg #undef UINT_TYPE
3836ac495dSmrg #undef BITS_MINUS_1
3936ac495dSmrg #undef NAME_MODE
4036ac495dSmrg
4136ac495dSmrg #define UINT_TYPE uint32_type
4236ac495dSmrg #define BITS_MINUS_1 31
4336ac495dSmrg #define NAME_MODE si
4436ac495dSmrg
4536ac495dSmrg #include "msp430-mul.h"
4636ac495dSmrg
4736ac495dSmrg #elif defined MUL_16
4836ac495dSmrg
49*8feb0f0bSmrg /* The 16-bit multiply library needs a software version of SI->DI widening
50*8feb0f0bSmrg multiplication. */
51*8feb0f0bSmrg
5236ac495dSmrg signed long long
__mspabi_mpysll(signed long a,signed long b)5336ac495dSmrg __mspabi_mpysll (signed long a, signed long b)
5436ac495dSmrg {
5536ac495dSmrg return (signed long long) a * (signed long long) b;
5636ac495dSmrg }
5736ac495dSmrg
5836ac495dSmrg unsigned long long
__mspabi_mpyull(unsigned long a,unsigned long b)5936ac495dSmrg __mspabi_mpyull (unsigned long a, unsigned long b)
6036ac495dSmrg {
6136ac495dSmrg return (unsigned long long) a * (unsigned long long) b;
6236ac495dSmrg }
6336ac495dSmrg
6436ac495dSmrg #else
6536ac495dSmrg
6636ac495dSmrg #undef UINT_TYPE
6736ac495dSmrg #undef BITS_MINUS_1
6836ac495dSmrg #undef NAME_MODE
6936ac495dSmrg
7036ac495dSmrg #define UINT_TYPE uint08_type
7136ac495dSmrg #define BITS_MINUS_1 7
7236ac495dSmrg #define NAME_MODE qi
7336ac495dSmrg
7436ac495dSmrg #include "msp430-mul.h"
7536ac495dSmrg
7636ac495dSmrg #endif /* MUL_NONE */
77