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 power7"
     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 "lxvd2x  vs3,r4,r5"
     62 func_check "lxvd2x  vs43,r4,r5"
     63 func_check "stxvd2x vs3,r4,r5"
     64 func_check "stxvd2x vs43,r4,r5"
     65 func_check "xxmrghd vs3,vs4,vs5"
     66 func_check "xxmrghd vs43,vs44,vs45"
     67 func_check "xxmrgld vs3,vs4,vs5"
     68 func_check "xxmrgld vs43,vs44,vs45"
     69 func_check "xxpermdi vs3,vs4,vs5,1"
     70 func_check "xxpermdi vs43,vs44,vs45,1"
     71 func_check "xxpermdi vs3,vs4,vs5,2"
     72 func_check "xxpermdi vs43,vs44,vs45,2"
     73 func_check "xvmovdp vs3,vs4"
     74 func_check "xvmovdp vs43,vs44"
     75 func_check "xvcpsgndp vs3,vs4,vs5"
     76 func_check "xvcpsgndp vs43,vs44,vs45"
     77 func_check "doze"
     78 func_check "nap"
     79 func_check "sleep"
     80 func_check "rvwinkle"
     81 func_check "prtyw   r3,r4"
     82 func_check "prtyd   r13,r14"
     83 func_check "mfcfar  r10"
     84 func_check "mtcfar  r11"
     85 func_check "cmpb    r3,r4,r5"
     86 func_check "lwzcix  r10,r11,r12"
     87 func_check "dadd    f16,f17,f18"
     88 func_check "daddq   f20,f22,f24"
     89 func_check "dss     3"
     90 func_check "dssall"
     91 func_check "dst     r5,r4,1"
     92 func_check "dstt    r8,r7,0"
     93 func_check "dstst   r5,r6,3"
     94 func_check "dststt  r4,r5,2"
     95 func_check "divwe   r10,r11,r12"
     96 func_check "divwe.  r11,r12,r13"
     97 func_check "divweo  r12,r13,r14"
     98 func_check "divweo. r13,r14,r15"
     99 func_check "divweu  r10,r11,r12"
    100 func_check "divweu. r11,r12,r13"
    101 func_check "divweuo r12,r13,r14"
    102 func_check "divweuo. r13,r14,r15"
    103 func_check "bpermd  r7,r17,r27"
    104 func_check "popcntw r10,r20"
    105 func_check "popcntd r10,r20"
    106 func_check "ldbrx   r20,r21,r22"
    107 func_check "stdbrx  r20,r21,r22"
    108 func_check "lfiwzx  f10,0,r10"
    109 func_check "lfiwzx  f10,r9,r10"
    110 func_check "fcfids  f4,f5"
    111 func_check "fcfids. f4,f5"
    112 func_check "fcfidus f4,f5"
    113 func_check "fcfidus. f4,f5"
    114 func_check "fctiwu  f4,f5"
    115 func_check "fctiwu. f4,f5"
    116 func_check "fctiwuz f4,f5"
    117 func_check "fctiwuz. f4,f5"
    118 func_check "fctidu  f4,f5"
    119 func_check "fctidu. f4,f5"
    120 func_check "fctiduz f4,f5"
    121 func_check "fctiduz. f4,f5"
    122 func_check "fcfidu  f4,f5"
    123 func_check "fcfidu. f4,f5"
    124 func_check "ftdiv   cr0,f10,f11"
    125 func_check "ftdiv   cr7,f10,f11"
    126 func_check "ftsqrt  cr0,f10"
    127 func_check "ftsqrt  cr7,f10"
    128 func_check "dcbtt   r8,r9"
    129 func_check "dcbtstt r8,r9"
    130 func_check "dcffix  f10,f12"
    131 func_check "dcffix. f20,f22"
    132 func_check "fre     f14,f15"
    133 func_check "fre.    f14,f15"
    134 func_check "fres    f14,f15"
    135 func_check "fres.   f14,f15"
    136 func_check "frsqrte f14,f15"
    137 func_check "frsqrte. f14,f15"
    138 func_check "frsqrtes f14,f15"
    139 func_check "frsqrtes. f14,f15"
    140 func_check "isel    r2,r3,r4,4*cr7+lt"
    141 func_check "yield"
    142 func_check "ori     r2,r2,0"
    143 func_check "nop"
    144 func_check "mdoio"
    145 func_check "mdoom"
    146 func_check "mfppr   r10"
    147 func_check "mfppr32 r11"
    148 func_check "mtppr   r12"
    149 func_check "mtppr32 r13"
    150 func_check "tlbie   r10,r11"
    151