stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicole Willson <will...@roguewave.com>
Subject FW: [PATCH] STDCXX-11: IA64 32-bit atomic operations broken
Date Wed, 24 Aug 2005 14:55:25 GMT

Here is the patch for atomic-ia64-32.s:

Start of src/atomic-ia64-32.s
-------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
//
// atomic-ia64-32.s
//
// $Id: //stdlib/4.1.1-rel/source/stdlib/atomic-ia64-32.s#1 $
//
////////////////////////////////////////////////////////////////////////////

        .text
        //.pred.safe_across_calls p1-p5,p16-p63
	.psr abi32 
        .psr msb

////////////////////////////////////////////////////////////////////////////
// extern "C" char __rw_atomic_xchg8 (char *x, char y);
//
// Atomically assigns the 8-bit value y to *x and returns
// the original (before assignment) 8-bit value of *x.
////////////////////////////////////////////////////////////////////////////

        .global __rw_atomic_xchg8#
        .proc   __rw_atomic_xchg8#

__rw_atomic_xchg8:

        .prologue
        .body
        // .mfb
	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit
pointer
	;;
        xchg1 r8 = [r9], r33
        nop 0
        br.ret.sptk.many b0

        .endp __rw_atomic_xchg8#

////////////////////////////////////////////////////////////////////////////
// extern "C" char __rw_atomic_add8 (char *x, int y);
//
// Atomically increments the 8-bit value *x by y and returns
// the new (after increment) 8-bit value of *x.
////////////////////////////////////////////////////////////////////////////

        .global __rw_atomic_add8#
        .proc   __rw_atomic_add8#

__rw_atomic_add8:

        .prologue
        .body
         // .mmb
        mf
	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit
pointer
	;;
        ld1.acq r15 = [r9]
        nop 0
        ;;
.add8_busywait:
         // .mmi
        mov ar.ccv = r15
        add r8 = r15, r33
        mov r2 = r15
        ;;
         // .mmb
        nop 0
        cmpxchg1.acq r15 = [r9], r8, ar.ccv
        nop 0
        ;;
         // .mbb
        cmp.ne p8, p9 = r2, r15
        (p9) br.ret.dpnt.many rp
        br .add8_busywait

        .endp __rw_atomic_add8#

////////////////////////////////////////////////////////////////////////////
// extern "C" short __rw_atomic_xchg16 (short *x, short y);
//
// Atomically assigns the 16-bit value y to *x and returns
// the original (before assignment) 16-bit value of *x.
////////////////////////////////////////////////////////////////////////////

        .global __rw_atomic_xchg16#
        .proc   __rw_atomic_xchg16#

__rw_atomic_xchg16:

        .prologue
        .body
        // .mfb
	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit
pointer
	;;
        xchg2 r8 = [r9], r33
        nop 0
        br.ret.sptk.many b0

        .endp __rw_atomic_xchg16#

////////////////////////////////////////////////////////////////////////////
// extern "C" short __rw_atomic_add16 (short *x, short y);
//
// Atomically increments the 16-bit value *x by y and returns
// the new (after increment) 16-bit value of *x.
////////////////////////////////////////////////////////////////////////////

        .global __rw_atomic_add16#
        .proc   __rw_atomic_add16#

__rw_atomic_add16:

        .prologue
        .body
         // .mmb
        mf
	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit
pointer
	;;
        ld2.acq r15 = [r9]
        nop 0
        ;;
.add16_busywait:
         // .mmi
        mov ar.ccv = r15
        add r8 = r15, r33
        mov r2 = r15
        ;;
         // .mmb
        nop 0
        cmpxchg2.acq r15 = [r9], r8, ar.ccv
        nop 0
        ;;
         // .mbb
        cmp.ne p8, p9 = r2, r15
        (p9) br.ret.dpnt.many rp
        br .add16_busywait

        .endp __rw_atomic_add16#

////////////////////////////////////////////////////////////////////////////
// extern "C" int __rw_atomic_xchg32 (int *x, int y);
//
// Atomically assigns the 32-bit value y to *x and returns
// the original (before assignment) 32-bit value of *x.
////////////////////////////////////////////////////////////////////////////

        .global __rw_atomic_xchg32#
        .proc   __rw_atomic_xchg32#

__rw_atomic_xchg32:

        .prologue
        .body
        // .mfb

	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit
pointer
	;;
        xchg4 r8 = [r9], r33
        nop 0
        br.ret.sptk.many b0

        .endp __rw_atomic_xchg32#

////////////////////////////////////////////////////////////////////////////
// extern "C" int __rw_atomic_add32 (int *x, int y);
//
// Atomically increments the 32-bit value *x by y and returns
// the new (after increment) 32-bit value of *x.
////////////////////////////////////////////////////////////////////////////

        .global __rw_atomic_add32#
        .proc   __rw_atomic_add32#

__rw_atomic_add32:

        .prologue
        .body
         // .mmb
        mf
	addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit
pointer
	;;
        ld4.acq r15 = [r9]
        nop 0
        ;;
.add32_busywait:
         // .mmi
        mov ar.ccv = r15
        add r8 = r15, r33
        mov r2 = r15
        ;;
         // .mmb
        nop 0
        cmpxchg4.acq r15 = [r9], r8, ar.ccv
        nop 0
        ;;
         // .mbb
        cmp4.ne p8, p9 = r2, r15
        (p9) br.ret.dpnt.many rp
        br .add32_busywait

        .endp __rw_atomic_add32#
-------------------------------------------------------------------
End of src/atomic-ia64-32.s

Mime
View raw message