Home | History | Annotate | Download | only in atomic
      1 // Copyright 2014 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 // +build ppc64 ppc64le
      6 
      7 #include "textflag.h"
      8 
      9 TEXT SwapInt32(SB),NOSPLIT,$0-20
     10 	BR	SwapUint32(SB)
     11 
     12 TEXT SwapUint32(SB),NOSPLIT,$0-20
     13 	MOVD	addr+0(FP), R3
     14 	MOVW	new+8(FP), R4
     15 	SYNC
     16 	LWAR	(R3), R5
     17 	STWCCC	R4, (R3)
     18 	BNE	-2(PC)
     19 	ISYNC
     20 	MOVW	R5, old+16(FP)
     21 	RET
     22 
     23 TEXT SwapInt64(SB),NOSPLIT,$0-24
     24 	BR	SwapUint64(SB)
     25 
     26 TEXT SwapUint64(SB),NOSPLIT,$0-24
     27 	MOVD	addr+0(FP), R3
     28 	MOVD	new+8(FP), R4
     29 	SYNC
     30 	LDAR	(R3), R5
     31 	STDCCC	R4, (R3)
     32 	BNE	-2(PC)
     33 	ISYNC
     34 	MOVD	R5, old+16(FP)
     35 	RET
     36 
     37 TEXT SwapUintptr(SB),NOSPLIT,$0-24
     38 	BR	SwapUint64(SB)
     39 
     40 TEXT CompareAndSwapInt32(SB),NOSPLIT,$0-17
     41 	BR	CompareAndSwapUint32(SB)
     42 
     43 TEXT CompareAndSwapUint32(SB),NOSPLIT,$0-17
     44 	MOVD	addr+0(FP), R3
     45 	MOVW	old+8(FP), R4
     46 	MOVW	new+12(FP), R5
     47 	SYNC
     48 	LWAR	(R3), R6
     49 	CMPW	R6, R4
     50 	BNE	7(PC)
     51 	STWCCC	R5, (R3)
     52 	BNE	-4(PC)
     53 	ISYNC
     54 	MOVD	$1, R3
     55 	MOVB	R3, swapped+16(FP)
     56 	RET
     57 	MOVB	R0, swapped+16(FP)
     58 	RET
     59 
     60 TEXT CompareAndSwapUintptr(SB),NOSPLIT,$0-25
     61 	BR	CompareAndSwapUint64(SB)
     62 
     63 TEXT CompareAndSwapInt64(SB),NOSPLIT,$0-25
     64 	BR	CompareAndSwapUint64(SB)
     65 
     66 TEXT CompareAndSwapUint64(SB),NOSPLIT,$0-25
     67 	MOVD	addr+0(FP), R3
     68 	MOVD	old+8(FP), R4
     69 	MOVD	new+16(FP), R5
     70 	SYNC
     71 	LDAR	(R3), R6
     72 	CMP	R6, R4
     73 	BNE	7(PC)
     74 	STDCCC	R5, (R3)
     75 	BNE	-4(PC)
     76 	ISYNC
     77 	MOVD	$1, R3
     78 	MOVB	R3, swapped+24(FP)
     79 	RET
     80 	MOVB	R0, swapped+24(FP)
     81 	RET
     82 
     83 TEXT AddInt32(SB),NOSPLIT,$0-20
     84 	BR	AddUint32(SB)
     85 
     86 TEXT AddUint32(SB),NOSPLIT,$0-20
     87 	MOVD	addr+0(FP), R3
     88 	MOVW	delta+8(FP), R4
     89 	SYNC
     90 	LWAR	(R3), R5
     91 	ADD	R4, R5
     92 	STWCCC	R5, (R3)
     93 	BNE	-3(PC)
     94 	ISYNC
     95 	MOVW	R5, new+16(FP)
     96 	RET
     97 
     98 TEXT AddUintptr(SB),NOSPLIT,$0-24
     99 	BR	AddUint64(SB)
    100 
    101 TEXT AddInt64(SB),NOSPLIT,$0-24
    102 	BR	AddUint64(SB)
    103 
    104 TEXT AddUint64(SB),NOSPLIT,$0-24
    105 	MOVD	addr+0(FP), R3
    106 	MOVD	delta+8(FP), R4
    107 	SYNC
    108 	LDAR	(R3), R5
    109 	ADD	R4, R5
    110 	STDCCC	R5, (R3)
    111 	BNE	-3(PC)
    112 	ISYNC
    113 	MOVD	R5, new+16(FP)
    114 	RET
    115 
    116 TEXT LoadInt32(SB),NOSPLIT,$0-12
    117 	BR	LoadUint32(SB)
    118 
    119 TEXT LoadUint32(SB),NOSPLIT,$0-12
    120 	MOVD	addr+0(FP), R3
    121 	SYNC
    122 	MOVW	0(R3), R3
    123 	CMPW	R3, R3, CR7
    124 	BC	4, 30, 1(PC)	// bne- cr7,0x4
    125 	ISYNC
    126 	MOVW	R3, val+8(FP)
    127 	RET
    128 
    129 TEXT LoadInt64(SB),NOSPLIT,$0-16
    130 	BR	LoadUint64(SB)
    131 
    132 TEXT LoadUint64(SB),NOSPLIT,$0-16
    133 	MOVD	addr+0(FP), R3
    134 	SYNC
    135 	MOVD	0(R3), R3
    136 	CMP	R3, R3, CR7
    137 	BC	4, 30, 1(PC)	// bne- cr7,0x4
    138 	ISYNC
    139 	MOVD	R3, val+8(FP)
    140 	RET
    141 
    142 TEXT LoadUintptr(SB),NOSPLIT,$0-16
    143 	BR	LoadPointer(SB)
    144 
    145 TEXT LoadPointer(SB),NOSPLIT,$0-16
    146 	BR	LoadUint64(SB)
    147 
    148 TEXT StoreInt32(SB),NOSPLIT,$0-12
    149 	BR	StoreUint32(SB)
    150 
    151 TEXT StoreUint32(SB),NOSPLIT,$0-12
    152 	MOVD	addr+0(FP), R3
    153 	MOVW	val+8(FP), R4
    154 	SYNC
    155 	MOVW	R4, 0(R3)
    156 	RET
    157 
    158 TEXT StoreInt64(SB),NOSPLIT,$0-16
    159 	BR	StoreUint64(SB)
    160 
    161 TEXT StoreUint64(SB),NOSPLIT,$0-16
    162 	MOVD	addr+0(FP), R3
    163 	MOVD	val+8(FP), R4
    164 	SYNC
    165 	MOVD	R4, 0(R3)
    166 	RET
    167 
    168 TEXT StoreUintptr(SB),NOSPLIT,$0-16
    169 	BR	StoreUint64(SB)
    170