-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIPS] Fix optimization for size build.
It took a while longer than on other architectures but gcc has finally started to strike us as well ... This also fixes the damage by 6edfba1. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
- Loading branch information
Ralf Baechle
committed
Jun 19, 2006
1 parent
aac076f
commit 72fbfb2
Showing
6 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <linux/module.h> | ||
|
||
#include "libgcc.h" | ||
|
||
long long __ashldi3(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.low = 0; | ||
w.s.high = (unsigned int) uu.s.low << -bm; | ||
} else { | ||
const unsigned int carries = (unsigned int) uu.s.low >> bm; | ||
|
||
w.s.low = (unsigned int) uu.s.low << b; | ||
w.s.high = ((unsigned int) uu.s.high << b) | carries; | ||
} | ||
|
||
return w.ll; | ||
} | ||
|
||
EXPORT_SYMBOL(__ashldi3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <linux/module.h> | ||
|
||
#include "libgcc.h" | ||
|
||
long long __ashrdi3(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 = 1..1 or 0..0 */ | ||
w.s.high = | ||
uu.s.high >> 31; | ||
w.s.low = uu.s.high >> -bm; | ||
} else { | ||
const unsigned int carries = (unsigned int) uu.s.high << bm; | ||
|
||
w.s.high = uu.s.high >> b; | ||
w.s.low = ((unsigned int) uu.s.low >> b) | carries; | ||
} | ||
|
||
return w.ll; | ||
} | ||
|
||
EXPORT_SYMBOL(__ashrdi3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef __ASM_LIBGCC_H | ||
#define __ASM_LIBGCC_H | ||
|
||
#include <asm/byteorder.h> | ||
|
||
typedef int word_type __attribute__ ((mode (__word__))); | ||
|
||
#ifdef __BIG_ENDIAN | ||
struct DWstruct { | ||
int high, low; | ||
}; | ||
#elif defined(__LITTLE_ENDIAN) | ||
struct DWstruct { | ||
int low, high; | ||
}; | ||
#else | ||
#error I feel sick. | ||
#endif | ||
|
||
typedef union | ||
{ | ||
struct DWstruct s; | ||
long long ll; | ||
} DWunion; | ||
|
||
#endif /* __ASM_LIBGCC_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <linux/module.h> | ||
|
||
#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; | ||
} | ||
|
||
EXPORT_SYMBOL(__lshrdi3); |