From eeb84df6e43212a31e96402788ec9b3e39a399a6 Mon Sep 17 00:00:00 2001 From: Phil Edworthy Date: Thu, 2 Jun 2011 22:15:27 +0000 Subject: sh: Add support for SH2A freestanding build SH2A toolchains often only provide an fdpic version of libgcc. This can't be used with bare-metal software like U-Boot, so this patch provides the necessary functions extracted from libgcc. Signed-off-by: Phil Edworthy Cc: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- arch/sh/lib/lshrdi3.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 arch/sh/lib/lshrdi3.c (limited to 'arch/sh/lib/lshrdi3.c') diff --git a/arch/sh/lib/lshrdi3.c b/arch/sh/lib/lshrdi3.c new file mode 100644 index 00000000000..bb340accba2 --- /dev/null +++ b/arch/sh/lib/lshrdi3.c @@ -0,0 +1,25 @@ +#include "libgcc.h" + +long long __lshrdi3(long long u, word_type b) +{ + DWunion uu, w; + word_type bm; + + if (b == 0) + return u; + + uu.ll = u; + bm = 32 - b; + + if (bm <= 0) { + w.s.high = 0; + w.s.low = (unsigned int) uu.s.high >> -bm; + } else { + const unsigned int carries = (unsigned int) uu.s.high << bm; + + w.s.high = (unsigned int) uu.s.high >> b; + w.s.low = ((unsigned int) uu.s.low >> b) | carries; + } + + return w.ll; +} -- cgit v1.2.3