1 # Copyright 2014-2022 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # This file is part of the gdb testsuite.
18 # Test PowerPC instructions disassembly.
21 set objfile [standard_output_file ${testfile}.o]
23 if {![istarget "powerpc*-*-*"]} then {
24 verbose "Skipping PowerPC instructions disassembly."
28 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
29 untested "PowerPC instructions disassembly"
33 clean_restart ${objfile}
35 # Disassemble the function.
38 gdb_test "set disassembler-options power7"
39 set test "disass func"
40 gdb_test_multiple $test $test {
41 -re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" {
42 set func $expect_out(1,string)
47 proc instr_to_patt {instr} {
49 # 0x0000000000000018 <+24>: stxvd2x vs43,r4,r5
50 return "\[ \t\]*$hex <\\+$decimal>:\[ \t\]*[string_to_regexp $instr]"
53 proc func_check {instr} {
56 set test "found: $instr"
57 if [regexp -nocase -line [instr_to_patt $instr] $func] {
64 func_check "lxvd2x vs3,r4,r5"
65 func_check "lxvd2x vs43,r4,r5"
66 func_check "stxvd2x vs3,r4,r5"
67 func_check "stxvd2x vs43,r4,r5"
68 func_check "xxmrghd vs3,vs4,vs5"
69 func_check "xxmrghd vs43,vs44,vs45"
70 func_check "xxmrgld vs3,vs4,vs5"
71 func_check "xxmrgld vs43,vs44,vs45"
72 func_check "xxpermdi vs3,vs4,vs5,1"
73 func_check "xxpermdi vs43,vs44,vs45,1"
74 func_check "xxpermdi vs3,vs4,vs5,2"
75 func_check "xxpermdi vs43,vs44,vs45,2"
76 func_check "xvmovdp vs3,vs4"
77 func_check "xvmovdp vs43,vs44"
78 func_check "xvcpsgndp vs3,vs4,vs5"
79 func_check "xvcpsgndp vs43,vs44,vs45"
84 func_check "prtyw r3,r4"
85 func_check "prtyd r13,r14"
86 func_check "mfcfar r10"
87 func_check "mtcfar r11"
88 func_check "cmpb r3,r4,r5"
89 func_check "lwzcix r10,r11,r12"
90 func_check "dadd f16,f17,f18"
91 func_check "daddq f20,f22,f24"
94 func_check "dst r5,r4,1"
95 func_check "dstt r8,r7,0"
96 func_check "dstst r5,r6,3"
97 func_check "dststt r4,r5,2"
98 func_check "divwe r10,r11,r12"
99 func_check "divwe. r11,r12,r13"
100 func_check "divweo r12,r13,r14"
101 func_check "divweo. r13,r14,r15"
102 func_check "divweu r10,r11,r12"
103 func_check "divweu. r11,r12,r13"
104 func_check "divweuo r12,r13,r14"
105 func_check "divweuo. r13,r14,r15"
106 func_check "bpermd r7,r17,r27"
107 func_check "popcntw r10,r20"
108 func_check "popcntd r10,r20"
109 func_check "ldbrx r20,r21,r22"
110 func_check "stdbrx r20,r21,r22"
111 func_check "lfiwzx f10,0,r10"
112 func_check "lfiwzx f10,r9,r10"
113 func_check "fcfids f4,f5"
114 func_check "fcfids. f4,f5"
115 func_check "fcfidus f4,f5"
116 func_check "fcfidus. f4,f5"
117 func_check "fctiwu f4,f5"
118 func_check "fctiwu. f4,f5"
119 func_check "fctiwuz f4,f5"
120 func_check "fctiwuz. f4,f5"
121 func_check "fctidu f4,f5"
122 func_check "fctidu. f4,f5"
123 func_check "fctiduz f4,f5"
124 func_check "fctiduz. f4,f5"
125 func_check "fcfidu f4,f5"
126 func_check "fcfidu. f4,f5"
127 func_check "ftdiv cr0,f10,f11"
128 func_check "ftdiv cr7,f10,f11"
129 func_check "ftsqrt cr0,f10"
130 func_check "ftsqrt cr7,f10"
131 func_check "dcbtt r8,r9"
132 func_check "dcbtstt r8,r9"
133 func_check "dcffix f10,f12"
134 func_check "dcffix. f20,f22"
135 func_check "fre f14,f15"
136 func_check "fre. f14,f15"
137 func_check "fres f14,f15"
138 func_check "fres. f14,f15"
139 func_check "frsqrte f14,f15"
140 func_check "frsqrte. f14,f15"
141 func_check "frsqrtes f14,f15"
142 func_check "frsqrtes. f14,f15"
143 func_check "isel r2,r3,r4,28"
145 func_check "ori r2,r2,0"
149 func_check "mfppr r10"
150 func_check "mfppr32 r11"
151 func_check "mtppr r12"
152 func_check "mtppr32 r13"
153 func_check "tlbie r10,r11"