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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
|
# Copyright 2014-2018 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file is part of the gdb testsuite.
# Test PowerPC instructions disassembly.
standard_testfile .s
set objfile [standard_output_file ${testfile}.o]
if {![istarget "powerpc*-*-*"]} then {
verbose "Skipping PowerPC instructions disassembly."
return
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
untested "PowerPC instructions disassembly"
return -1
}
clean_restart ${objfile}
# Disassemble the function.
set func ""
gdb_test "set disassembler-options power9"
set test "disass func"
gdb_test_multiple $test $test {
-re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" {
set func $expect_out(1,string)
pass $test
}
}
proc instr_to_patt {instr} {
global decimal hex
# 0x0000000000000018 <+24>: stxvd2x vs43,r4,r5
return "\[ \t\]*$hex <\\+$decimal>:\[ \t\]*[string_to_regexp $instr]"
}
proc func_check {instr} {
global func
set test "found: $instr"
if [regexp -nocase -line [instr_to_patt $instr] $func] {
pass $test
} else {
fail $test
}
}
func_check "cnttzd r3,r13"
func_check "cnttzd. r4,r14"
func_check "cnttzw r5,r15"
func_check "cnttzw. r6,r16"
func_check "modsd r10,r20,r21"
func_check "modsw r11,r21,r22"
func_check "modud r12,r22,r23"
func_check "moduw r13,r23,r24"
func_check "bcdcfn. v3,v4,0"
func_check "bcdcfn. v3,v4,1"
func_check "bcdcfsq. v4,v5,0"
func_check "bcdcfsq. v4,v5,1"
func_check "bcdcfz. v5,v6,0"
func_check "bcdcfz. v5,v6,1"
func_check "bcdcpsgn. v6,v7,v8"
func_check "bcdctn. v7,v8"
func_check "bcdctsq. v8,v9"
func_check "bcdctz. v9,v10,0"
func_check "bcdctz. v9,v10,1"
func_check "bcdsetsgn. v10,v11,0"
func_check "bcdsetsgn. v10,v11,1"
func_check "bcdsr. v11,v12,v13,0"
func_check "bcdsr. v11,v12,v13,1"
func_check "bcds. v12,v13,v14,0"
func_check "bcds. v12,v13,v14,1"
func_check "bcdtrunc. v13,v14,v15,0"
func_check "bcdtrunc. v13,v14,v15,1"
func_check "bcdus. v14,v15,v16"
func_check "bcdutrunc. v15,v16,v17"
func_check "lxvll vs20,0,r21"
func_check "lxvll vs20,r10,r21"
func_check "stxvll vs21,0,r11"
func_check "stxvll vs21,r10,r11"
func_check "vmul10cuq v22,v23"
func_check "vmul10ecuq v23,v24,v25"
func_check "vmul10euq v24,v25,v26"
func_check "vmul10uq v25,v26"
func_check "xsaddqp v10,v11,v12"
func_check "xsaddqpo v11,v12,v12"
func_check "xsrqpi 0,v20,v30,0"
func_check "xsrqpi 1,v20,v30,0"
func_check "xsrqpi 0,v20,v30,3"
func_check "xsrqpi 1,v20,v30,3"
func_check "xsrqpix 0,v21,v31,0"
func_check "xsrqpix 1,v21,v31,0"
func_check "xsrqpix 0,v21,v31,3"
func_check "xsrqpix 1,v21,v31,3"
func_check "xsmulqp v12,v13,v14"
func_check "xsmulqpo v13,v14,v15"
func_check "xsrqpxp 0,v22,v23,0"
func_check "xsrqpxp 1,v22,v23,0"
func_check "xsrqpxp 0,v22,v23,3"
func_check "xsrqpxp 1,v22,v23,3"
func_check "xscpsgnqp v14,v15,v16"
func_check "xscmpoqp cr0,v15,v16"
func_check "xscmpoqp cr7,v15,v16"
func_check "xscmpexpqp cr0,v16,v17"
func_check "xscmpexpqp cr7,v16,v17"
func_check "xsmaddqp v17,v18,v19"
func_check "xsmaddqpo v18,v19,v20"
func_check "xsmsubqp v19,v20,v21"
func_check "xsmsubqpo v20,v21,v22"
func_check "xsnmaddqp v21,v22,v23"
func_check "xsnmaddqpo v22,v23,v24"
func_check "xsnmsubqp v23,v24,v25"
func_check "xsnmsubqpo v24,v25,v26"
func_check "xssubqp v25,v26,v27"
func_check "xssubqpo v26,v27,v28"
func_check "xsdivqp v27,v28,v29"
func_check "xsdivqpo v28,v29,v30"
func_check "xscmpuqp cr0,v29,v30"
func_check "xscmpuqp cr7,v29,v30"
func_check "xststdcqp cr0,v30,0"
func_check "xststdcqp cr7,v30,0"
func_check "xststdcqp cr0,v31,127"
func_check "xststdcqp cr7,v31,127"
func_check "xsabsqp v10,v11"
func_check "xsxexpqp v11,v12"
func_check "xsnabsqp v12,v13"
func_check "xsnegqp v13,v14"
func_check "xsxsigqp v14,v15"
func_check "xssqrtqp v15,v16"
func_check "xssqrtqpo v16,v17"
func_check "xscvqpuwz v17,v18"
func_check "xscvudqp v18,v19"
func_check "xscvqpswz v19,v20"
func_check "xscvsdqp v20,v21"
func_check "xscvqpudz v21,v22"
func_check "xscvqpdp v22,v23"
func_check "xscvqpdpo v23,v24"
func_check "xscvdpqp v24,v25"
func_check "xscvqpsdz v25,v26"
func_check "xsiexpqp v26,v27,v28"
func_check "vpermr v4,v5,v6,v7"
func_check "vextractub v5,v6,0"
func_check "vextractub v5,v6,15"
func_check "vextractuh v6,v7,0"
func_check "vextractuh v6,v7,15"
func_check "vextractuw v7,v8,0"
func_check "vextractuw v7,v8,15"
func_check "vextractd v8,v9,0"
func_check "vextractd v8,v9,15"
func_check "vinsertb v9,v10,0"
func_check "vinsertb v9,v10,15"
func_check "vinserth v10,v11,0"
func_check "vinserth v10,v11,15"
func_check "vinsertw v11,v12,0"
func_check "vinsertw v11,v12,15"
func_check "vinsertd v12,v13,0"
func_check "vinsertd v12,v13,15"
func_check "mfvsrld r20,vs45"
func_check "mtvsrws vs46,r21"
func_check "mtvsrdd vs47,0,r23"
func_check "mtvsrdd vs47,r22,r23"
func_check "lxvx vs50,0,r11"
func_check "lxvx vs0,r10,r11"
func_check "lxvwsx vs51,0,r12"
func_check "lxvwsx vs1,r10,r12"
func_check "lxvh8x vs52,0,r13"
func_check "lxvh8x vs2,r10,r13"
func_check "lxvb16x vs53,0,r14"
func_check "lxvb16x vs3,r10,r14"
func_check "stxvx vs54,0,r15"
func_check "stxvx vs4,r20,r15"
func_check "stxvh8x vs55,0,r16"
func_check "stxvh8x vs5,r20,r16"
func_check "stxvb16x vs56,0,r17"
func_check "stxvb16x vs6,r20,r17"
func_check "xxextractuw vs4,vs5,0"
func_check "xxextractuw vs40,vs50,15"
func_check "xxspltib vs4,0"
func_check "xxspltib vs4,128"
func_check "xxspltib vs41,255"
func_check "xxspltib vs41,255"
func_check "xxinsertw vs5,vs6,0"
func_check "xxinsertw vs50,vs60,15"
func_check "xxbrh vs6,vs7"
func_check "xxbrh vs56,vs57"
func_check "xxbrw vs7,vs8"
func_check "xxbrw vs57,vs58"
func_check "xxbrd vs8,vs9"
func_check "xxbrd vs58,vs59"
func_check "xxbrq vs9,vs10"
func_check "xxbrq vs59,vs60"
func_check "lxsd v20,0(0)"
func_check "lxsd v20,0(r10)"
func_check "lxsd v20,8(0)"
func_check "lxsd v20,8(r10)"
func_check "lxsd v20,-8(0)"
func_check "lxsd v20,-8(r10)"
func_check "lxsd v20,32764(0)"
func_check "lxsd v20,32764(r10)"
func_check "lxsd v20,-32768(0)"
func_check "lxsd v20,-32768(r10)"
func_check "lxssp v30,0(0)"
func_check "lxssp v30,0(r11)"
func_check "lxssp v30,8(0)"
func_check "lxssp v30,8(r11)"
func_check "lxssp v30,-8(0)"
func_check "lxssp v30,-8(r11)"
func_check "lxssp v30,32764(0)"
func_check "lxssp v30,32764(r11)"
func_check "lxssp v30,-32768(0)"
func_check "lxssp v30,-32768(r11)"
func_check "lxv vs40,0(0)"
func_check "lxv vs40,0(r12)"
func_check "lxv vs40,16(0)"
func_check "lxv vs40,16(r12)"
func_check "lxv vs40,-16(0)"
func_check "lxv vs10,-16(r12)"
func_check "lxv vs10,32752(0)"
func_check "lxv vs10,32752(r12)"
func_check "lxv vs10,-32768(0)"
func_check "lxv vs10,-32768(r12)"
func_check "stxsd v21,0(0)"
func_check "stxsd v21,0(r10)"
func_check "stxsd v21,8(0)"
func_check "stxsd v21,8(r10)"
func_check "stxsd v21,-8(0)"
func_check "stxsd v21,-8(r10)"
func_check "stxsd v21,32764(0)"
func_check "stxsd v21,32764(r10)"
func_check "stxsd v21,-32768(0)"
func_check "stxsd v21,-32768(r10)"
func_check "stxssp v31,0(0)"
func_check "stxssp v31,0(r11)"
func_check "stxssp v31,8(0)"
func_check "stxssp v31,8(r11)"
func_check "stxssp v31,-8(0)"
func_check "stxssp v31,-8(r11)"
func_check "stxssp v31,32764(0)"
func_check "stxssp v31,32764(r11)"
func_check "stxssp v31,-32768(0)"
func_check "stxssp v31,-32768(r11)"
func_check "stxv vs41,0(0)"
func_check "stxv vs41,0(r12)"
func_check "stxv vs41,16(0)"
func_check "stxv vs41,16(r12)"
func_check "stxv vs41,-16(0)"
func_check "stxv vs11,-16(r12)"
func_check "stxv vs11,32752(0)"
func_check "stxv vs11,32752(r12)"
func_check "stxv vs11,-32768(0)"
func_check "stxv vs11,-32768(r12)"
func_check "xxperm vs20,vs22,vs24"
func_check "xxperm vs40,vs42,vs44"
func_check "xxpermr vs21,vs23,vs25"
func_check "xxpermr vs41,vs43,vs45"
func_check "extswsli r12,r20,0"
func_check "extswsli r12,r20,1"
func_check "extswsli r12,r20,63"
func_check "extswsli. r13,r21,0"
func_check "extswsli. r13,r21,1"
func_check "extswsli. r13,r21,63"
func_check "vrlwmi v14,v22,v23"
func_check "vrldmi v15,v23,v24"
func_check "vrlwnm v16,v24,v25"
func_check "vrldnm v17,v25,v26"
func_check "vbpermd v18,v26,v27"
func_check "vnegw v19,v20"
func_check "vnegd v20,v21"
func_check "vprtybw v21,v22"
func_check "vprtybd v22,v23"
func_check "vprtybq v23,v24"
func_check "vextsb2w v24,v25"
func_check "vextsh2w v25,v26"
func_check "vextsb2d v26,v27"
func_check "vextsh2d v27,v28"
func_check "vextsw2d v28,v29"
func_check "vctzb v29,v30"
func_check "vctzh v30,v31"
func_check "vctzw v31,v30"
func_check "vctzd v30,v29"
func_check "lxsibzx vs10,0,r20"
func_check "lxsibzx vs50,r10,r20"
func_check "lxsihzx vs11,0,r21"
func_check "lxsihzx vs51,r11,r21"
func_check "stxsibx vs12,0,r22"
func_check "stxsibx vs52,r12,r22"
func_check "stxsihx vs13,0,r23"
func_check "stxsihx vs53,r13,r23"
func_check "maddhd r10,r11,r12,r13"
func_check "maddhdu r20,r21,r22,r23"
func_check "maddld r2,r3,r4,r5"
func_check "xscmpexpdp cr0,vs10,vs20"
func_check "xscmpexpdp cr7,vs40,vs50"
func_check "xsiexpdp vs41,r11,r21"
func_check "xststdcdp cr0,vs11,127"
func_check "xststdcdp cr7,vs41,127"
func_check "xststdcsp cr0,vs11,127"
func_check "xststdcsp cr7,vs41,127"
func_check "xsxexpdp r13,vs43"
func_check "xsxsigdp r14,vs44"
func_check "xviexpdp vs45,vs46,vs47"
func_check "xviexpsp vs46,vs47,vs48"
func_check "xvtstdcdp vs54,vs55,0"
func_check "xvtstdcdp vs54,vs55,127"
func_check "xvtstdcsp vs55,vs56,0"
func_check "xvtstdcsp vs55,vs56,127"
func_check "xvxexpdp vs57,vs58"
func_check "xvxexpsp vs58,vs59"
func_check "xvxsigdp vs59,vs60"
func_check "xvxsigsp vs60,vs61"
func_check "cmpeqb cr0,r6,r7"
func_check "cmpeqb cr7,r6,r7"
func_check "cmprb cr0,0,r8,r9"
func_check "cmprb cr7,0,r8,r9"
func_check "cmprb cr0,1,r8,r9"
func_check "cmprb cr7,1,r8,r9"
func_check "setb r15,cr0"
func_check "setb r15,cr7"
func_check "lxvl vs26,0,r10"
func_check "lxvl vs56,r20,r10"
func_check "stxvl vs27,0,r11"
func_check "stxvl vs57,r21,r11"
func_check "vclzlsbb r20,v30"
func_check "vctzlsbb r21,v31"
func_check "vcmpneb v10,v11,v12"
func_check "vcmpneb. v20,v21,v22"
func_check "vcmpneh v11,v12,v13"
func_check "vcmpneh. v21,v22,v23"
func_check "vcmpnew v12,v13,v14"
func_check "vcmpnew. v22,v23,v24"
func_check "vcmpnezb v13,v14,v15"
func_check "vcmpnezb. v23,v24,v25"
func_check "vcmpnezh v14,v15,v16"
func_check "vcmpnezh. v24,v25,v26"
func_check "vcmpnezw v15,v16,v17"
func_check "vcmpnezw. v25,v26,v27"
func_check "vextublx r16,r17,v10"
func_check "vextubrx r17,r18,v11"
func_check "vextuhlx r18,r19,v12"
func_check "vextuhrx r19,r20,v13"
func_check "vextuwlx r20,r21,v14"
func_check "vextuwrx r21,r22,v15"
func_check "dtstsfi cr0,0,f3"
func_check "dtstsfi cr7,63,f3"
func_check "dtstsfiq cr0,0,f4"
func_check "dtstsfiq cr7,63,f4"
func_check "xscvhpdp vs40,vs50"
func_check "xscvdphp vs41,vs51"
func_check "xvcvhpsp vs42,vs52"
func_check "xvcvsphp vs43,vs53"
func_check "lnia r3"
func_check "lnia r3"
func_check "addpcis r4,1"
func_check "addpcis r4,1"
func_check "addpcis r5,-2"
func_check "addpcis r5,-2"
func_check "addpcis r6,32767"
func_check "addpcis r6,32767"
func_check "addpcis r7,-32768"
func_check "addpcis r7,-32768"
func_check "slbsync"
func_check "slbiag r10"
func_check "slbieg r10,r11"
func_check "slbmfee r3,r4"
func_check "slbmfee r3,r4"
func_check "slbmfee r3,r4,1"
func_check "slbmfev r4,r5"
func_check "slbmfev r4,r5"
func_check "slbmfev r4,r5,1"
func_check "tlbie r3,r4"
func_check "tlbie r3,r4"
func_check "tlbie r3,r4,3,1,1"
func_check "tlbiel r3"
func_check "tlbiel r3"
func_check "tlbiel r3,r4,3,1,1"
func_check "copy r12,r13"
func_check "paste. r10,r11"
func_check "cpabort"
func_check "hwsync"
func_check "hwsync"
func_check "hwsync"
func_check "lwsync"
func_check "lwsync"
func_check "ptesync"
func_check "ptesync"
func_check "ldat r20,0,0"
func_check "ldat r20,r10,28"
func_check "lwat r21,0,0"
func_check "lwat r21,r11,28"
func_check "stdat r22,0,0"
func_check "stdat r22,r12,28"
func_check "stwat r23,0,0"
func_check "stwat r23,r13,28"
func_check "urfid"
func_check "rmieg r30"
func_check "ldmx r10,0,r15"
func_check "ldmx r10,r3,r15"
func_check "stop"
func_check "wait "
func_check "wait "
func_check "darn r3,0"
func_check "darn r3,1"
func_check "darn r3,2"
func_check "mcrxrx cr0"
func_check "mcrxrx cr7"
func_check "vslv v20,v21,v22"
func_check "vsrv v23,v24,v25"
func_check "msgsync"
func_check "xscmpeqdp vs30,vs40,vs50"
func_check "xscmpgtdp vs31,vs41,vs51"
func_check "xscmpgedp vs32,vs42,vs52"
func_check "xsmincdp vs34,vs44,vs54"
func_check "xsmaxcdp vs35,vs45,vs55"
func_check "xsminjdp vs36,vs46,vs56"
func_check "xsmaxjdp vs37,vs47,vs57"
func_check "vmsumudm v20,v21,v22,v23"
func_check "addex r11,r12,r13,0"
func_check "addex r11,r12,r13,1"
func_check "addex r11,r12,r13,2"
func_check "mffs f25"
func_check "mffs. f25"
func_check "mffsce f26"
func_check "mffscdrn f27,f20"
func_check "mffscdrni f28,0"
func_check "mffscdrni f28,7"
func_check "mffscrn f29,f21"
func_check "mffscrni f30,0"
func_check "mffscrni f30,3"
func_check "mffsl f31"
|