Date: Mon, 28 Oct 2002 11:02:50 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 20295 for review Message-ID: <200210281902.g9SJ2oYX020525@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=20295 Change 20295 by jhb@jhb_laptop on 2002/10/28 11:02:05 Bring in Andrew's optimizations for atomic ops on alphas. Remove extraneous memory barriers. Drew's patch covered atomic.h but I've also done similar changes for the 8 and 16 bit versions in atomic.s. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/atomic.s#2 edit .. //depot/projects/smpng/sys/alpha/include/atomic.h#6 edit Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/atomic.s#2 (text+ko) ==== @@ -40,7 +40,6 @@ or t2, t0, t0 stq_c t0, 0(t1) beq t0, 1f - mb RET 1: br 0b END(atomic_set_8) @@ -55,7 +54,6 @@ or t2, t0, t0 stq_c t0, 0(t1) beq t0, 1f - mb RET 1: br 0b END(atomic_clear_8) @@ -70,7 +68,6 @@ or t2, t0, t0 stq_c t0, 0(t1) beq t0, 1f - mb RET 1: br 0b END(atomic_add_8) @@ -85,7 +82,6 @@ or t2, t0, t0 stq_c t0, 0(t1) beq t0, 1f - mb RET 1: br 0b END(atomic_subtract_8) @@ -100,7 +96,6 @@ or t2, t0, t0 stq_c t0, 0(t1) beq t0, 1f - mb RET 1: br 0b END(atomic_set_16) @@ -115,7 +110,6 @@ or t2, t0, t0 stq_c t0, 0(t1) beq t0, 1f - mb RET 1: br 0b END(atomic_clear_16) @@ -130,7 +124,6 @@ or t2, t0, t0 stq_c t0, 0(t1) beq t0, 1f - mb RET 1: br 0b END(atomic_add_16) @@ -145,7 +138,6 @@ or t2, t0, t0 stq_c t0, 0(t1) beq t0, 1f - mb RET 1: br 0b END(atomic_subtract_16) ==== //depot/projects/smpng/sys/alpha/include/atomic.h#6 (text+ko) ==== @@ -56,7 +56,6 @@ "bis %0, %3, %0\n\t" /* calculate new value */ "stl_c %0, %1\n\t" /* attempt to store */ "beq %0, 2f\n\t" /* spin if failed */ - "mb\n\t" /* drain to memory */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "2:\tbr 1b\n" /* try again */ ".previous\n" @@ -76,7 +75,6 @@ "bic %0, %2, %0\n\t" /* calculate new value */ "stl_c %0, %1\n\t" /* attempt to store */ "beq %0, 2f\n\t" /* spin if failed */ - "mb\n\t" /* drain to memory */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "2:\tbr 1b\n" /* try again */ ".previous\n" @@ -96,7 +94,6 @@ "addl %0, %2, %0\n\t" /* calculate new value */ "stl_c %0, %1\n\t" /* attempt to store */ "beq %0, 2f\n\t" /* spin if failed */ - "mb\n\t" /* drain to memory */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "2:\tbr 1b\n" /* try again */ ".previous\n" @@ -116,7 +113,6 @@ "subl %0, %2, %0\n\t" /* calculate new value */ "stl_c %0, %1\n\t" /* attempt to store */ "beq %0, 2f\n\t" /* spin if failed */ - "mb\n\t" /* drain to memory */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "2:\tbr 1b\n" /* try again */ ".previous\n" @@ -139,7 +135,7 @@ "beq %1,2f\n\t" /* if the store failed, spin */ "br 3f\n" /* it worked, exit */ "2:\tbr 1b\n" /* *addr not updated, loop */ - "3:\tmb\n" /* it worked */ + "3:\n" /* it worked */ : "=&r"(result), "=&r"(temp), "+m" (*addr) : : "memory"); @@ -158,7 +154,6 @@ "bis %0, %2, %0\n\t" /* calculate new value */ "stq_c %0, %1\n\t" /* attempt to store */ "beq %0, 2f\n\t" /* spin if failed */ - "mb\n\t" /* drain to memory */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "2:\tbr 1b\n" /* try again */ ".previous\n" @@ -178,7 +173,6 @@ "bic %0, %2, %0\n\t" /* calculate new value */ "stq_c %0, %1\n\t" /* attempt to store */ "beq %0, 2f\n\t" /* spin if failed */ - "mb\n\t" /* drain to memory */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "2:\tbr 1b\n" /* try again */ ".previous\n" @@ -198,7 +192,6 @@ "addq %0, %2, %0\n\t" /* calculate new value */ "stq_c %0, %1\n\t" /* attempt to store */ "beq %0, 2f\n\t" /* spin if failed */ - "mb\n\t" /* drain to memory */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "2:\tbr 1b\n" /* try again */ ".previous\n" @@ -218,7 +211,6 @@ "subq %0, %2, %0\n\t" /* calculate new value */ "stq_c %0, %1\n\t" /* attempt to store */ "beq %0, 2f\n\t" /* spin if failed */ - "mb\n\t" /* drain to memory */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "2:\tbr 1b\n" /* try again */ ".previous\n" @@ -241,7 +233,7 @@ "beq %1,2f\n\t" /* if the store failed, spin */ "br 3f\n" /* it worked, exit */ "2:\tbr 1b\n" /* *addr not updated, loop */ - "3:\tmb\n" /* it worked */ + "3:\n" /* it worked */ : "=&r"(result), "=&r"(temp), "+m" (*addr) : : "memory"); @@ -277,7 +269,7 @@ atomic_##NAME##_acq_##WIDTH(volatile u_int##WIDTH##_t *p, u_int##WIDTH##_t v)\ { \ atomic_##NAME##_##WIDTH(p, v); \ - /* alpha_mb(); */ \ + alpha_mb(); \ } \ \ static __inline void \ @@ -291,7 +283,7 @@ atomic_##NAME##_acq_##TYPE(volatile u_int##WIDTH##_t *p, u_int##WIDTH##_t v)\ { \ atomic_##NAME##_##WIDTH(p, v); \ - /* alpha_mb(); */ \ + alpha_mb(); \ } \ \ static __inline void \ @@ -382,7 +374,6 @@ "mov %3, %0\n\t" /* value to store */ "stl_c %0, %1\n\t" /* attempt to store */ "beq %0, 3f\n\t" /* if it failed, spin */ - "mb\n\t" /* drain to memory */ "2:\n" /* done */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "3:\tbr 1b\n" /* try again */ @@ -413,7 +404,6 @@ "mov %3, %0\n\t" /* value to store */ "stq_c %0, %1\n\t" /* attempt to store */ "beq %0, 3f\n\t" /* if it failed, spin */ - "mb\n\t" /* drain to memory */ "2:\n" /* done */ ".section .text3,\"ax\"\n" /* improve branch prediction */ "3:\tbr 1b\n" /* try again */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210281902.g9SJ2oYX020525>