Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 578394
Collapse All | Expand All

(-)a/arch/mips/lib/ashldi3.c (-7 / +14 lines)
Lines 2-8 Link Here
2
2
3
#include "libgcc.h"
3
#include "libgcc.h"
4
4
5
long long __ashldi3(long long u, word_type b)
5
#ifdef CONFIG_64BIT
6
DWtype __ashlti3(DWtype u, word_type b)
7
#else
8
DWtype __ashldi3(DWtype u, word_type b)
9
#endif
6
{
10
{
7
	DWunion uu, w;
11
	DWunion uu, w;
8
	word_type bm;
12
	word_type bm;
Lines 11-29 long long __ashldi3(long long u, word_ty Link Here
11
		return u;
15
		return u;
12
16
13
	uu.ll = u;
17
	uu.ll = u;
14
	bm = 32 - b;
18
	bm = BITS_PER_LONG - b;
15
19
16
	if (bm <= 0) {
20
	if (bm <= 0) {
17
		w.s.low = 0;
21
		w.s.low = 0;
18
		w.s.high = (unsigned int) uu.s.low << -bm;
22
		w.s.high = (unsigned long) uu.s.low << -bm;
19
	} else {
23
	} else {
20
		const unsigned int carries = (unsigned int) uu.s.low >> bm;
24
		const unsigned long carries = (unsigned long) uu.s.low >> bm;
21
25
22
		w.s.low = (unsigned int) uu.s.low << b;
26
		w.s.low = (unsigned long) uu.s.low << b;
23
		w.s.high = ((unsigned int) uu.s.high << b) | carries;
27
		w.s.high = ((unsigned long) uu.s.high << b) | carries;
24
	}
28
	}
25
29
26
	return w.ll;
30
	return w.ll;
27
}
31
}
28
32
#ifdef CONFIG_64BIT
33
EXPORT_SYMBOL(__ashlti3);
34
#else
29
EXPORT_SYMBOL(__ashldi3);
35
EXPORT_SYMBOL(__ashldi3);
36
#endif
(-)a/arch/mips/lib/ashrdi3.c (-6 / +13 lines)
Lines 2-8 Link Here
2
2
3
#include "libgcc.h"
3
#include "libgcc.h"
4
4
5
long long __ashrdi3(long long u, word_type b)
5
#ifdef CONFIG_64BIT
6
DWtype __ashrti3(DWtype u, word_type b)
7
#else
8
DWtype __ashrdi3(DWtype u, word_type b)
9
#endif
6
{
10
{
7
	DWunion uu, w;
11
	DWunion uu, w;
8
	word_type bm;
12
	word_type bm;
Lines 11-31 long long __ashrdi3(long long u, word_ty Link Here
11
		return u;
15
		return u;
12
16
13
	uu.ll = u;
17
	uu.ll = u;
14
	bm = 32 - b;
18
	bm = BITS_PER_LONG - b;
15
19
16
	if (bm <= 0) {
20
	if (bm <= 0) {
17
		/* w.s.high = 1..1 or 0..0 */
21
		/* w.s.high = 1..1 or 0..0 */
18
		w.s.high =
22
		w.s.high =
19
		    uu.s.high >> 31;
23
		    uu.s.high >> (BITS_PER_LONG - 1);
20
		w.s.low = uu.s.high >> -bm;
24
		w.s.low = uu.s.high >> -bm;
21
	} else {
25
	} else {
22
		const unsigned int carries = (unsigned int) uu.s.high << bm;
26
		const unsigned long carries = (unsigned long) uu.s.high << bm;
23
27
24
		w.s.high = uu.s.high >> b;
28
		w.s.high = uu.s.high >> b;
25
		w.s.low = ((unsigned int) uu.s.low >> b) | carries;
29
		w.s.low = ((unsigned long) uu.s.low >> b) | carries;
26
	}
30
	}
27
31
28
	return w.ll;
32
	return w.ll;
29
}
33
}
30
34
#ifdef CONFIG_64BIT
35
EXPORT_SYMBOL(__ashrti3);
36
#else
31
EXPORT_SYMBOL(__ashrdi3);
37
EXPORT_SYMBOL(__ashrdi3);
38
#endif
(-)a/arch/mips/lib/libgcc.h (-3 / +9 lines)
Lines 5-17 Link Here
5
5
6
typedef int word_type __attribute__ ((mode (__word__)));
6
typedef int word_type __attribute__ ((mode (__word__)));
7
7
8
#ifdef CONFIG_64BIT
9
typedef int DWtype __attribute__((mode(TI)));
10
#else
11
typedef long long DWtype;
12
#endif
13
8
#ifdef __BIG_ENDIAN
14
#ifdef __BIG_ENDIAN
9
struct DWstruct {
15
struct DWstruct {
10
	int high, low;
16
	long high, low;
11
};
17
};
12
#elif defined(__LITTLE_ENDIAN)
18
#elif defined(__LITTLE_ENDIAN)
13
struct DWstruct {
19
struct DWstruct {
14
	int low, high;
20
	long low, high;
15
};
21
};
16
#else
22
#else
17
#error I feel sick.
23
#error I feel sick.
Lines 19-25 struct DWstruct { Link Here
19
25
20
typedef union {
26
typedef union {
21
	struct DWstruct s;
27
	struct DWstruct s;
22
	long long ll;
28
	DWtype ll;
23
} DWunion;
29
} DWunion;
24
30
25
#endif /* __ASM_LIBGCC_H */
31
#endif /* __ASM_LIBGCC_H */

Return to bug 578394