b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100 1) // SPDX-License-Identifier: GPL-2.0
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 2) #include "libgcc.h"
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 3)
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 4) DWtype
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 5) __ashldi3(DWtype u, word_type b)
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 6) {
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 7) const DWunion uu = {.ll = u};
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 8) const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 9) DWunion w;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 10)
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 11) if (b == 0)
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 12) return u;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 13)
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 14) if (bm <= 0) {
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 15) w.s.low = 0;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 16) w.s.high = (UWtype) uu.s.low << -bm;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 17) } else {
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 18) const UWtype carries = (UWtype) uu.s.low >> bm;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 19)
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 20) w.s.low = (UWtype) uu.s.low << b;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 21) w.s.high = ((UWtype) uu.s.high << b) | carries;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 22) }
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 23)
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 24) return w.ll;
a71a29de4c2f9 (Yoshinori Sato 2015-01-28 02:48:15 +0900 25) }