Home | History | Annotate | Line # | Download | only in gdb.arch
      1 # Copyright 2014-2024 Free Software Foundation, Inc.
      2 
      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.
      7 #
      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.
     12 #
     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/>.
     15 
     16 # This file is part of the gdb testsuite.
     17 
     18 # Test PowerPC instructions disassembly.
     19 
     20 standard_testfile .s
     21 set objfile [standard_output_file ${testfile}.o]
     22 
     23 require {istarget "powerpc*-*-*"}
     24 
     25 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
     26     untested "PowerPC instructions disassembly"
     27     return -1
     28 }
     29 
     30 clean_restart ${objfile}
     31 
     32 # Disassemble the function.
     33 set func ""
     34 
     35 gdb_test "set disassembler-options power9"
     36 set test "disass func"
     37 gdb_test_multiple $test $test {
     38     -re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" {
     39 	set func $expect_out(1,string)
     40 	pass $test
     41     }
     42 }
     43 
     44 proc instr_to_patt {instr} {
     45     global decimal hex
     46     # 0x0000000000000018 <+24>:	stxvd2x vs43,r4,r5
     47     return "\[ \t\]*$hex <\\+$decimal>:\[ \t\]*[string_to_regexp $instr]"
     48 }
     49 
     50 proc func_check {instr} {
     51     global func
     52 
     53     set test "found: $instr"
     54     if [regexp -nocase -line [instr_to_patt $instr] $func] {
     55 	pass $test
     56     } else {
     57 	fail $test
     58     }
     59 }
     60 
     61 func_check "cnttzd  r3,r13"
     62 func_check "cnttzd. r4,r14"
     63 func_check "cnttzw  r5,r15"
     64 func_check "cnttzw. r6,r16"
     65 func_check "modsd   r10,r20,r21"
     66 func_check "modsw   r11,r21,r22"
     67 func_check "modud   r12,r22,r23"
     68 func_check "moduw   r13,r23,r24"
     69 func_check "bcdcfn. v3,v4,0"
     70 func_check "bcdcfn. v3,v4,1"
     71 func_check "bcdcfsq. v4,v5,0"
     72 func_check "bcdcfsq. v4,v5,1"
     73 func_check "bcdcfz. v5,v6,0"
     74 func_check "bcdcfz. v5,v6,1"
     75 func_check "bcdcpsgn. v6,v7,v8"
     76 func_check "bcdctn. v7,v8"
     77 func_check "bcdctsq. v8,v9"
     78 func_check "bcdctz. v9,v10,0"
     79 func_check "bcdctz. v9,v10,1"
     80 func_check "bcdsetsgn. v10,v11,0"
     81 func_check "bcdsetsgn. v10,v11,1"
     82 func_check "bcdsr.  v11,v12,v13,0"
     83 func_check "bcdsr.  v11,v12,v13,1"
     84 func_check "bcds.   v12,v13,v14,0"
     85 func_check "bcds.   v12,v13,v14,1"
     86 func_check "bcdtrunc. v13,v14,v15,0"
     87 func_check "bcdtrunc. v13,v14,v15,1"
     88 func_check "bcdus.  v14,v15,v16"
     89 func_check "bcdutrunc. v15,v16,v17"
     90 func_check "lxvll   vs20,0,r21"
     91 func_check "lxvll   vs20,r10,r21"
     92 func_check "stxvll  vs21,0,r11"
     93 func_check "stxvll  vs21,r10,r11"
     94 func_check "vmul10cuq v22,v23"
     95 func_check "vmul10ecuq v23,v24,v25"
     96 func_check "vmul10euq v24,v25,v26"
     97 func_check "vmul10uq v25,v26"
     98 func_check "xsaddqp v10,v11,v12"
     99 func_check "xsaddqpo v11,v12,v12"
    100 func_check "xsrqpi  0,v20,v30,0"
    101 func_check "xsrqpi  1,v20,v30,0"
    102 func_check "xsrqpi  0,v20,v30,3"
    103 func_check "xsrqpi  1,v20,v30,3"
    104 func_check "xsrqpix 0,v21,v31,0"
    105 func_check "xsrqpix 1,v21,v31,0"
    106 func_check "xsrqpix 0,v21,v31,3"
    107 func_check "xsrqpix 1,v21,v31,3"
    108 func_check "xsmulqp v12,v13,v14"
    109 func_check "xsmulqpo v13,v14,v15"
    110 func_check "xsrqpxp 0,v22,v23,0"
    111 func_check "xsrqpxp 1,v22,v23,0"
    112 func_check "xsrqpxp 0,v22,v23,3"
    113 func_check "xsrqpxp 1,v22,v23,3"
    114 func_check "xscpsgnqp v14,v15,v16"
    115 func_check "xscmpoqp cr0,v15,v16"
    116 func_check "xscmpoqp cr7,v15,v16"
    117 func_check "xscmpexpqp cr0,v16,v17"
    118 func_check "xscmpexpqp cr7,v16,v17"
    119 func_check "xsmaddqp v17,v18,v19"
    120 func_check "xsmaddqpo v18,v19,v20"
    121 func_check "xsmsubqp v19,v20,v21"
    122 func_check "xsmsubqpo v20,v21,v22"
    123 func_check "xsnmaddqp v21,v22,v23"
    124 func_check "xsnmaddqpo v22,v23,v24"
    125 func_check "xsnmsubqp v23,v24,v25"
    126 func_check "xsnmsubqpo v24,v25,v26"
    127 func_check "xssubqp v25,v26,v27"
    128 func_check "xssubqpo v26,v27,v28"
    129 func_check "xsdivqp v27,v28,v29"
    130 func_check "xsdivqpo v28,v29,v30"
    131 func_check "xscmpuqp cr0,v29,v30"
    132 func_check "xscmpuqp cr7,v29,v30"
    133 func_check "xststdcqp cr0,v30,0"
    134 func_check "xststdcqp cr7,v30,0"
    135 func_check "xststdcqp cr0,v31,127"
    136 func_check "xststdcqp cr7,v31,127"
    137 func_check "xsabsqp v10,v11"
    138 func_check "xsxexpqp v11,v12"
    139 func_check "xsnabsqp v12,v13"
    140 func_check "xsnegqp v13,v14"
    141 func_check "xsxsigqp v14,v15"
    142 func_check "xssqrtqp v15,v16"
    143 func_check "xssqrtqpo v16,v17"
    144 func_check "xscvqpuwz v17,v18"
    145 func_check "xscvudqp v18,v19"
    146 func_check "xscvqpswz v19,v20"
    147 func_check "xscvsdqp v20,v21"
    148 func_check "xscvqpudz v21,v22"
    149 func_check "xscvqpdp v22,v23"
    150 func_check "xscvqpdpo v23,v24"
    151 func_check "xscvdpqp v24,v25"
    152 func_check "xscvqpsdz v25,v26"
    153 func_check "xsiexpqp v26,v27,v28"
    154 func_check "vpermr  v4,v5,v6,v7"
    155 func_check "vextractub v5,v6,0"
    156 func_check "vextractub v5,v6,15"
    157 func_check "vextractuh v6,v7,0"
    158 func_check "vextractuh v6,v7,15"
    159 func_check "vextractuw v7,v8,0"
    160 func_check "vextractuw v7,v8,15"
    161 func_check "vextractd v8,v9,0"
    162 func_check "vextractd v8,v9,15"
    163 func_check "vinsertb v9,v10,0"
    164 func_check "vinsertb v9,v10,15"
    165 func_check "vinserth v10,v11,0"
    166 func_check "vinserth v10,v11,15"
    167 func_check "vinsertw v11,v12,0"
    168 func_check "vinsertw v11,v12,15"
    169 func_check "vinsertd v12,v13,0"
    170 func_check "vinsertd v12,v13,15"
    171 func_check "mfvsrld r20,vs45"
    172 func_check "mtvsrws vs46,r21"
    173 func_check "mtvsrdd vs47,0,r23"
    174 func_check "mtvsrdd vs47,r22,r23"
    175 func_check "lxvx    vs50,0,r11"
    176 func_check "lxvx    vs0,r10,r11"
    177 func_check "lxvwsx  vs51,0,r12"
    178 func_check "lxvwsx  vs1,r10,r12"
    179 func_check "lxvh8x  vs52,0,r13"
    180 func_check "lxvh8x  vs2,r10,r13"
    181 func_check "lxvb16x vs53,0,r14"
    182 func_check "lxvb16x vs3,r10,r14"
    183 func_check "stxvx   vs54,0,r15"
    184 func_check "stxvx   vs4,r20,r15"
    185 func_check "stxvh8x vs55,0,r16"
    186 func_check "stxvh8x vs5,r20,r16"
    187 func_check "stxvb16x vs56,0,r17"
    188 func_check "stxvb16x vs6,r20,r17"
    189 func_check "xxextractuw vs4,vs5,0"
    190 func_check "xxextractuw vs40,vs50,15"
    191 func_check "xxspltib vs4,0"
    192 func_check "xxspltib vs4,128"
    193 func_check "xxspltib vs41,255"
    194 func_check "xxinsertw vs5,vs6,0"
    195 func_check "xxinsertw vs50,vs60,15"
    196 func_check "xxbrh   vs6,vs7"
    197 func_check "xxbrh   vs56,vs57"
    198 func_check "xxbrw   vs7,vs8"
    199 func_check "xxbrw   vs57,vs58"
    200 func_check "xxbrd   vs8,vs9"
    201 func_check "xxbrd   vs58,vs59"
    202 func_check "xxbrq   vs9,vs10"
    203 func_check "xxbrq   vs59,vs60"
    204 func_check "lxsd    v20,0(0)"
    205 func_check "lxsd    v20,0(r10)"
    206 func_check "lxsd    v20,8(0)"
    207 func_check "lxsd    v20,8(r10)"
    208 func_check "lxsd    v20,-8(0)"
    209 func_check "lxsd    v20,-8(r10)"
    210 func_check "lxsd    v20,32764(0)"
    211 func_check "lxsd    v20,32764(r10)"
    212 func_check "lxsd    v20,-32768(0)"
    213 func_check "lxsd    v20,-32768(r10)"
    214 func_check "lxssp   v30,0(0)"
    215 func_check "lxssp   v30,0(r11)"
    216 func_check "lxssp   v30,8(0)"
    217 func_check "lxssp   v30,8(r11)"
    218 func_check "lxssp   v30,-8(0)"
    219 func_check "lxssp   v30,-8(r11)"
    220 func_check "lxssp   v30,32764(0)"
    221 func_check "lxssp   v30,32764(r11)"
    222 func_check "lxssp   v30,-32768(0)"
    223 func_check "lxssp   v30,-32768(r11)"
    224 func_check "lxv     vs40,0(0)"
    225 func_check "lxv     vs40,0(r12)"
    226 func_check "lxv     vs40,16(0)"
    227 func_check "lxv     vs40,16(r12)"
    228 func_check "lxv     vs40,-16(0)"
    229 func_check "lxv     vs10,-16(r12)"
    230 func_check "lxv     vs10,32752(0)"
    231 func_check "lxv     vs10,32752(r12)"
    232 func_check "lxv     vs10,-32768(0)"
    233 func_check "lxv     vs10,-32768(r12)"
    234 func_check "stxsd   v21,0(0)"
    235 func_check "stxsd   v21,0(r10)"
    236 func_check "stxsd   v21,8(0)"
    237 func_check "stxsd   v21,8(r10)"
    238 func_check "stxsd   v21,-8(0)"
    239 func_check "stxsd   v21,-8(r10)"
    240 func_check "stxsd   v21,32764(0)"
    241 func_check "stxsd   v21,32764(r10)"
    242 func_check "stxsd   v21,-32768(0)"
    243 func_check "stxsd   v21,-32768(r10)"
    244 func_check "stxssp  v31,0(0)"
    245 func_check "stxssp  v31,0(r11)"
    246 func_check "stxssp  v31,8(0)"
    247 func_check "stxssp  v31,8(r11)"
    248 func_check "stxssp  v31,-8(0)"
    249 func_check "stxssp  v31,-8(r11)"
    250 func_check "stxssp  v31,32764(0)"
    251 func_check "stxssp  v31,32764(r11)"
    252 func_check "stxssp  v31,-32768(0)"
    253 func_check "stxssp  v31,-32768(r11)"
    254 func_check "stxv    vs41,0(0)"
    255 func_check "stxv    vs41,0(r12)"
    256 func_check "stxv    vs41,16(0)"
    257 func_check "stxv    vs41,16(r12)"
    258 func_check "stxv    vs41,-16(0)"
    259 func_check "stxv    vs11,-16(r12)"
    260 func_check "stxv    vs11,32752(0)"
    261 func_check "stxv    vs11,32752(r12)"
    262 func_check "stxv    vs11,-32768(0)"
    263 func_check "stxv    vs11,-32768(r12)"
    264 func_check "xxperm  vs20,vs22,vs24"
    265 func_check "xxperm  vs40,vs42,vs44"
    266 func_check "xxpermr vs21,vs23,vs25"
    267 func_check "xxpermr vs41,vs43,vs45"
    268 func_check "extswsli r12,r20,0"
    269 func_check "extswsli r12,r20,1"
    270 func_check "extswsli r12,r20,63"
    271 func_check "extswsli. r13,r21,0"
    272 func_check "extswsli. r13,r21,1"
    273 func_check "extswsli. r13,r21,63"
    274 func_check "vrlwmi  v14,v22,v23"
    275 func_check "vrldmi  v15,v23,v24"
    276 func_check "vrlwnm  v16,v24,v25"
    277 func_check "vrldnm  v17,v25,v26"
    278 func_check "vbpermd v18,v26,v27"
    279 func_check "vnegw   v19,v20"
    280 func_check "vnegd   v20,v21"
    281 func_check "vprtybw v21,v22"
    282 func_check "vprtybd v22,v23"
    283 func_check "vprtybq v23,v24"
    284 func_check "vextsb2w v24,v25"
    285 func_check "vextsh2w v25,v26"
    286 func_check "vextsb2d v26,v27"
    287 func_check "vextsh2d v27,v28"
    288 func_check "vextsw2d v28,v29"
    289 func_check "vctzb   v29,v30"
    290 func_check "vctzh   v30,v31"
    291 func_check "vctzw   v31,v30"
    292 func_check "vctzd   v30,v29"
    293 func_check "lxsibzx vs10,0,r20"
    294 func_check "lxsibzx vs50,r10,r20"
    295 func_check "lxsihzx vs11,0,r21"
    296 func_check "lxsihzx vs51,r11,r21"
    297 func_check "stxsibx vs12,0,r22"
    298 func_check "stxsibx vs52,r12,r22"
    299 func_check "stxsihx vs13,0,r23"
    300 func_check "stxsihx vs53,r13,r23"
    301 func_check "maddhd  r10,r11,r12,r13"
    302 func_check "maddhdu r20,r21,r22,r23"
    303 func_check "maddld  r2,r3,r4,r5"
    304 func_check "xscmpexpdp cr0,vs10,vs20"
    305 func_check "xscmpexpdp cr7,vs40,vs50"
    306 func_check "xsiexpdp vs41,r11,r21"
    307 func_check "xststdcdp cr0,vs11,127"
    308 func_check "xststdcdp cr7,vs41,127"
    309 func_check "xststdcsp cr0,vs11,127"
    310 func_check "xststdcsp cr7,vs41,127"
    311 func_check "xsxexpdp r13,vs43"
    312 func_check "xsxsigdp r14,vs44"
    313 func_check "xviexpdp vs45,vs46,vs47"
    314 func_check "xviexpsp vs46,vs47,vs48"
    315 func_check "xvtstdcdp vs54,vs55,0"
    316 func_check "xvtstdcdp vs54,vs55,127"
    317 func_check "xvtstdcsp vs55,vs56,0"
    318 func_check "xvtstdcsp vs55,vs56,127"
    319 func_check "xvxexpdp vs57,vs58"
    320 func_check "xvxexpsp vs58,vs59"
    321 func_check "xvxsigdp vs59,vs60"
    322 func_check "xvxsigsp vs60,vs61"
    323 func_check "cmpeqb  cr0,r6,r7"
    324 func_check "cmpeqb  cr7,r6,r7"
    325 func_check "cmprb   cr0,0,r8,r9"
    326 func_check "cmprb   cr7,0,r8,r9"
    327 func_check "cmprb   cr0,1,r8,r9"
    328 func_check "cmprb   cr7,1,r8,r9"
    329 func_check "setb    r15,cr0"
    330 func_check "setb    r15,cr7"
    331 func_check "lxvl    vs26,0,r10"
    332 func_check "lxvl    vs56,r20,r10"
    333 func_check "stxvl   vs27,0,r11"
    334 func_check "stxvl   vs57,r21,r11"
    335 func_check "vclzlsbb r20,v30"
    336 func_check "vctzlsbb r21,v31"
    337 func_check "vcmpneb v10,v11,v12"
    338 func_check "vcmpneb. v20,v21,v22"
    339 func_check "vcmpneh v11,v12,v13"
    340 func_check "vcmpneh. v21,v22,v23"
    341 func_check "vcmpnew v12,v13,v14"
    342 func_check "vcmpnew. v22,v23,v24"
    343 func_check "vcmpnezb v13,v14,v15"
    344 func_check "vcmpnezb. v23,v24,v25"
    345 func_check "vcmpnezh v14,v15,v16"
    346 func_check "vcmpnezh. v24,v25,v26"
    347 func_check "vcmpnezw v15,v16,v17"
    348 func_check "vcmpnezw. v25,v26,v27"
    349 func_check "vextublx r16,r17,v10"
    350 func_check "vextubrx r17,r18,v11"
    351 func_check "vextuhlx r18,r19,v12"
    352 func_check "vextuhrx r19,r20,v13"
    353 func_check "vextuwlx r20,r21,v14"
    354 func_check "vextuwrx r21,r22,v15"
    355 func_check "dtstsfi cr0,0,f3"
    356 func_check "dtstsfi cr7,63,f3"
    357 func_check "dtstsfiq cr0,0,f4"
    358 func_check "dtstsfiq cr7,63,f4"
    359 func_check "xscvhpdp vs40,vs50"
    360 func_check "xscvdphp vs41,vs51"
    361 func_check "xvcvhpsp vs42,vs52"
    362 func_check "xvcvsphp vs43,vs53"
    363 func_check "lnia    r3"
    364 func_check "addpcis r4,1"
    365 func_check "addpcis r5,-2"
    366 func_check "addpcis r6,32767"
    367 func_check "addpcis r7,-32768"
    368 func_check "slbsync"
    369 func_check "slbiag  r10"
    370 func_check "slbieg  r10,r11"
    371 func_check "slbmfee r3,r4"
    372 func_check "slbmfee r3,r4,1"
    373 func_check "slbmfev r4,r5"
    374 func_check "slbmfev r4,r5,1"
    375 func_check "tlbie   r3,r4"
    376 func_check "tlbie   r3,r4,3,1,1"
    377 func_check "tlbiel  r3"
    378 func_check "tlbiel  r3,r4,3,1,1"
    379 func_check "copy    r12,r13"
    380 func_check "paste.  r10,r11"
    381 func_check "cpabort"
    382 func_check "hwsync"
    383 func_check "lwsync"
    384 func_check "ptesync"
    385 func_check "ldat    r20,0,0"
    386 func_check "ldat    r20,r10,28"
    387 func_check "lwat    r21,0,0"
    388 func_check "lwat    r21,r11,28"
    389 func_check "stdat   r22,0,0"
    390 func_check "stdat   r22,r12,28"
    391 func_check "stwat   r23,0,0"
    392 func_check "stwat   r23,r13,28"
    393 func_check "urfid"
    394 func_check "rmieg   r30"
    395 func_check "stop"
    396 func_check "wait"
    397 func_check "darn    r3,0"
    398 func_check "darn    r3,1"
    399 func_check "darn    r3,2"
    400 func_check "mcrxrx  cr0"
    401 func_check "mcrxrx  cr7"
    402 func_check "vslv    v20,v21,v22"
    403 func_check "vsrv    v23,v24,v25"
    404 func_check "msgsync"
    405 func_check "xscmpeqdp vs30,vs40,vs50"
    406 func_check "xscmpgtdp vs31,vs41,vs51"
    407 func_check "xscmpgedp vs32,vs42,vs52"
    408 func_check "xsmincdp vs34,vs44,vs54"
    409 func_check "xsmaxcdp vs35,vs45,vs55"
    410 func_check "xsminjdp vs36,vs46,vs56"
    411 func_check "xsmaxjdp vs37,vs47,vs57"
    412 func_check "vmsumudm v20,v21,v22,v23"
    413 func_check "addex   r11,r12,r13,0"
    414 func_check "addex   r11,r12,r13,1"
    415 func_check "addex   r11,r12,r13,2"
    416 func_check "mffs    f25"
    417 func_check "mffs.   f25"
    418 func_check "mffsce  f26"
    419 func_check "mffscdrn f27,f20"
    420 func_check "mffscdrni f28,0"
    421 func_check "mffscdrni f28,7"
    422 func_check "mffscrn f29,f21"
    423 func_check "mffscrni f30,0"
    424 func_check "mffscrni f30,3"
    425 func_check "mffsl   f31"
    426