...
Run Format

Text file src/runtime/internal/atomic/asm_arm64.s

Documentation: runtime/internal/atomic

     1	// Copyright 2015 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	#include "textflag.h"
     6	
     7	// bool Cas(uint32 *ptr, uint32 old, uint32 new)
     8	// Atomically:
     9	//	if(*val == old){
    10	//		*val = new;
    11	//		return 1;
    12	//	} else
    13	//		return 0;
    14	TEXT runtime∕internal∕atomic·Cas(SB), NOSPLIT, $0-17
    15		MOVD	ptr+0(FP), R0
    16		MOVW	old+8(FP), R1
    17		MOVW	new+12(FP), R2
    18	again:
    19		LDAXRW	(R0), R3
    20		CMPW	R1, R3
    21		BNE	ok
    22		STLXRW	R2, (R0), R3
    23		CBNZ	R3, again
    24	ok:
    25		CSET	EQ, R0
    26		MOVB	R0, ret+16(FP)
    27		RET
    28	
    29	TEXT runtime∕internal∕atomic·Casuintptr(SB), NOSPLIT, $0-25
    30		B	runtime∕internal∕atomic·Cas64(SB)
    31	
    32	TEXT runtime∕internal∕atomic·Loaduintptr(SB), NOSPLIT, $-8-16
    33		B	runtime∕internal∕atomic·Load64(SB)
    34	
    35	TEXT runtime∕internal∕atomic·Loaduint(SB), NOSPLIT, $-8-16
    36		B	runtime∕internal∕atomic·Load64(SB)
    37	
    38	TEXT runtime∕internal∕atomic·Storeuintptr(SB), NOSPLIT, $0-16
    39		B	runtime∕internal∕atomic·Store64(SB)
    40	
    41	TEXT runtime∕internal∕atomic·Xadduintptr(SB), NOSPLIT, $0-24
    42		B	runtime∕internal∕atomic·Xadd64(SB)
    43	
    44	TEXT runtime∕internal∕atomic·Loadint64(SB), NOSPLIT, $0-16
    45		B	runtime∕internal∕atomic·Load64(SB)
    46	
    47	TEXT runtime∕internal∕atomic·Xaddint64(SB), NOSPLIT, $0-24
    48		B	runtime∕internal∕atomic·Xadd64(SB)
    49	
    50	// bool Casp1(void **val, void *old, void *new)
    51	// Atomically:
    52	//	if(*val == old){
    53	//		*val = new;
    54	//		return 1;
    55	//	} else
    56	//		return 0;
    57	TEXT runtime∕internal∕atomic·Casp1(SB), NOSPLIT, $0-25
    58		B runtime∕internal∕atomic·Cas64(SB)

View as plain text