18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci */ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/export.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/libgcc.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_cilong long notrace __ashldi3(long long u, word_type b) 108c2ecf20Sopenharmony_ci{ 118c2ecf20Sopenharmony_ci DWunion uu, w; 128c2ecf20Sopenharmony_ci word_type bm; 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci if (b == 0) 158c2ecf20Sopenharmony_ci return u; 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci uu.ll = u; 188c2ecf20Sopenharmony_ci bm = 32 - b; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci if (bm <= 0) { 218c2ecf20Sopenharmony_ci w.s.low = 0; 228c2ecf20Sopenharmony_ci w.s.high = (unsigned int) uu.s.low << -bm; 238c2ecf20Sopenharmony_ci } else { 248c2ecf20Sopenharmony_ci const unsigned int carries = (unsigned int) uu.s.low >> bm; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci w.s.low = (unsigned int) uu.s.low << b; 278c2ecf20Sopenharmony_ci w.s.high = ((unsigned int) uu.s.high << b) | carries; 288c2ecf20Sopenharmony_ci } 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci return w.ll; 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__ashldi3); 33