aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/lib/libgcc/__muldi3.c
blob: 3308abdd5580f5ff2f6675abcede517ed156946f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "libgcc.h"

union DWunion {
	struct {
		s32 high;
		s32 low;
	} s;
	s64 ll;
};

s64 __muldi3(s64 u, s64 v)
{
	const union DWunion uu = { .ll = u };
	const union DWunion vv = { .ll = v };
	union DWunion w = { .ll = __umulsidi3(uu.s.low, vv.s.low) };

	w.s.high += ((u32)uu.s.low * (u32)vv.s.high
		+ (u32)uu.s.high * (u32)vv.s.low);

	return w.ll;
}
EXPORT_SYMBOL(__muldi3);