1 /* A few TImode functions needed for TFmode emulated arithmetic.
2 Copyright 2002, 2003 Free Software Foundation, Inc.
3 Contributed by Alexandre Oliva <aoliva@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
24 #include "coretypes.h"
27 #if _MIPS_SIM == 2 /* N32 */ || _MIPS_SIM == 3 /* 64 */
29 typedef int TItype __attribute__ ((mode (TI)));
30 typedef int DItype __attribute__ ((mode (DI)));
31 typedef int SItype __attribute__ ((mode (SI)));
33 typedef unsigned int UDItype __attribute__ ((mode (DI)));
38 #if LIBGCC2_WORDS_BIG_ENDIAN
47 TItype __negti2 (TItype);
48 TItype __ashlti3 (TItype, int);
50 TItype __ashrti3 (TItype, int);
52 TItype __lshrti3 (TItype, int);
63 w.s.high = -uu.s.high - ((UDItype) w.s.low > 0);
69 __ashlti3 (TItype u, int b)
80 bm = (sizeof (DItype) * BITS_PER_UNIT) - b;
84 w.s.high = (UDItype) uu.s.low << -bm;
88 UDItype carries = (UDItype) uu.s.low >> bm;
90 w.s.low = (UDItype) uu.s.low << b;
91 w.s.high = ((UDItype) uu.s.high << b) | carries;
99 __ashrti3 (TItype u, int b)
110 bm = (sizeof (DItype) * BITS_PER_UNIT) - b;
113 /* w.s.high = 1..1 or 0..0 */
114 w.s.high = uu.s.high >> (sizeof (DItype) * BITS_PER_UNIT - 1);
115 w.s.low = uu.s.high >> -bm;
119 UDItype carries = (UDItype) uu.s.high << bm;
121 w.s.high = uu.s.high >> b;
122 w.s.low = ((UDItype) uu.s.low >> b) | carries;
130 __lshrti3 (TItype u, int b)
141 bm = (sizeof (DItype) * BITS_PER_UNIT) - b;
145 w.s.low = (UDItype) uu.s.high >> -bm;
149 UDItype carries = (UDItype) uu.s.high << bm;
151 w.s.high = (UDItype) uu.s.high >> b;
152 w.s.low = ((UDItype) uu.s.low >> b) | carries;
158 #endif /* N32 or N64 */