Commit ce0bd8e0 authored by Ralf Baechle's avatar Ralf Baechle Committed by Greg Kroah-Hartman

[PATCH] MIPS: R2 build fixes for gcc < 3.4.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 97644aa3
...@@ -654,7 +654,12 @@ static inline unsigned long fls(unsigned long word) ...@@ -654,7 +654,12 @@ static inline unsigned long fls(unsigned long word)
{ {
#ifdef CONFIG_32BIT #ifdef CONFIG_32BIT
#ifdef CONFIG_CPU_MIPS32 #ifdef CONFIG_CPU_MIPS32
__asm__ ("clz %0, %1" : "=r" (word) : "r" (word)); __asm__ (
" .set mips32 \n"
" clz %0, %1 \n"
" .set mips0 \n"
: "=r" (word)
: "r" (word));
return 32 - word; return 32 - word;
#else #else
...@@ -678,7 +683,12 @@ static inline unsigned long fls(unsigned long word) ...@@ -678,7 +683,12 @@ static inline unsigned long fls(unsigned long word)
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
#ifdef CONFIG_CPU_MIPS64 #ifdef CONFIG_CPU_MIPS64
__asm__ ("dclz %0, %1" : "=r" (word) : "r" (word)); __asm__ (
" .set mips64 \n"
" dclz %0, %1 \n"
" .set mips0 \n"
: "=r" (word)
: "r" (word));
return 64 - word; return 64 - word;
#else #else
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
{ {
__asm__( __asm__(
" .set mips32r2 \n"
" wsbh %0, %1 \n" " wsbh %0, %1 \n"
" .set mips0 \n"
: "=r" (x) : "=r" (x)
: "r" (x)); : "r" (x));
...@@ -30,8 +32,10 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) ...@@ -30,8 +32,10 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
{ {
__asm__( __asm__(
" .set mips32r2 \n"
" wsbh %0, %1 \n" " wsbh %0, %1 \n"
" rotr %0, %0, 16 \n" " rotr %0, %0, 16 \n"
" .set mips0 \n"
: "=r" (x) : "=r" (x)
: "r" (x)); : "r" (x));
......
...@@ -20,7 +20,9 @@ __asm__ ( ...@@ -20,7 +20,9 @@ __asm__ (
" .set reorder \n" " .set reorder \n"
" .set noat \n" " .set noat \n"
#ifdef CONFIG_CPU_MIPSR2 #ifdef CONFIG_CPU_MIPSR2
" .set mips32r2 \n"
" ei \n" " ei \n"
" .set mips0 \n"
#else #else
" mfc0 $1,$12 \n" " mfc0 $1,$12 \n"
" ori $1,0x1f \n" " ori $1,0x1f \n"
...@@ -63,7 +65,9 @@ __asm__ ( ...@@ -63,7 +65,9 @@ __asm__ (
" .set push \n" " .set push \n"
" .set noat \n" " .set noat \n"
#ifdef CONFIG_CPU_MIPSR2 #ifdef CONFIG_CPU_MIPSR2
" .set mips32r2 \n"
" di \n" " di \n"
" .set mips0 \n"
#else #else
" mfc0 $1,$12 \n" " mfc0 $1,$12 \n"
" ori $1,0x1f \n" " ori $1,0x1f \n"
...@@ -103,8 +107,10 @@ __asm__ ( ...@@ -103,8 +107,10 @@ __asm__ (
" .set reorder \n" " .set reorder \n"
" .set noat \n" " .set noat \n"
#ifdef CONFIG_CPU_MIPSR2 #ifdef CONFIG_CPU_MIPSR2
" .set mips32r2 \n"
" di \\result \n" " di \\result \n"
" andi \\result, 1 \n" " andi \\result, 1 \n"
" .set mips0 \n"
#else #else
" mfc0 \\result, $12 \n" " mfc0 \\result, $12 \n"
" ori $1, \\result, 0x1f \n" " ori $1, \\result, 0x1f \n"
...@@ -133,9 +139,11 @@ __asm__ ( ...@@ -133,9 +139,11 @@ __asm__ (
* Slow, but doesn't suffer from a relativly unlikely race * Slow, but doesn't suffer from a relativly unlikely race
* condition we're having since days 1. * condition we're having since days 1.
*/ */
" .set mips32r2 \n"
" beqz \\flags, 1f \n" " beqz \\flags, 1f \n"
" di \n" " di \n"
" ei \n" " ei \n"
" .set mips0 \n"
"1: \n" "1: \n"
#elif defined(CONFIG_CPU_MIPSR2) #elif defined(CONFIG_CPU_MIPSR2)
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment