1 // SPDX-License-Identifier: GPL-2.0+
3 * ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is:
4 * Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
7 #define BITS_PER_UNIT 8
9 typedef int SItype __attribute__((mode(SI)));
10 typedef unsigned int USItype __attribute__((mode(SI)));
11 typedef int DItype __attribute__((mode(DI)));
12 typedef int word_type __attribute__((mode(__word__)));
23 DItype __ashrdi3(DItype u, word_type b)
34 bm = (sizeof(SItype) * BITS_PER_UNIT) - b;
36 /* w.s.high = 1..1 or 0..0 */
37 w.s.high = uu.s.high >> (sizeof(SItype) * BITS_PER_UNIT - 1);
38 w.s.low = uu.s.high >> -bm;
40 USItype carries = (USItype)uu.s.high << bm;
42 w.s.high = uu.s.high >> b;
43 w.s.low = ((USItype)uu.s.low >> b) | carries;