/*1* arch/score/lib/ashrdi3.c2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation; either version 2 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, see the file COPYING, or write15* to the Free Software Foundation, Inc.,16* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA17*/1819#include <linux/module.h>20#include "libgcc.h"2122long long __ashrdi3(long long u, word_type b)23{24DWunion uu, w;25word_type bm;2627if (b == 0)28return u;2930uu.ll = u;31bm = 32 - b;3233if (bm <= 0) {34/* w.s.high = 1..1 or 0..0 */35w.s.high =36uu.s.high >> 31;37w.s.low = uu.s.high >> -bm;38} else {39const unsigned int carries = (unsigned int) uu.s.high << bm;4041w.s.high = uu.s.high >> b;42w.s.low = ((unsigned int) uu.s.low >> b) | carries;43}4445return w.ll;46}47EXPORT_SYMBOL(__ashrdi3);484950