Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / libgcc / __negti2.c
1 /* Extracted from gcc-3.4.1/gcc/config/mips/_tilibi.c */
2 /* A few TImode functions needed for TFmode emulated arithmetic.
3    Copyright 2002, 2003 Free Software Foundation, Inc.
4    Contributed by Alexandre Oliva <aoliva@redhat.com>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 #include "libgcc.h"
24
25 #if defined(__sparc__) || defined(__ppc__)
26 #define LIBGCC2_WORDS_BIG_ENDIAN
27 #endif
28
29 typedef union
30 {
31   struct TIstruct {
32 #if defined(LIBGCC2_WORDS_BIG_ENDIAN)
33     DItype high, low;
34 #else
35     DItype low, high;
36 #endif
37   } s;
38   TItype ll;
39 } TIunion;
40
41 TItype
42 __negti2 (TItype u)
43 {
44   TIunion w;
45   TIunion uu;
46
47   uu.ll = u;
48
49   w.s.low = -uu.s.low;
50   w.s.high = -uu.s.high - ((UDItype) w.s.low > 0);
51
52   return w.ll;
53 }