ppc64: Don't set Kp bit on SLB
[openbios/afaerber.git] / libgcc / ashldi3.c
blob6feb063e86bcacb38d4452cd0e7bda7d8d6e9275
1 /* ashrdi3.c extracted from gcc-2.95.2/libgcc2.c which is: */
2 /* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 51 Franklin St, Fifth Floor, Boston,
19 MA 02110-1301, USA. */
21 #include "libgcc.h"
23 #define BITS_PER_UNIT 8
25 struct DIstruct {SItype high, low;};
27 typedef union
29 struct DIstruct s;
30 DItype ll;
31 } DIunion;
33 DItype
34 __ashldi3 (DItype u, word_type b)
36 DIunion w;
37 word_type bm;
38 DIunion uu;
40 if (b == 0)
41 return u;
43 uu.ll = u;
45 bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
46 if (bm <= 0)
48 w.s.low = 0;
49 w.s.high = (USItype)uu.s.low << -bm;
51 else
53 USItype carries = (USItype)uu.s.low >> bm;
54 w.s.low = (USItype)uu.s.low << b;
55 w.s.high = ((USItype)uu.s.high << b) | carries;
58 return w.ll;