File: atomic.s

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (185 lines) | stat: -rw-r--r-- 5,720 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
## Test valid atomic memory access instructions.

# RUN: llvm-mc %s --triple=loongarch32 --show-encoding \
# RUN:     | FileCheck --check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
# RUN: llvm-mc %s --triple=loongarch64 --show-encoding --defsym=LA64=1 \
# RUN:     | FileCheck --check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ,CHECK64-ASM,CHECK64-ASM-AND-OBJ %s
# RUN: llvm-mc %s --triple=loongarch32 --filetype=obj | llvm-objdump -d - \
# RUN:     | FileCheck --check-prefixes=CHECK-ASM-AND-OBJ %s
# RUN: llvm-mc %s --triple=loongarch64 --filetype=obj --defsym=LA64=1 | llvm-objdump -d - \
# RUN:     | FileCheck --check-prefixes=CHECK-ASM-AND-OBJ,CHECK64-ASM-AND-OBJ %s

#############################################################
## Instructions for both loongarch32 and loongarch64
#############################################################

# CHECK-ASM-AND-OBJ: ll.w $tp, $s4, 220
# CHECK-ASM: encoding: [0x62,0xdf,0x00,0x20]
ll.w $tp, $s4, 220

# CHECK-ASM-AND-OBJ: sc.w $t7, $t2, 56
# CHECK-ASM: encoding: [0xd3,0x39,0x00,0x21]
sc.w $t7, $t2, 56



#############################################################
## Instructions only for loongarch64
#############################################################

.ifdef LA64

# CHECK64-ASM-AND-OBJ: amswap.w $a2, $t0, $s1
# CHECK64-ASM: encoding: [0x06,0x33,0x60,0x38]
amswap.w $a2, $t0, $s1

# CHECK64-ASM-AND-OBJ: amswap.d $tp, $t2, $fp
# CHECK64-ASM: encoding: [0xc2,0xba,0x60,0x38]
amswap.d $tp, $t2, $fp

# CHECK64-ASM-AND-OBJ: amadd.w $a4, $t0, $r21
# CHECK64-ASM: encoding: [0xa8,0x32,0x61,0x38]
amadd.w $a4, $t0, $r21

# CHECK64-ASM-AND-OBJ: amadd.d $a1, $t5, $s6
# CHECK64-ASM: encoding: [0xa5,0xc7,0x61,0x38]
amadd.d $a1, $t5, $s6

# CHECK64-ASM-AND-OBJ: amand.w $a0, $t7, $fp
# CHECK64-ASM: encoding: [0xc4,0x4e,0x62,0x38]
amand.w $a0, $t7, $fp

# CHECK64-ASM-AND-OBJ: amand.d $a6, $t6, $s6
# CHECK64-ASM: encoding: [0xaa,0xcb,0x62,0x38]
amand.d $a6, $t6, $s6

# CHECK64-ASM-AND-OBJ: amor.w $a2, $t4, $s0
# CHECK64-ASM: encoding: [0xe6,0x42,0x63,0x38]
amor.w $a2, $t4, $s0

# CHECK64-ASM-AND-OBJ: amor.d $sp, $t4, $s1
# CHECK64-ASM: encoding: [0x03,0xc3,0x63,0x38]
amor.d $sp, $t4, $s1

# CHECK64-ASM-AND-OBJ: amxor.w $tp, $t3, $s0
# CHECK64-ASM: encoding: [0xe2,0x3e,0x64,0x38]
amxor.w $tp, $t3, $s0

# CHECK64-ASM-AND-OBJ: amxor.d $a4, $t8, $s5
# CHECK64-ASM: encoding: [0x88,0xd3,0x64,0x38]
amxor.d $a4, $t8, $s5

# CHECK64-ASM-AND-OBJ: ammax.w $ra, $a7, $s0
# CHECK64-ASM: encoding: [0xe1,0x2e,0x65,0x38]
ammax.w $ra, $a7, $s0

# CHECK64-ASM-AND-OBJ: ammax.d $a5, $t8, $s4
# CHECK64-ASM: encoding: [0x69,0xd3,0x65,0x38]
ammax.d $a5, $t8, $s4

# CHECK64-ASM-AND-OBJ: ammin.w $a5, $t2, $s0
# CHECK64-ASM: encoding: [0xe9,0x3a,0x66,0x38]
ammin.w $a5, $t2, $s0

# CHECK64-ASM-AND-OBJ: ammin.d $a5, $t1, $fp
# CHECK64-ASM: encoding: [0xc9,0xb6,0x66,0x38]
ammin.d $a5, $t1, $fp

# CHECK64-ASM-AND-OBJ: ammax.wu $a5, $a7, $fp
# CHECK64-ASM: encoding: [0xc9,0x2e,0x67,0x38]
ammax.wu $a5, $a7, $fp

# CHECK64-ASM-AND-OBJ: ammax.du $a2, $t4, $s2
# CHECK64-ASM: encoding: [0x26,0xc3,0x67,0x38]
ammax.du $a2, $t4, $s2

# CHECK64-ASM-AND-OBJ: ammin.wu $a4, $t6, $s7
# CHECK64-ASM: encoding: [0xc8,0x4b,0x68,0x38]
ammin.wu $a4, $t6, $s7

# CHECK64-ASM-AND-OBJ: ammin.du $a3, $t4, $s2
# CHECK64-ASM: encoding: [0x27,0xc3,0x68,0x38]
ammin.du $a3, $t4, $s2

# CHECK64-ASM-AND-OBJ: amswap_db.w $a2, $t0, $s1
# CHECK64-ASM: encoding: [0x06,0x33,0x69,0x38]
amswap_db.w $a2, $t0, $s1

# CHECK64-ASM-AND-OBJ: amswap_db.d $tp, $t2, $fp
# CHECK64-ASM: encoding: [0xc2,0xba,0x69,0x38]
amswap_db.d $tp, $t2, $fp

# CHECK64-ASM-AND-OBJ: amadd_db.w $a4, $t0, $r21
# CHECK64-ASM: encoding: [0xa8,0x32,0x6a,0x38]
amadd_db.w $a4, $t0, $r21

# CHECK64-ASM-AND-OBJ: amadd_db.d $a1, $t5, $s6
# CHECK64-ASM: encoding: [0xa5,0xc7,0x6a,0x38]
amadd_db.d $a1, $t5, $s6

# CHECK64-ASM-AND-OBJ: amand_db.w $a0, $t7, $fp
# CHECK64-ASM: encoding: [0xc4,0x4e,0x6b,0x38]
amand_db.w $a0, $t7, $fp

# CHECK64-ASM-AND-OBJ: amand_db.d $a6, $t6, $s6
# CHECK64-ASM: encoding: [0xaa,0xcb,0x6b,0x38]
amand_db.d $a6, $t6, $s6

# CHECK64-ASM-AND-OBJ: amor_db.w $a2, $t4, $s0
# CHECK64-ASM: encoding: [0xe6,0x42,0x6c,0x38]
amor_db.w $a2, $t4, $s0

# CHECK64-ASM-AND-OBJ: amor_db.d $sp, $t4, $s1
# CHECK64-ASM: encoding: [0x03,0xc3,0x6c,0x38]
amor_db.d $sp, $t4, $s1

# CHECK64-ASM-AND-OBJ: amxor_db.w $tp, $t3, $s0
# CHECK64-ASM: encoding: [0xe2,0x3e,0x6d,0x38]
amxor_db.w $tp, $t3, $s0

# CHECK64-ASM-AND-OBJ: amxor_db.d $a4, $t8, $s5
# CHECK64-ASM: encoding: [0x88,0xd3,0x6d,0x38]
amxor_db.d $a4, $t8, $s5

# CHECK64-ASM-AND-OBJ: ammax_db.w $ra, $a7, $s0
# CHECK64-ASM: encoding: [0xe1,0x2e,0x6e,0x38]
ammax_db.w $ra, $a7, $s0

# CHECK64-ASM-AND-OBJ: ammax_db.d $a5, $t8, $s4
# CHECK64-ASM: encoding: [0x69,0xd3,0x6e,0x38]
ammax_db.d $a5, $t8, $s4

# CHECK64-ASM-AND-OBJ: ammin_db.w $a5, $t2, $s0
# CHECK64-ASM: encoding: [0xe9,0x3a,0x6f,0x38]
ammin_db.w $a5, $t2, $s0

# CHECK64-ASM-AND-OBJ: ammin_db.d $a5, $t1, $fp
# CHECK64-ASM: encoding: [0xc9,0xb6,0x6f,0x38]
ammin_db.d $a5, $t1, $fp

# CHECK64-ASM-AND-OBJ: ammax_db.wu $a5, $a7, $fp
# CHECK64-ASM: encoding: [0xc9,0x2e,0x70,0x38]
ammax_db.wu $a5, $a7, $fp

# CHECK64-ASM-AND-OBJ: ammax_db.du $a2, $t4, $s2
# CHECK64-ASM: encoding: [0x26,0xc3,0x70,0x38]
ammax_db.du $a2, $t4, $s2

# CHECK64-ASM-AND-OBJ: ammin_db.wu $a4, $t6, $s7
# CHECK64-ASM: encoding: [0xc8,0x4b,0x71,0x38]
ammin_db.wu $a4, $t6, $s7

# CHECK64-ASM-AND-OBJ: ammin_db.du $a3, $t4, $s2
# CHECK64-ASM: encoding: [0x27,0xc3,0x71,0x38]
ammin_db.du $a3, $t4, $s2

# CHECK64-ASM-AND-OBJ: ll.d $s2, $s4, 16
# CHECK64-ASM: encoding: [0x79,0x13,0x00,0x22]
ll.d $s2, $s4, 16

# CHECK64-ASM-AND-OBJ: sc.d $t5, $t5, 244
# CHECK64-ASM: encoding: [0x31,0xf6,0x00,0x23]
sc.d $t5, $t5, 244

.endif