2 * Copyright (C) 1989-2013 Free Software Foundation, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
10 __ashldi3(DWtype u, shift_count_type b)
15 const DWunion uu = {.ll = u};
16 const shift_count_type bm = W_TYPE_SIZE - b;
21 w.s.high = (UWtype)uu.s.low << -bm;
23 const UWtype carries = (UWtype) uu.s.low >> bm;
25 w.s.low = (UWtype)uu.s.low << b;
26 w.s.high = ((UWtype)uu.s.high << b) | carries;
33 __ashrdi3(DWtype u, shift_count_type b)
38 const DWunion uu = {.ll = u};
39 const shift_count_type bm = W_TYPE_SIZE - b;
43 /* w.s.high = 1..1 or 0..0 */
44 w.s.high = uu.s.high >> (W_TYPE_SIZE - 1);
45 w.s.low = uu.s.high >> -bm;
47 const UWtype carries = (UWtype) uu.s.high << bm;
49 w.s.high = uu.s.high >> b;
50 w.s.low = ((UWtype)uu.s.low >> b) | carries;
57 __lshrdi3(DWtype u, shift_count_type b)
62 const DWunion uu = {.ll = u};
63 const shift_count_type bm = W_TYPE_SIZE - b;
68 w.s.low = (UWtype)uu.s.high >> -bm;
70 const UWtype carries = (UWtype)uu.s.high << bm;
72 w.s.high = (UWtype)uu.s.high >> b;
73 w.s.low = ((UWtype)uu.s.low >> b) | carries;
80 udivmodsi4(unsigned long num, unsigned long den, int modwanted)
82 unsigned long bit = 1;
83 unsigned long res = 0;
85 while (den < num && bit && !(den & (1L<<31))) {
106 __divsi3(long a, long b)
121 res = udivmodsi4(a, b, 0);
130 __modsi3(long a, long b)
143 res = udivmodsi4(a, b, 1);
152 __udivsi3(long a, long b)
154 return udivmodsi4(a, b, 0);
158 __umodsi3(long a, long b)
160 return udivmodsi4(a, b, 1);