1; Toshiba MeP C5 Core description. -*- scheme -*- 2; Copyright (C) 2009-2016 Free Software Foundation, Inc. 3; Contributed by Red Hat, Inc. 4; 5; This file is part of GCC. 6; 7; GCC is free software; you can redistribute it and/or modify it under 8; the terms of the GNU General Public License as published by the Free 9; Software Foundation; either version 3, or (at your option) any later 10; version. 11; 12; GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13; WARRANTY; without even the implied warranty of MERCHANTABILITY or 14; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15; for more details. 16; 17; You should have received a copy of the GNU General Public License 18; along with GCC; see the file COPYING3. If not see 19; <http://www.gnu.org/licenses/>. 20 21(dnf f-c5n4 "extended field" (all-mep-core-isas) 16 4) 22(dnf f-c5n5 "extended field" (all-mep-core-isas) 20 4) 23(dnf f-c5n6 "extended field" (all-mep-core-isas) 24 4) 24(dnf f-c5n7 "extended field" (all-mep-core-isas) 28 4) 25(dnf f-rl5 "register l c5" (all-mep-core-isas) 20 4) 26(df f-12s20 "extended field" (all-mep-core-isas) 20 12 INT #f #f) 27 28(dnop rl5 "register Rl c5" (all-mep-core-isas) h-gpr f-rl5) 29(dnop cdisp12 "copro addend (12 bits)" (all-mep-core-isas) h-sint f-12s20) 30 31(dnci stcb_r "store in control bus space" (VOLATILE (MACH c5)) 32 "stcb $rn,($rma)" 33 (+ MAJ_7 rn rma (f-sub4 12)) 34 (c-call VOID "do_stcb" rn (and rma #xffff)) 35 ((mep (unit u-use-gpr (in usereg rn)) 36 (unit u-use-gpr (in usereg rma)) 37 (unit u-exec) 38 (unit u-stcb)))) 39 40(dnci ldcb_r "load from control bus space" (VOLATILE (MACH c5) (LATENCY 3)) 41 "ldcb $rn,($rma)" 42 (+ MAJ_7 rn rma (f-sub4 13)) 43 (set rn (c-call SI "do_ldcb" (and rma #xffff))) 44 ((mep (unit u-use-gpr (in usereg rma)) 45 (unit u-ldcb) 46 (unit u-exec) 47 (unit u-ldcb-gpr (out loadreg rn))))) 48 49(dnci pref "cache prefetch" ((MACH c5) VOLATILE) 50 "pref $cimm4,($rma)" 51 (+ MAJ_7 cimm4 rma (f-sub4 5)) 52 (sequence () 53 (c-call VOID "check_option_dcache" pc) 54 (c-call VOID "do_cache_prefetch" cimm4 rma pc)) 55 ((mep (unit u-use-gpr (in usereg rma)) 56 (unit u-exec)))) 57 58(dnci prefd "cache prefetch" ((MACH c5) VOLATILE) 59 "pref $cimm4,$sdisp16($rma)" 60 (+ MAJ_15 cimm4 rma (f-sub4 3) sdisp16) 61 (sequence () 62 (c-call VOID "check_option_dcache" pc) 63 (c-call VOID "do_cache_prefetch" cimm4 (add INT rma (ext SI sdisp16)) pc)) 64 ((mep (unit u-use-gpr (in usereg rma)) 65 (unit u-exec)))) 66 67(dnci casb3 "compare and swap byte 3" ((MACH c5) VOLATILE OPTIONAL_BIT_INSN) 68 "casb3 $rl5,$rn,($rm)" 69 (+ MAJ_15 rn rm (f-sub4 #x1) (f-c5n4 #x2) rl5 (f-c5n6 #x0) (f-c5n7 #x0)) 70 (sequence () 71 (c-call VOID "do_casb3" (index-of rl5) rn rm pc) 72 (set rl5 rl5) 73 ) 74 ((mep (unit u-use-gpr (in usereg rl5)) 75 (unit u-load-gpr (out loadreg rl5)) 76 (unit u-exec)))) 77 78(dnci cash3 "compare and swap halfword 3" ((MACH c5) VOLATILE OPTIONAL_BIT_INSN) 79 "cash3 $rl5,$rn,($rm)" 80 (+ MAJ_15 rn rm (f-sub4 #x1) (f-c5n4 #x2) rl5 (f-c5n6 #x0) (f-c5n7 #x1)) 81 (sequence () 82 (c-call VOID "do_cash3" (index-of rl5) rn rm pc) 83 (set rl5 rl5) 84 ) 85 ((mep (unit u-use-gpr (in usereg rl5)) 86 (unit u-load-gpr (out loadreg rl5)) 87 (unit u-exec)))) 88 89(dnci casw3 "compare and swap word 3" ((MACH c5) VOLATILE OPTIONAL_BIT_INSN) 90 "casw3 $rl5,$rn,($rm)" 91 (+ MAJ_15 rn rm (f-sub4 #x1) (f-c5n4 #x2) rl5 (f-c5n6 #x0) (f-c5n7 #x2)) 92 (sequence () 93 (c-call VOID "do_casw3" (index-of rl5) rn rm pc) 94 (set rl5 rl5) 95 ) 96 ((mep (unit u-use-gpr (in usereg rl5)) 97 (unit u-load-gpr (out loadreg rl5)) 98 (unit u-exec)))) 99 100 101 102(dnci sbcp "store byte coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5)) 103 "sbcp $crn,$cdisp12($rma)" 104 (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 0) cdisp12) 105 (sequence () 106 (c-call "check_option_cp" pc) 107 (c-call VOID "check_write_to_text" (add rma (ext SI cdisp12))) 108 (set (mem QI (add rma (ext SI cdisp12))) (and crn #xff))) 109 ((mep (unit u-use-gpr (in usereg rma)) 110 (unit u-exec)))) 111 112(dnci lbcp "load byte coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5)) 113 "lbcp $crn,$cdisp12($rma)" 114 (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 4) cdisp12) 115 (sequence () 116 (c-call "check_option_cp" pc) 117 (set crn (ext SI (mem QI (add rma (ext SI cdisp12)))))) 118 ((mep (unit u-use-gpr (in usereg rma)) 119 (unit u-exec)))) 120 121(dnci lbucp "load byte coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5)) 122 "lbucp $crn,$cdisp12($rma)" 123 (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 12) cdisp12) 124 (sequence () 125 (c-call "check_option_cp" pc) 126 (set crn (zext SI (mem QI (add rma (ext SI cdisp12)))))) 127 ((mep (unit u-use-gpr (in usereg rma)) 128 (unit u-exec)))) 129 130 131(dnci shcp "store half-word coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5)) 132 "shcp $crn,$cdisp12($rma)" 133 (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 1) cdisp12) 134 (sequence () 135 (c-call "check_option_cp" pc) 136 (c-call VOID "check_write_to_text" (add rma (ext SI cdisp12))) 137 (set (mem HI (add rma (ext SI cdisp12))) (and crn #xffff))) 138 ((mep (unit u-use-gpr (in usereg rma)) 139 (unit u-exec)))) 140 141(dnci lhcp "load half-word coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5)) 142 "lhcp $crn,$cdisp12($rma)" 143 (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 5) cdisp12) 144 (sequence () 145 (c-call "check_option_cp" pc) 146 (set crn (ext SI (mem HI (add rma (ext SI cdisp12)))))) 147 ((mep (unit u-use-gpr (in usereg rma)) 148 (unit u-exec)))) 149 150(dnci lhucp "load half-word coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5)) 151 "lhucp $crn,$cdisp12($rma)" 152 (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 13) cdisp12) 153 (sequence () 154 (c-call "check_option_cp" pc) 155 (set crn (zext SI (mem HI (add rma (ext SI cdisp12)))))) 156 ((mep (unit u-use-gpr (in usereg rma)) 157 (unit u-exec)))) 158 159 160(dnci lbucpa "load byte coprocessor" (OPTIONAL_CP_INSN (STALL LOAD) (MACH c5)) 161 "lbucpa $crn,($rma+),$cdisp10" 162 (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xC) (f-ext62 #x0) cdisp10) 163 (sequence () 164 (c-call "check_option_cp" pc) 165 (set crn (zext SI (mem QI rma))) 166 (set rma (add rma cdisp10))) 167 ((mep (unit u-use-gpr (in usereg rma)) 168 (unit u-exec)))) 169 170(dnci lhucpa "load half-word coprocessor" (OPTIONAL_CP_INSN (STALL LOAD) (MACH c5)) 171 "lhucpa $crn,($rma+),$cdisp10a2" 172 (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xD) (f-ext62 #x0) cdisp10a2) 173 (sequence () 174 (c-call "check_option_cp" pc) 175 (set crn (zext SI (mem HI (and rma (inv SI 1))))) 176 (set rma (add rma (ext SI cdisp10a2)))) 177 ((mep (unit u-use-gpr (in usereg rma)) 178 (unit u-exec)))) 179 180(dnci lbucpm0 "lbucpm0" (OPTIONAL_CP_INSN (MACH c5)) 181 "lbucpm0 $crn,($rma+),$cdisp10" 182 (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xc) (f-ext62 #x2) cdisp10) 183 (sequence () 184 (c-call "check_option_cp" pc) 185 (set crn (zext SI (mem QI rma))) 186 (set rma (mod0 cdisp10))) 187 ((mep (unit u-use-gpr (in usereg rma)) 188 (unit u-exec)))) 189 190(dnci lhucpm0 "lhucpm0" (OPTIONAL_CP_INSN (MACH c5)) 191 "lhucpm0 $crn,($rma+),$cdisp10a2" 192 (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xd) (f-ext62 #x2) cdisp10a2) 193 (sequence () 194 (c-call "check_option_cp" pc) 195 (set crn (zext SI (mem HI (and rma (inv SI 1))))) 196 (set rma (mod0 cdisp10a2))) 197 ((mep (unit u-use-gpr (in usereg rma)) 198 (unit u-exec)))) 199 200(dnci lbucpm1 "lbucpm1" (OPTIONAL_CP_INSN (MACH c5)) 201 "lbucpm1 $crn,($rma+),$cdisp10" 202 (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xc) (f-ext62 #x3) cdisp10) 203 (sequence () 204 (c-call "check_option_cp" pc) 205 (set crn (zext SI (mem QI rma))) 206 (set rma (mod1 cdisp10))) 207 ((mep (unit u-use-gpr (in usereg rma)) 208 (unit u-exec)))) 209 210(dnci lhucpm1 "lhucpm1" (OPTIONAL_CP_INSN (MACH c5)) 211 "lhucpm1 $crn,($rma+),$cdisp10a2" 212 (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xd) (f-ext62 #x3) cdisp10a2) 213 (sequence () 214 (c-call "check_option_cp" pc) 215 (set crn (zext SI (mem HI (and rma (inv SI 1))))) 216 (set rma (mod1 cdisp10a2))) 217 ((mep (unit u-use-gpr (in usereg rma)) 218 (unit u-exec)))) 219 220(dnci uci "uci" ((MACH c5) VOLATILE) 221 "uci $rn,$rm,$uimm16" 222 (+ MAJ_15 rn rm (f-sub4 2) simm16) 223 (set rn (c-call SI "do_UCI" rn rm (zext SI uimm16) pc)) 224 ((mep (unit u-use-gpr (in usereg rm)) 225 (unit u-use-gpr (in usereg rn)) 226 (unit u-exec)))) 227 228(dnf f-c5-rnm "register n/m" (all-mep-isas) 4 8) 229(dnf f-c5-rm "register m" (all-mep-isas) 8 4) 230(df f-c5-16u16 "general 16-bit u-val" (all-mep-isas) 16 16 UINT #f #f) 231 232(dnmf f-c5-rmuimm20 "20-bit immediate in Rm/Imm16" (all-mep-isas) UINT 233 (f-c5-rm f-c5-16u16) 234 (sequence () ; insert 235 (set (ifield f-c5-rm) (srl (ifield f-c5-rmuimm20) 16)) 236 (set (ifield f-c5-16u16) (and (ifield f-c5-rmuimm20) #xffff)) 237 ) 238 (sequence () ; extract 239 (set (ifield f-c5-rmuimm20) (or (ifield f-c5-16u16) 240 (sll (ifield f-c5-rm) 16))) 241 ) 242 ) 243(dnop c5rmuimm20 "20-bit immediate in rm and imm16" (all-mep-core-isas) h-uint f-c5-rmuimm20) 244 245(dnmf f-c5-rnmuimm24 "24-bit immediate in Rm/Imm16" (all-mep-isas) UINT 246 (f-c5-rnm f-c5-16u16) 247 (sequence () ; insert 248 (set (ifield f-c5-rnm) (srl (ifield f-c5-rnmuimm24) 16)) 249 (set (ifield f-c5-16u16) (and (ifield f-c5-rnmuimm24) #xffff)) 250 ) 251 (sequence () ; extract 252 (set (ifield f-c5-rnmuimm24) (or (ifield f-c5-16u16) 253 (sll (ifield f-c5-rnm) 16))) 254 ) 255 ) 256(dnop c5rnmuimm24 "24-bit immediate in rn, rm, and imm16" (all-mep-core-isas) h-uint f-c5-rnmuimm24) 257 258(dnci dsp "dsp" ((MACH c5) VOLATILE) 259 "dsp $rn,$rm,$uimm16" 260 (+ MAJ_15 rn rm (f-sub4 0) uimm16) 261 (set rn (c-call SI "do_DSP" rn rm (zext SI uimm16) pc)) 262 ((mep (unit u-use-gpr (in usereg rm)) 263 (unit u-use-gpr (in usereg rn)) 264 (unit u-exec)))) 265 266(dnci dsp0 "dsp0" ((MACH c5) VOLATILE NO-DIS ALIAS) 267 "dsp0 $c5rnmuimm24" 268 (+ MAJ_15 c5rnmuimm24 (f-sub4 0)) 269 (c-call VOID "do_DSP" (zext SI c5rnmuimm24) pc) 270 ((mep (unit u-exec)))) 271 272(dnci dsp1 "dsp1" ((MACH c5) VOLATILE NO-DIS ALIAS) 273 "dsp1 $rn,$c5rmuimm20" 274 (+ MAJ_15 rn (f-sub4 0) c5rmuimm20) 275 (set rn (c-call SI "do_DSP" rn (zext SI c5rmuimm20) pc)) 276 ((mep (unit u-use-gpr (in usereg rn)) 277 (unit u-exec)))) 278