blob: 8e6a69d591808df2adc976dea4f4977032c7b577 [file] [log] [blame]
Thomas Gleixner588cb882019-05-23 11:14:57 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Palmer Dabbeltb35cd982017-05-23 10:28:26 -07002/*
Palmer Dabbeltb35cd982017-05-23 10:28:26 -07003 */
4
5#include <linux/export.h>
6
Christoph Hellwig4db2b602017-11-22 11:47:28 +01007#include <linux/libgcc.h>
Palmer Dabbeltb35cd982017-05-23 10:28:26 -07008
9long long notrace __ashldi3(long long u, word_type b)
10{
11 DWunion uu, w;
12 word_type bm;
13
14 if (b == 0)
15 return u;
16
17 uu.ll = u;
18 bm = 32 - b;
19
20 if (bm <= 0) {
21 w.s.low = 0;
22 w.s.high = (unsigned int) uu.s.low << -bm;
23 } else {
24 const unsigned int carries = (unsigned int) uu.s.low >> bm;
25
26 w.s.low = (unsigned int) uu.s.low << b;
27 w.s.high = ((unsigned int) uu.s.high << b) | carries;
28 }
29
30 return w.ll;
31}
32EXPORT_SYMBOL(__ashldi3);