1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/export.h>
3 
4 #include "libgcc.h"
5 
__ashrdi3(long long u,word_type b)6 long long __ashrdi3(long long u, word_type b)
7 {
8 	DWunion uu, w;
9 	word_type bm;
10 
11 	if (b == 0)
12 		return u;
13 
14 	uu.ll = u;
15 	bm = 32 - b;
16 
17 	if (bm <= 0) {
18 		/* w.s.high = 1..1 or 0..0 */
19 		w.s.high =
20 		    uu.s.high >> 31;
21 		w.s.low = uu.s.high >> -bm;
22 	} else {
23 		const unsigned int carries = (unsigned int) uu.s.high << bm;
24 
25 		w.s.high = uu.s.high >> b;
26 		w.s.low = ((unsigned int) uu.s.low >> b) | carries;
27 	}
28 
29 	return w.ll;
30 }
31 EXPORT_SYMBOL(__ashrdi3);
32