M68k new gcc optimizations
PATCH 1/1 M68k new gcc optimizations
M68k compiler updates from Roman Zippel:
- Fix various lvalue warnings from newer gcc
- Remove unnecessary volatile declarations
- Change some constraints from "a" to "m" to generate slightly better code
- Use "o" constraint for bitfield instructions
- Use generic bitmap functions for some of the ext2/minix bitmap functions
Signed-off-by Geert Uytterhoeven <[email protected]>
include/asm-m68k/atomic.h +16 -12
@@ -18,36 +18,40 @@static __inline__void atomic_add (int i,atomic_t *v) { - __asm__ __volatile__("addl %1,%0" :"=m" (*v) :"id" (i),"0" (*v)); + __asm__ __volatile__("addl %1,%0" :"+m" (*v) :"id" (i)); }static __inline__void atomic_sub (int i,atomic_t *v) { - __asm__ __volatile__("subl %1,%0" :"=m" (*v) :"id" (i),"0" (*v)); + __asm__ __volatile__("subl %1,%0" :"+m" (*v) :"id" (i)); } -static __inline__void atomic_inc (volatile atomic_t *v) +static __inline__void atomic_inc (atomic_t *v) { - __asm__ __volatile__("addql #1,%0" :"=m" (*v):"0" (*v)); + __asm__ __volatile__("addql #1,%0" :"+m" (*v)); } -static __inline__void atomic_dec (volatile atomic_t *v) +static __inline__void atomic_dec (atomic_t *v) { - __asm__ __volatile__("subql #1,%0" :"=m" (*v):"0" (*v)); + __asm__ __volatile__("subql #1,%0" :"+m" (*v)); } -static __inline__int atomic_dec_and_test (volatile atomic_t *v) +static __inline__int atomic_dec_and_test (atomic_t *v) {char c; - __asm__ __volatile__("subql #1,%1; seq %0" :"=d" (c),"=m" (*v):"1" (*v)); + __asm__ __volatile__("subql #1,%1; seq %0" :"=d" (c),"+m" (*v));return c !=0 ; } -#define atomic_clear_mask (mask, v) \ - __asm__ __volatile__("andl %1,%0" : "=m" (*v) : "id" (~(mask)),"0"(*v)) +static __inline__void atomic_clear_mask (unsigned long mask,unsigned long *v) +{ + __asm__ __volatile__("andl %1,%0" :"+m" (*v) :"id" (~(mask))); +} -#define atomic_set_mask (mask, v) \ - __asm__ __volatile__("orl %1,%0" : "=m" (*v) : "id" (mask),"0"(*v)) +static __inline__void atomic_set_mask (unsigned long mask,unsigned long *v) +{ + __asm__ __volatile__("orl %1,%0" :"+m" (*v) :"id" (mask)); +}/* Atomic operations are already serializing */ #define smp_mb__before_atomic_dec () barrier()
include/asm-m68k/bitops.h +54 -103
258 lines not on this page · raw message
include/asm-m68k/page.h +8 -10
@@ -52,15 +52,13 @@static inline void clear_page (void *page) { -unsigned long data, tmp; -void *sp = page; +unsigned long tmp; +unsigned long *sp = page; - data =0 ; - - *((unsigned long *)(page))++ =0 ; - *((unsigned long *)(page))++ =0 ; - *((unsigned long *)(page))++ =0 ; - *((unsigned long *)(page))++ =0 ; + *sp++ =0 ; + *sp++ =0 ; + *sp++ =0 ; + *sp++ =0 ; __asm__ __volatile__("1:\t" ".chip 68040\n\t"
@@ -69,8 +67,8 @@ "subqw #8,%2\n\t" "subqw #8,%2\n\t" "dbra %1,1b\n\t" - : "=a" (page), "=d" (tmp) - : "a" (sp), "0" (page), + : "=a" (sp), "=d" (tmp) + : "a" (page), "0" (sp), "1" ((PAGE_SIZE - 16) / 16 - 1)); }
include/asm-m68k/string.h +8 -9
@@ -290,9 +290,7 @@static inline void *__memset_page (void * s,int c,size_t count) {unsigned long data, tmp; -void *xs, *sp; - - xs = sp = s; +void *xs = s; c = c &255 ; data = c | (c <<8 );
@@ -303,10 +301,11 @@if (((unsigned long ) s) &0x0f )__memset_g (s, c, count);else { - *((unsigned long *)(s))++ = data; - *((unsigned long *)(s))++ = data; - *((unsigned long *)(s))++ = data; - *((unsigned long *)(s))++ = data; +unsigned long *sp = s; + *sp++ = data; + *sp++ = data; + *sp++ = data; + *sp++ = data; __asm__ __volatile__("1:\t" ".chip 68040\n\t"
@@ -315,8 +314,8 @@ "subqw #8,%2\n\t" "subqw #8,%2\n\t" "dbra %1,1b\n\t" - : "=a" (s), "=d" (tmp) - : "a" (sp), "0" (s), "1" ((count - 16) / 16 - 1) + : "=a" (sp), "=d" (tmp) + : "a" (s), "0" (sp), "1" ((count - 16) / 16 - 1) ); }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds