diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-04-28 15:16:16 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-04-30 15:52:45 -0400 |
commit | 26b9e547e90db6b8b409084a9d4501124ff492b3 (patch) | |
tree | 020bfdc2f464477b032e2bc5d766a36382f7e5b4 | |
parent | ce384d83d00ee457c3931d3fdb9fa2c38e345a3c (diff) |
MIPS: Add uasm_i_dsrl_safe() and uasm_i_dsll_safe() to uasm.
This allows us to clean up the code by not having to explicitly code
checks for shift amounts greater than 32.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/1153/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/include/asm/uasm.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h index 11a8b5252549..697e40c06497 100644 --- a/arch/mips/include/asm/uasm.h +++ b/arch/mips/include/asm/uasm.h | |||
@@ -167,6 +167,24 @@ static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ | |||
167 | #define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1) | 167 | #define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1) |
168 | #define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3) | 168 | #define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3) |
169 | 169 | ||
170 | static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1, | ||
171 | unsigned int a2, unsigned int a3) | ||
172 | { | ||
173 | if (a3 < 32) | ||
174 | uasm_i_dsrl(p, a1, a2, a3); | ||
175 | else | ||
176 | uasm_i_dsrl32(p, a1, a2, a3 - 32); | ||
177 | } | ||
178 | |||
179 | static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1, | ||
180 | unsigned int a2, unsigned int a3) | ||
181 | { | ||
182 | if (a3 < 32) | ||
183 | uasm_i_dsll(p, a1, a2, a3); | ||
184 | else | ||
185 | uasm_i_dsll32(p, a1, a2, a3 - 32); | ||
186 | } | ||
187 | |||
170 | /* Handle relocations. */ | 188 | /* Handle relocations. */ |
171 | struct uasm_reloc { | 189 | struct uasm_reloc { |
172 | u32 *addr; | 190 | u32 *addr; |