xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S (revision a8c74629f602faa0ccf8a463757d7baf858bbf3a)
1/* This file is part of GDB, the GNU debugger.
2
3   Copyright 2017-2019 Free Software Foundation, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18	.align 2
19	.globl test_atomic_sequences
20#if _CALL_ELF == 2
21	.type test_atomic_sequences,@function
22test_atomic_sequences:
23#else
24	.section ".opd","aw"
25	.align 3
26test_atomic_sequences:
27	.quad .test_atomic_sequences,.TOC.@tocbase,0
28	.size test_atomic_sequences,.-test_atomic_sequences
29	.previous
30	.globl .test_atomic_sequences
31	.type .test_atomic_sequences,@function
32.test_atomic_sequences:
33#endif
34
35	li	0,0
36	addi	4,1,-8
37
38	stb	0,0(4)
391:	lbarx	5,0,4
40	cmpdi	5,0
41	bne	2f
42	addi	5,5,1
43	stbcx.	5,0,4
44	bne	1b
45
46	sth	0,0(4)
472:	lharx	5,0,4
48	cmpdi	5,0
49	bne	3f
50	addi	5,5,1
51	sthcx.	5,0,4
52	bne	2b
53
54#ifdef	__BIG_ENDIAN__
55	li 10,0
56	li 6,0
57	li 7,1
58	std 10,-16(1)
59	li 10,1
60	std 10,-8(1)
61	addi 4,1,-16
62#else
63	std 9,40(1)
64	li 9,1
65	addi 4,1,32
66	std 9,32(1)
67	mr 8,9
68	ld 3,8(4)
69#endif
703:	lqarx 10,0,4
71#ifdef	__BIG_ENDIAN__
72	li 8,0
73	li 9,2
74	mr 5,10
75	xor 10,11,7
76	xor 5,5,6
77	or. 4,5,10
78	bne 4f
79	addi 10,1,-16
80	stqcx. 8,0,10
81#else
82	xor 9,11,8
83	mr 6,11
84	xor 11,10,3
85	or. 0,9,11
86	bne 4f
87	li 14,0
88	li 15,2
89	stqcx. 14,0,4
90#endif
91	bne 3b
92
934:	li	3,0
94	blr
95
96#if _CALL_ELF == 2
97	.size test_atomic_sequences,.-test_atomic_sequences
98#else
99	.size .test_atomic_sequences,.-.test_atomic_sequences
100#endif
101