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