alpha: build fixes - force architecture
authorIvan Kokshaysky <ink@jurassic.park.msu.ru>
Tue, 17 Apr 2007 05:53:21 +0000 (22:53 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 17 Apr 2007 23:36:27 +0000 (16:36 -0700)
Override compiler .arch directive for generic kernel build.

Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/alpha/kernel/sys_titan.c
include/asm-alpha/compiler.h

index 29ab7db81c30983cc113fcf5c51bea39375749f9..f009b7bc094310da51ff2f154df86911e01d24cc 100644 (file)
@@ -257,8 +257,7 @@ titan_dispatch_irqs(u64 mask)
         */
        while (mask) {
                /* convert to SRM vector... priority is <63> -> <0> */
-               __asm__("ctlz %1, %0" : "=r"(vector) : "r"(mask));
-               vector = 63 - vector;
+               vector = 63 - __kernel_ctlz(mask);
                mask &= ~(1UL << vector);       /* clear it out          */
                vector = 0x900 + (vector << 4); /* convert to SRM vector */
                
index d2768cc3d7a4ed578022b221bc877766d853f3ed..da6bb199839c1dc221dbcd30a1737e364ee722f9 100644 (file)
@@ -17,9 +17,6 @@
 # define __kernel_extbl(val, shift)    __builtin_alpha_extbl(val, shift)
 # define __kernel_extwl(val, shift)    __builtin_alpha_extwl(val, shift)
 # define __kernel_cmpbge(a, b)         __builtin_alpha_cmpbge(a, b)
-# define __kernel_cttz(x)              __builtin_ctzl(x)
-# define __kernel_ctlz(x)              __builtin_clzl(x)
-# define __kernel_ctpop(x)             __builtin_popcountl(x)
 #else
 # define __kernel_insbl(val, shift)                                    \
   ({ unsigned long __kir;                                              \
   ({ unsigned long __kir;                                              \
      __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a));     \
      __kir; })
+#endif
+
+#ifdef __alpha_cix__
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
+#  define __kernel_cttz(x)             __builtin_ctzl(x)
+#  define __kernel_ctlz(x)             __builtin_clzl(x)
+#  define __kernel_ctpop(x)            __builtin_popcountl(x)
+# else
+#  define __kernel_cttz(x)                                             \
+   ({ unsigned long __kir;                                             \
+      __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x));                    \
+      __kir; })
+#  define __kernel_ctlz(x)                                             \
+   ({ unsigned long __kir;                                             \
+      __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x));                    \
+      __kir; })
+#  define __kernel_ctpop(x)                                            \
+   ({ unsigned long __kir;                                             \
+      __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x));                   \
+      __kir; })
+# endif
+#else
 # define __kernel_cttz(x)                                              \
   ({ unsigned long __kir;                                              \
-     __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x));                     \
+     __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x));         \
      __kir; })
 # define __kernel_ctlz(x)                                              \
   ({ unsigned long __kir;                                              \
-     __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x));                     \
+     __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x));         \
      __kir; })
 # define __kernel_ctpop(x)                                             \
   ({ unsigned long __kir;                                              \
-     __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x));                    \
+     __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x));                \
      __kir; })
 #endif
 
 #else
 #define __kernel_ldbu(mem)                             \
   ({ unsigned char __kir;                              \
-     __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem));   \
+     __asm__(".arch ev56;                              \
+             ldbu %0,%1" : "=r"(__kir) : "m"(mem));    \
      __kir; })
 #define __kernel_ldwu(mem)                             \
   ({ unsigned short __kir;                             \
-     __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem));   \
+     __asm__(".arch ev56;                              \
+             ldwu %0,%1" : "=r"(__kir) : "m"(mem));    \
      __kir; })
-#define __kernel_stb(val,mem) \
-  __asm__("stb %1,%0" : "=m"(mem) : "r"(val))
-#define __kernel_stw(val,mem) \
-  __asm__("stw %1,%0" : "=m"(mem) : "r"(val))
+#define __kernel_stb(val,mem)                          \
+  __asm__(".arch ev56;                                 \
+          stb %1,%0" : "=m"(mem) : "r"(val))
+#define __kernel_stw(val,mem)                          \
+  __asm__(".arch ev56;                                 \
+          stw %1,%0" : "=m"(mem) : "r"(val))
 #endif
 
 #ifdef __KERNEL__