diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2009-04-18 21:21:22 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-05-14 08:50:26 -0400 |
commit | 47740eb887796608fb4c629aa6b8507a2fb6c0eb (patch) | |
tree | 3b772b4b5f3a09899ec27c131cfdace411c75d74 /arch | |
parent | 5d57c31e5790d44905af0459a21086dbad167d26 (diff) |
MIPS: Enable CLO / CLZ instructions via separate CPU property
This is useful for IDT RC32332, RC32334 and NEC VR5500 processors which do
not implement the full MIPS32 / MIPS64 architecture.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/include/asm/bitops.h | 4 | ||||
-rw-r--r-- | arch/mips/include/asm/cpu-features.h | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h index bac4a960b24c..b1e9e97a9c78 100644 --- a/arch/mips/include/asm/bitops.h +++ b/arch/mips/include/asm/bitops.h | |||
@@ -567,7 +567,7 @@ static inline unsigned long __fls(unsigned long word) | |||
567 | int num; | 567 | int num; |
568 | 568 | ||
569 | if (BITS_PER_LONG == 32 && | 569 | if (BITS_PER_LONG == 32 && |
570 | __builtin_constant_p(cpu_has_mips_r) && cpu_has_mips_r) { | 570 | __builtin_constant_p(cpu_has_clo_clz) && cpu_has_clo_clz) { |
571 | __asm__( | 571 | __asm__( |
572 | " .set push \n" | 572 | " .set push \n" |
573 | " .set mips32 \n" | 573 | " .set mips32 \n" |
@@ -644,7 +644,7 @@ static inline int fls(int x) | |||
644 | { | 644 | { |
645 | int r; | 645 | int r; |
646 | 646 | ||
647 | if (__builtin_constant_p(cpu_has_mips_r) && cpu_has_mips_r) { | 647 | if (__builtin_constant_p(cpu_has_clo_clz) && cpu_has_clo_clz) { |
648 | __asm__("clz %0, %1" : "=r" (x) : "r" (x)); | 648 | __asm__("clz %0, %1" : "=r" (x) : "r" (x)); |
649 | 649 | ||
650 | return 32 - x; | 650 | return 32 - x; |
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index a0d14f85b781..c0047f861337 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h | |||
@@ -147,6 +147,15 @@ | |||
147 | #define cpu_has_mips_r (cpu_has_mips32r1 | cpu_has_mips32r2 | \ | 147 | #define cpu_has_mips_r (cpu_has_mips32r1 | cpu_has_mips32r2 | \ |
148 | cpu_has_mips64r1 | cpu_has_mips64r2) | 148 | cpu_has_mips64r1 | cpu_has_mips64r2) |
149 | 149 | ||
150 | /* | ||
151 | * MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other | ||
152 | * pre-MIPS32/MIPS53 processors have CLO, CLZ. For 64-bit kernels | ||
153 | * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ. | ||
154 | */ | ||
155 | # ifndef cpu_has_clo_clz | ||
156 | # define cpu_has_clo_clz cpu_has_mips_r | ||
157 | # endif | ||
158 | |||
150 | #ifndef cpu_has_dsp | 159 | #ifndef cpu_has_dsp |
151 | #define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP) | 160 | #define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP) |
152 | #endif | 161 | #endif |